This preview shows page 1. Sign up to view the full content.
Unformatted text preview: CS3723 Midterm Exam 2 Solution for concept questions 1. (30pts) Finish the following sentences by filling in the blanks. (a) In programming languages, a block is a region of code that introduces new variables . Blocks can be nested inside each other but not overlapped with each other. An example of a block in Scheme is (let ((x 2)) x) ; An example of a block in ML is fun foo(x) = x; . (b) When programs are loaded to memory to be evaluated, its memory space can be separated into three components, the code space , which contains the program/instructions to be evaluated ; the runtime stack , which contains storages for all local variables ; and the heap , which contains dynamically allocated storages . (c) The scoping rule of a programming language defines where to look for the scope of (i.e., the block that declares) non-local variables at runtime. If static scoping is used, we find the scope of a non- local variable by looking in the blocks that contain the current one ; in contrast, if dynamic scop-...
View Full Document
This note was uploaded on 10/13/2009 for the course CS 3773 taught by Professor Staff during the Spring '08 term at The University of Texas at San Antonio- San Antonio.
- Spring '08
- Software engineering