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 List Traversal

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

Solutions

ED00

ED01

ED02

ED03