Ch 19
A __________ stack or queue is built around the linked list. a. dynamic b. static c. deque-based d. floating-point e. None of these
A
A dynamic queue can be implemented as a a. dynamic linked list b. fixed-length array c. fixed-length circular array d. All of these e. None of these
A
A dynamic stack has a __________ size and is implemented as a(n) __________. a. variable, linked list b. fixed, linked list c. variable, array d. fixed, array e. None of these
A
Select all that apply. The queue data structure is commonly applied in connection with a. managing the order of print jobs b. communications software c. operating systems d. None of these
A,B,C
Select all that apply. Data structures that can dynamically store elements and can grow and shrink in size are a. stacks b. arrays c. queues d. deques
A,C,D
Select all that apply. The Standard Template Library offers a stack template that may be implemented as a(n) a. vector b. primary type c. linked list d. deque
A,C,D
A dynamic stack may be implemented as a(n) __________ and can expand or shrink with each push or pop operation. a. array b. structure c. linked list d. Either A or B e. None of these
C
A queue is a data structure that stores and retrieves item in the __________ manner. a. last in, first out b. first in, last out c. first in, first out d. random e. None of these
B
When an element is added to a queue, it is added to the rear. When an element is removed from the queue, it is removed from the a. rear b. middle c. front d. depends on how the programmer writes the code e. None of these
C
A stack that is implemented as a linked list is known as a deque.
F
A dynamic stack starts as an empty linked list.
T
The STL provides containers for deque and queue.
T
A __________ queue is more intuitive and easier to understand than a __________ queue. a. static, dynamic b. dynamic, static c. deque-like, stack-like d. stack-like, deque-like e. None of these
B
The programmer must declare in advance the size of a dynamic stack or queue.
F
In a static stack class, the constructor function can dynamically allocate memory for the stack array.
T
A real-world example of the queue data structure can be seen in a stack of cafeteria trays where the last tray pushed onto the stack is the first tray removed.
F
A stack can be adapted to store __________ data types. a. all b. only built-in C++ c. only abstract d. deque-like e. None of these
A
A stack queue can be implemented as a a. circular array b. stack c. dynamic linked list d. dynamic vector e. None of these
A
Given the following code, assume the myQueue object is a queue that can hold integers and that value is an int variable. 1 myQueue.enqueue(0); 2 myQueue.enqueue(1); 3 myQueue.enqueue(2); 4 myQueue.dequeue(value); 5 cout << value << endl; Assume that the dequeue function, called on line 4, stores the number removed from the queue in the value variable. What will the statement on line 5 display? a. 0 b. 1 c. 2 d. None of these
A
Given the following code, assume the myStack object is a stack that can hold integers and that value is an int variable. 1 myStack.push(0); 2 myStack.push(1); 3 myStack.push(2); 4 myStack.pop(value); 5 myStack.pop(value); 6 myStack.pop(value); 7 cout << value << endl; Assume that the pop function, called on lines 4, 5, and 6, stores the number popped from the stack in the value variable. What will the statement on line 7 display? a. 0 b. 1 c. 2 d. None of these
A
What does the following statement indicate? stack< int, vector<int> > iStack; a. a new stack of integers, implemented as a vector b. a new stack of integers, implemented as a deque c. a new stack named vector, implemented as integers d. a new vector named stack, implemented with integers e. None of these
A
Select all that apply. A practical application of the stack data type in a computer system is a. storage of local variables b. tracking nested loops c. tracking nested function calls d. None of these
A,B,C
Given the following code, assume the myQueue object is a queue that can hold integers and that value is an int variable. 1 myQueue.enqueue(0); 2 myQueue.enqueue(1); 3 myQueue.enqueue(2); 4 myQueue.dequeue(value); 5 myQueue.enqueue(3); 6 myQueue.dequeue(value); 7 cout << value << endl; Assume that the dequeue function, called on lines 4 and 6, stores the number removed from the queue in the value variable. What will the statement on line 7 display? a. 0 b. 1 c. 2 d. 3 e. None of these
B
If data is transmitted faster than it can be processed, it can be held in a __________ for processing. a. stack b. queue c. static array d. static deque e. None of these
B
In a dequeue operation, the element at the __________ of the queue is removed. a. middle b. front c. declaration d. rear e. None of these
B
Stacks are useful data structures for algorithms that work __________ with the __________ saved element in the series. a. last, first b. first, last c. efficiently, first d. efficiently, last e. None of these
B
The __________ operation allows an item to be removed from the stack. a. push b. pop c. delete d. remove e. None of these
B
The two primary stack operations are a. push and pull b. push and pop c. insert and delete d. append and delete e. None of these
B
Two primary queue operations are a. push and pop b. enqueue and dequeue c. insert and delete d. onqueue and offqueue e. None of these
B
A __________ is processed in a manner similar to customers standing in a grocery store check- out line where the first customer in line is the first to be served. a. stack b. vector c. queue d. All of these e. None of these
C
A container that provides quick access to elements at the front and the back of the list is a a. stack b. queue c. deque d. All of these e. None of these
C
A(n) __________ is an abstract data type that stores and retrieves items in a last-in-first-out manner. a. array b. queue c. stack d. vector e. None of these
C
Given the following code, assume the myQueue object is a queue that can hold integers and that value is an int variable. 1 myQueue.enqueue(0); 2 myQueue.enqueue(1); 3 myQueue.enqueue(2); 4 myQueue.dequeue(value); 5 myQueue.dequeue(value); 6 myQueue.dequeue(value); 7 cout << value << endl; Assume that the dequeue function, called on lines 4, 5, and 6, stores the number removed from the queue in the value variable. What will the statement on line 7 display? a. 0 b. 1 c. 2 d. None of these
C
Given the following code, assume the myStack object is a stack that can hold integers and that value is an int variable. 1 myStack.push(0); 2 myStack.push(1); 3 myStack.push(2); 4 myStack.pop(value); 5 cout << value << endl; Assume that the pop function, called on line 4, stores the number popped from the stack in the value variable. What will the statement on line 5 display? a. 0 b. 1 c. 2 d. None of these
C
Queues that are implemented as arrays are called __________ queues. a. dynamic b. stack c. static d. deque e. None of these
C
Static stacks have a __________ size and are implemented as __________. a. fixed, linked lists b. variable, arrays c. fixed, arrays d. variable, linked lists e. None of these
C
Given the following code, assume the myStack object is a stack that can hold integers and that value is an int variable. 1 myStack.push(0); 2 myStack.push(1); 3 myStack.push(2); 4 myStack.pop(value); 5 myStack.push(3); 6 myStack.pop(value); 7 cout << value << endl; Assume that the pop function, called on lines 4 and 6, stores the number popped from the stack in the value variable. What will the statement on line 7 display? a. 0 b. 1 c. 2 d. 3 e. None of these
D
The __________ operation allows an item to be stored on a stack. a. append b. add c. pop d. push e. None of these
D
Which of the following is a double-ended queue? a. two-headed stack b. two-tailed vector c. circular array d. deque e. None of these
D
For a compiler that is older than C++11 it is necessary to put spaces between the angled brackets that appear next to each other when defining a stack.
F
The two most common queue operations are endeque and deque.
F
The two most common queue operations are push and pop.
F
When the program knows the exact contents of a list and can access any element on demand, the data structure is known as a stacked deque.
F
Computer systems use stacks. For example, when a function is called, they create local variables on a stack which are removed from the stack when the function terminates.
T
Stacks and queues can be implemented as arrays or linked lists.
T
The first item placed onto a stack is always the last item removed from the stack.
T
The pop function in the stack template of the STL does not retrieve the value from the top of the stack; it merely removes it.
T