- [Pts 2]
A dynamic variable is allocated on (only one answer, please)
- the heap
- the stack
- the globals' space
- the dynamic libraries
- [Pts 2]
A local variable is allocated by (only one answer, please)
- a "new" instruction
- a declaration in a procedure
- a global declaration
- an assignment
- [Pts 2]
An instruction of the form p = NULL; can produce a memory leak if (only one answer, please)
- p was a dangling reference
- p was previously pointing to a location on the heap
- p was pointing to a location on the stack
- p was pointing to the some location to which another pointer, q, was pointing as well
- [Pts 2]
A dangling reference is (only one answer, please)
- a pointer to a location which contains a dangling-else instruction
- a pointer set to NULL
- a pointer to the return value of a function which may loop
- a pointer to a location which is considered free
- [Pts 2]
In a language with static scope the binding relevant for a non-local variable x is (only one answer, please)
- determined at run time as the last declaration encountered for x
- determined at compile time by the structure of the program
- determined statically by the parser
- determined globally as for the static variables