Module 5 Study Guide
Learning Objectives
- Understand what a variable is
- List the six attributes of a variable and explain what the name, address, value, and type attributes are
- Distinguish the four variable lifetime categories of static, stack-dynamic, explicit heap-dynamic, and implicit heap-dynamic
- Give examples of variables with each of the four variable lifetime categories
- Explain the regions where memory is allocated for each of the four variable lifetime categories
- Explain what variable with different lifetimes are used for, and identify languages that provide variables in each variable lifetime category
- State the definitions of scope and visibility
- Explain how to determine the scope of declarations and the visibility of variables under static or dynamic scope
- Execute programs by hand and correctly determine the output when it depends on static or dynamic scope
- Explain the difference between local, non-local, and global variables
- Explain what a block is
- Explain the difference between scope and lifetime
- Define the referencing environment at a point in a program
- Distinguish between a sub-program being active and not active, and explain the relevance of this for static and dynamic scope
- Explain what a named constant is and contrast it with a literal constant and a variable
Resources
Lab
Please complete the lab for this week: lab-scoping.pdf
Deliverables
The test for this module will take place in class on Friday. You will have an opportunity to re-take a different version of the same test next week. If you choose to do the re-take, your grade for this module will be the higher of the two scores.