Answer the following statements true (T) or false (F)

1. Each activation frame contains all the function’s code, as well as the automatic variables and formal parameters.
2. The activation frames in nested function calls are handled in a last-in/ first-out order.
3. A binary search works with any array of numbers.
4. For the binary search in the text to work, the element searched for must actually be present in the array.


1. False
There is only one copy of the function’s code. The activation record contains the local variables and parameters created at each invocation of the function.But you can think of the activation frame as containing the functions code. The text does say only one copy but the discussion is almost as if there is a copy on each activation frame as a useful fiction.
2. True
Suppose function A calls function B, calls function C. The A’s activation record is placed on top of the A’s caller’s activation record. B’s activation record is placed on top of A’s and C’s is placed on top of A’s. When A returns, its activation record is removed from the stack, and when B returns, its activation record is removed, and so on. All this in last-in-first-out order.
3. False
One of the preconditions for the binary search in the text is that the array be sorted in increasing order.
4. False
The routine in the text sets the bool reference variable to false if the key is not found.

Computer Science & Information Technology

You might also like to view...

What does the following statement do?

``` Scanner scanner = new Scanner(Paths.get("test.txt")); ``` a. Opens a binary file for input. b. Opens a binary file for output. c. Opens a text file for input. d. Opens a text file for output.

Computer Science & Information Technology

The mouse pointer changes to a four-headed arrow when you resize an object

Indicate whether the statement is true or false

Computer Science & Information Technology

_________ automatically removes unwanted portions of the picture

A) Remove Background B) Delete Effects C) Change Picture D) Reset Picture

Computer Science & Information Technology

What is the minimum recommended amount of disk space that should be used for storing WSUS updates?

A. 10 GB B. 40 GB C. 100 GB D. 1 TB

Computer Science & Information Technology