Deck 10: Control II - Procedures and Environments
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/50
Play
Full screen (f)
Deck 10: Control II - Procedures and Environments
1
Pass by name is included in all Algol60 descendants.
False
2
If a pointer is passed by value,the procedure cannot modify the contents of the pointer.
False
3
Pass by value is the default mechanism in C++ and Pascal.
True
4
A procedure is a mechanism for abstracting a group of actions or computations.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
5
In C and Java,parameters passed by value behave as local variables of the procedure.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
6
Pass by value-result is also known as copy-in,copy-out.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
7
In pass by name parameter passing,arguments are not evaluated until their actual use as parameters in the procedure.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
8
Pass by name can be described as an advanced inlining process for procedures.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
9
You call a procedure by stating its name,together with arguments to the call.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
10
Pass by value implies that changes cannot occur outside the procedure through the use of parameters.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
11
A procedure specification includes its name,the names and types of its formal parameters and its return type,if any.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
12
An activation record is a stored log recording each time a procedure or function is activated.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
13
When parameters are passed by value,the arguments are expressions that are evaluated at the time of the call,with the arguments' values becoming the values of the parameters during the execution of the procedure.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
14
Procedures were first introduced when memory was scarce,as a way of splitting a program into small,separately compiled pieces.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
15
When you define a procedure,the parameters you list in the interface are the formal parameters.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
16
Pass by reference is also known as copy-restore.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
17
A procedure declaration creates a constant procedure value and associates a symbolic name with that value.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
18
A call to a procedure transfers control to the beginning of the body of the called procedure.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
19
Another name for activation record is stack record.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
20
An activation of a block cannot communicate with the rest of the program.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
21
The group of actions in a procedure is called the ____ of the procedure.
A) parameters
B) arguments
C) activation record
D) body
A) parameters
B) arguments
C) activation record
D) body
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
22
Variables declared in the calling method are said to be in the ____ environment.
A) calling
B) defining
C) static
D) stack
A) calling
B) defining
C) static
D) stack
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
23
A procedure with no nonlocal dependencies is considered to be in ____ form.
A) independent
B) closed
C) control
D) structured
A) independent
B) closed
C) control
D) structured
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
24
Reference counting is a lazy method of storage reclamation.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
25
A procedure communicates with the rest of the program through its parameters and through ____.
A) constants
B) functions
C) nonlocal references
D) overloaded variables
A) constants
B) functions
C) nonlocal references
D) overloaded variables
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
26
The ____ environment houses global variables.
A) calling
B) dynamic
C) defining
D) universal
A) calling
B) dynamic
C) defining
D) universal
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
27
____ are known as actual parameters.
A) Arguments
B) Global variables
C) Control statements
D) Normal parameters
A) Arguments
B) Global variables
C) Control statements
D) Normal parameters
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
28
In Ada,parameters can be declared as in or out,but not both.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
29
A procedure is defined by providing a(n)____ and a body.
A) name
B) interface
C) activation record
D) error handler
A) name
B) interface
C) activation record
D) error handler
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
30
Recursion is allowed in Fortran77.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
31
A procedure communicates with its calling environment through ____.
A) parameters
B) local variables
C) constants
D) shared memory
A) parameters
B) local variables
C) constants
D) shared memory
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
32
In strongly typed languages,procedure calls must be checked so that the arguments agree in type and number with the parameters of the procedure.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
33
A ____ is a mechanism in programming for abstracting a group of actions or computations.
A) statement
B) procedure
C) block
D) method
A) statement
B) procedure
C) block
D) method
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
34
If the parameter becomes an alias for the argument,the parameter is passed ____.
A) by reference
B) by address
C) by value
D) by type
A) by reference
B) by address
C) by value
D) by type
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
35
The ____ is the memory allocated for the local objects of a procedure block.
A) call record
B) activation record
C) activation heap
D) heap record
A) call record
B) activation record
C) activation heap
D) heap record
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
36
Mark and sweep is a lazy method of storage reclamation.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
37
The ____ determines the allocation of memory.
A) stack
B) environment
C) memory manager
D) translator
A) stack
B) environment
C) memory manager
D) translator
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
38
____ are used to revert control back to a method caller.
A) Return-statements
B) Revert-statements
C) Control-statements
D) Redirect-statements
A) Return-statements
B) Revert-statements
C) Control-statements
D) Redirect-statements
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
39
If a parameter behaves as a constant value during execution,the parameter is passed ___.
A) by address
B) by reference
C) by type
D) by value
A) by address
B) by reference
C) by type
D) by value
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
40
Pass ____ copies in the parameter value,and at the end of execution,copies out the final value of the parameter.
A) by value
B) by reference
C) by value-result
D) by address
A) by value
B) by reference
C) by value-result
D) by address
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
41
In a(n)____ environment,all memory allocation can be performed at load time,and the location of all variables are fixed for the duration of program execution.
A) dynamic
B) universal
C) global
D) fully static
A) dynamic
B) universal
C) global
D) fully static
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
42
Historically,the interpretation of pass by name arguments as functions to be evaluated was expressed by referring to them as ____.
A) chunks
B) objects
C) thunks
D) expressions
A) chunks
B) objects
C) thunks
D) expressions
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
43
The process of joining a block of free memory with immediately adjacent blocks to form a larger contiguous block of free memory is called ____.
A) consolidation
B) defragmenting
C) reference counting
D) coalescing
A) consolidation
B) defragmenting
C) reference counting
D) coalescing
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
44
Reference counting is a form of ____.
A) tracking parameter use
B) reclamation of storage that is no longer referenced
C) allocating memory
D) accessing nonlocal variables
A) tracking parameter use
B) reclamation of storage that is no longer referenced
C) allocating memory
D) accessing nonlocal variables
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
45
In a(n)____ environment,activation records are not removed as long as there are references to any of its local objects.
A) closed
B) fully dynamic
C) type safe
D) fully static
A) closed
B) fully dynamic
C) type safe
D) fully static
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
46
The access link provides access to ____.
A) local variables
B) nonlocal variables
C) parameters
D) imported variables
A) local variables
B) nonlocal variables
C) parameters
D) imported variables
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
47
The local variable ____ stores the distance from the environment pointer.
A) distance
B) locator
C) offset
D) pointer
A) distance
B) locator
C) offset
D) pointer
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
48
____ occurs when multiple access links must be followed to arrive at a nonlocal variable.
A) Access chaining
B) Lexical chaining
C) Environmental linking
D) Global linking
A) Access chaining
B) Lexical chaining
C) Environmental linking
D) Global linking
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
49
The pointer to the previous activation record is the ____ link.
A) reverse
B) history
C) control
D) return
A) reverse
B) history
C) control
D) return
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
50
The ____ maintains the location of the current activation record.
A) environment pointer
B) activation pointer
C) stack pointer
D) stack register
A) environment pointer
B) activation pointer
C) stack pointer
D) stack register
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck