Chapter 6 Questions
c. values of global variables
d. a reference to the point from which the recursive call was made
22. The ______ operation of the ADT stack retrieves and then removes the top of the stack.
a. isEmpty
b. push
c. pop
d. peek
23. A stack is initially empty, then the following commands are performed:
push 5, push 7, pop, push 10, push 5, pop
which of the following is the correct stack after those commands (assume the top of the stack is on the
left)?
a. 5 10 7 5
b. 5 10
c. 7 5
d. 10 5
26. Consider the peek() operation for the ADT Stack as described by the author. What is its output?
a. true or false
a. there is no output
b. the object that is at the top of the stack
c. the number of items left on the stack
28. Which of the following is a good analogy of the ADT Stack?
a. people standing in a cafeteria line
b. a paper bag with colored poker chips
c. a group of people playing musical chairs
d. a pile of textbooks on your desk
29. Consider the push(newEntry) operation of the ADT Stack. What is the output of the operation?
a. true or false
b. there is no output
c. the object that is at the top of the stack
d. the number of items left on the stack
30. Why would axioms be specified for an ADT.
a. to determine the cost of development
b. specify the behavior of the ADT
c. to determine possible uses of the ADT
d. to determine which ADT should be used
31. Which of the following is not a listed outcome of the exhaustive search strategy described in the text?
a. You go around in circles forever
b. It is impossible to reach a city because no flights go there
c. You eventually reach the destination city