From Problem Analysis to
Program Design 5th Edition By
D. S. Malik (All Chapters 1-19,
100% Original Verified, A+
Grade)
All Chapters Arranged Reverse: 19-1
This is The Only Original and
Complete Test Bank for 5 th
Edition, All Other Files in the
Market are Fake/Old/Wrong
Edition.
,Chapter 19: Stacks and Queues
TRUE/FALSE
1. A stack is a First In First Out data structure.
ANS: F PTS: 1 REF: 1117
2. The operation used to add elements to a stack is called pop.
ANS: F PTS: 1 REF: 1117
3. The top operation is performed to remove the element from the top of a stack.
ANS: F PTS: 1 REF: 1117
4. The elements at the bottom of the stack have been in the stack the longest.
ANS: T PTS: 1 REF: 1117
5. The bottom element of the stack is the last element added to the stack.
ANS: F PTS: 1 REF: 1117
6. A stack can only be implemented as a list.
ANS: F PTS: 1 REF: 1120
7. A stack is a random access data structure.
ANS: F PTS: 1 REF: 1120
8. Because the class stackType has a pointer data member, you must overload the assignment operator
and include the copy constructor and destructor.
ANS: T PTS: 1 REF: 1120
9. The initializeStack operation initializes the stack to an empty state.
ANS: T PTS: 1 REF: 1120
10. In the array representation of a stack, the stack is initialized simply by setting stackTop to 0.
ANS: T PTS: 1 REF: 1123-1124
11. In the array representation of a stack, an unlimited number of elements can be pushed onto the stack.
ANS: F PTS: 1 REF: 1126
12. In the array representation of a stack, if a value called stackTop indicates the number of elements in
the stack, then stackTop-1 points to the top item of the stack.
, ANS: T PTS: 1 REF: 1126
13. If you try to add a new item to a full stack, the resulting condition is called an outflow.
ANS: F PTS: 1 REF: 1126
14. In the linked implementation of stacks, the stack is full only if you run out of memory space.
ANS: T PTS: 1 REF: 1140
15. In the linked implementation of stacks, the memory to store the stack elements is allocated statically.
ANS: F PTS: 1 REF: 1140
16. The default constructor for the linked implementation of a stack initializes the stack to an empty state
when a stack object is declared.
ANS: T PTS: 1 REF: 1141
17. In postfix notation, operators are written after the operands.
ANS: T PTS: 1 REF: 1151
18. Postfix notation requires the use of parentheses to enforce operator precedence.
ANS: F PTS: 1 REF: 1151
19. The infix expression
(a + b) * (c - d / e) + f
is equivalent to the postfix expression
ab + cde /-* f +
ANS: T PTS: 1 REF: 1152
20. The expression a + b is the same in both infix notation and postfix notation.
ANS: F PTS: 1 REF: 1152
21. All queue elements must be of the same type.
ANS: T PTS: 1 REF: 1165
22. A queue is a First In First Out data structure.
ANS: T PTS: 1 REF: 1166
23. A queue can only be implemented as a linked list.
ANS: F PTS: 1 REF: 1168
24. In a circular array, the first array position immediately follows the last array position.
, ANS: T PTS: 1 REF: 1170
25. If the queue is empty, the operation back terminates the program.
ANS: T PTS: 1 REF: 1173
26. Only a finite number of queue elements can be stored in an array.
ANS: T PTS: 1 REF: 1177
27. One of the most widely used applications of queues is computer simulation.
ANS: T PTS: 1 REF: 1183-1184
MULTIPLE CHOICE
1. A(n) ____ is a list of homogenous elements in which the addition and deletion of elements occurs only
at one end.
a. stack c. array
b. queue d. linked list
ANS: A PTS: 1 REF: 1116
2. The addition and deletion of elements of the stack occurs only at the ____ of the stack.
a. head c. top
b. bottom d. middle
ANS: C PTS: 1 REF: 1116
3. The ____ element of the stack is the last element added to the stack.
a. top c. head
b. bottom d. tail
ANS: A PTS: 1 REF: 1117
4. A stack is a(n) ____ data structure.
a. FIFO c. LIFO
b. FILO d. LILO
ANS: C PTS: 1 REF: 1117
5. You can perform the add operation, called ____, to add an element onto the stack.
a. pop c. enqueue
b. push d. dequeue
ANS: B PTS: 1 REF: 1117
6. You can perform the operation ____ to remove the top element from the stack.
a. dequeue c. pop
b. top d. push
ANS: C PTS: 1 REF: 1117
7. A stack can be implemented as either a(n) ____ or a linked structure.