You are on page 1of 6

Programming Languages Principles

and Practices 3rd Edition Louden Test


Bank
Visit to download the full and correct content document: https://testbankdeal.com/dow
nload/programming-languages-principles-and-practices-3rd-edition-louden-test-bank/
Chapter 10: Control II - Procedures and Environments

TRUE/FALSE

1. Procedures were first introduced when memory was scarce, as a way of splitting a program into
small, separately compiled pieces.

ANS: T PTS: 1 REF: 444

2. An activation record is a stored log recording each time a procedure or function is activated.

ANS: F PTS: 1 REF: 445

3. A procedure specification includes its name, the names and types of its formal parameters and its
return type, if any.

ANS: T PTS: 1 REF: 445

4. You call a procedure by stating its name, together with arguments to the call.

ANS: T PTS: 1 REF: 445

5. A procedure is a mechanism for abstracting a group of actions or computations.

ANS: T PTS: 1 REF: 445

6. A call to a procedure transfers control to the beginning of the body of the called procedure.

ANS: T PTS: 1 REF: 446

7. A procedure declaration creates a constant procedure value and associates a symbolic name with
that value.

ANS: T PTS: 1 REF: 447

8. An activation of a block cannot communicate with the rest of the program.

ANS: F PTS: 1 REF: 449

9. Another name for activation record is stack record.

ANS: F PTS: 1 REF: 448

10. When you define a procedure, the parameters you list in the interface are the formal parameters.

ANS: T PTS: 1 REF: 450

11. 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.

ANS: T PTS: 1 REF: 451


12. In C and Java, parameters passed by value behave as local variables of the procedure.

ANS: T PTS: 1 REF: 452

13. Pass by value implies that changes cannot occur outside the procedure through the use of
parameters.

ANS: F PTS: 1 REF: 452

14. Pass by value is the default mechanism in C++ and Pascal.

ANS: T PTS: 1 REF: 452

15. If a pointer is passed by value, the procedure cannot modify the contents of the pointer.

ANS: F PTS: 1 REF: 452

16. Pass by reference is also known as copy-restore.

ANS: F PTS: 1 REF: 454

17. Pass by value-result is also known as copy-in, copy-out.

ANS: T PTS: 1 REF: 454

18. Pass by name can be described as an advanced inlining process for procedures.

ANS: T PTS: 1 REF: 455

19. Pass by name is included in all Algol60 descendants.

ANS: F PTS: 1 REF: 455

20. In pass by name parameter passing, arguments are not evaluated until their actual use as
parameters in the procedure.

ANS: T PTS: 1 REF: 455

21. In Ada, parameters can be declared as in or out, but not both.

ANS: F PTS: 1 REF: 458

22. In strongly typed languages, procedure calls must be checked so that the arguments agree in type
and number with the parameters of the procedure.

ANS: T PTS: 1 REF: 459

23. Recursion is allowed in Fortran77.

ANS: F PTS: 1 REF: 459

24. Reference counting is a lazy method of storage reclamation.


ANS: F PTS: 1 REF: 475

25. Mark and sweep is a lazy method of storage reclamation.

ANS: T PTS: 1 REF: 476

MULTIPLE CHOICE

1. A ____ is a mechanism in programming for abstracting a group of actions or computations.


a. statement c. block
b. procedure d. method
ANS: B PTS: 1 REF: 445

2. The group of actions in a procedure is called the ____ of the procedure.


a. parameters c. activation record
b. arguments d. body
ANS: D PTS: 1 REF: 445

3. A procedure is defined by providing a(n) ____ and a body.


a. name c. activation record
b. interface d. error handler
ANS: B PTS: 1 REF: 445

4. ____ are used to revert control back to a method caller.


a. Return-statements c. Control-statements
b. Revert-statements d. Redirect-statements
ANS: A PTS: 1 REF: 446

5. A procedure communicates with the rest of the program through its parameters and through ____.
a. constants c. nonlocal references
b. functions d. overloaded variables
ANS: C PTS: 1 REF: 447

6. The ____ determines the allocation of memory.


a. stack c. memory manager
b. environment d. translator
ANS: B PTS: 1 REF: 447

7. The ____ is the memory allocated for the local objects of a procedure block.
a. call record c. activation heap
b. activation record d. heap record
ANS: B PTS: 1 REF: 448

8. The ____ environment houses global variables.


a. calling c. defining
b. dynamic d. universal
ANS: C PTS: 1 REF: 449
9. Variables declared in the calling method are said to be in the ____ environment.
a. calling c. static
b. defining d. stack
ANS: A PTS: 1 REF: 449

10. A procedure communicates with its calling environment through ____.


a. parameters c. constants
b. local variables d. shared memory
ANS: A PTS: 1 REF: 450

11. ____ are known as actual parameters.


a. Arguments c. Control statements
b. Global variables d. Normal parameters
ANS: A PTS: 1 REF: 450

12. A procedure with no nonlocal dependencies is considered to be in ____ form.


a. independent c. control
b. closed d. structured
ANS: B PTS: 1 REF: 450

13. If a parameter behaves as a constant value during execution, the parameter is passed ___.
a. by address c. by type
b. by reference d. by value
ANS: D PTS: 1 REF: 451

14. If the parameter becomes an alias for the argument, the parameter is passed ____.
a. by reference c. by value
b. by address d. by type
ANS: A PTS: 1 REF: 452

15. Pass ____ copies in the parameter value, and at the end of execution, copies out the final value of
the parameter.
a. by value c. by value-result
b. by reference d. by address
ANS: C PTS: 1 REF: 454

16. Historically, the interpretation of pass by name arguments as functions to be evaluated was
expressed by referring to them as ____.
a. chunks c. thunks
b. objects d. expressions
ANS: C PTS: 1 REF: 456

17. 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 c. global
b. universal d. fully static
ANS: D PTS: 1 REF: 459
18. The ____ maintains the location of the current activation record.
a. environment pointer c. stack pointer
b. activation pointer d. stack register
ANS: A PTS: 1 REF: 462

19. The pointer to the previous activation record is the ____ link.
a. reverse c. control
b. history d. return
ANS: C PTS: 1 REF: 462

20. The local variable ____ stores the distance from the environment pointer.
a. distance c. offset
b. locator d. pointer
ANS: C PTS: 1 REF: 464

21. The access link provides access to ____.


a. local variables c. parameters
b. nonlocal variables d. imported variables
ANS: B PTS: 1 REF: 467

22. ____ occurs when multiple access links must be followed to arrive at a nonlocal variable.
a. Access chaining c. Environmental linking
b. Lexical chaining d. Global linking
ANS: A PTS: 1 REF: 468

23. In a(n) ____ environment, activation records are not removed as long as there are references to any
of its local objects.
a. closed c. type safe
b. fully dynamic d. fully static
ANS: B PTS: 1 REF: 472

24. 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 c. reference counting
b. defragmenting d. coalescing
ANS: D PTS: 1 REF: 474

25. 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
ANS: B PTS: 1 REF: 475

You might also like