Environment Diagram Practice


Below are optional practice problems for drawing environment diagrams. These diagrams cover if-else blocks, functions and name resolution. Solutions for each problem can be found at the bottom of this page

For more information and explanation on diagrams make sure to revisit the LS18 slides

Optional ED00 If-else and conditions

Given the code block below, draw an environment diagram paused after the print statement on line 5 is reached.

Optional ED01 Nested function calls

Given the code block below, draw an environment diagram paused after the print statement on line 3 is reached.

Optional ED02 Name resolution

Given the code block below, draw an environment diagram paused after the print statement on line 7 is reached.

Optional ED03 Tuples

Given the code block below, draw an environment diagram paused after the print statement on line 9 is reached.

Optional ED04 List Traversal

Given the code block below, draw an environment diagram paused after the main function finishes running on line 27.

Optional ED05 Classes and Objects

Given the code block below, draw an environment diagram paused after the main function finishes running on line 27.

Optional ED06 Linked Lists

Optional ED07 Recursion

Solutions

ED00

ED01

ED02

ED03

ED04

ED05

ED06

ED07