Exam 18: Stacks and Queues
Exam 1: Introduction to Computers and Programming44 Questions
Exam 2: Introduction to C++56 Questions
Exam 3: Expressions and Interactivity44 Questions
Exam 4: Making Decisions53 Questions
Exam 5: Loops and Files62 Questions
Exam 6: Functions49 Questions
Exam 7: Arrays53 Questions
Exam 8: Searching and Sorting Arrays20 Questions
Exam 10: Characters, C++-Strings, and More About the String Class42 Questions
Exam 11: Structured Data43 Questions
Exam 11: Structured Data50 Questions
Exam 12: Advanced File Operations38 Questions
Exam 13: Introduction to Classes46 Questions
Exam 14: More About Classes40 Questions
Exam 15: Inheritance, Polymorphism, and Virtual Functions38 Questions
Exam 16: Exceptions, Templates, and the Standard Template Library STL39 Questions
Exam 17: Linked Lists40 Questions
Exam 18: Stacks and Queues46 Questions
Exam 19: Recursion21 Questions
Exam 20: Binary Trees38 Questions
Select questions type
In the following code, assume the myStack object is a stack that can hold integers, and that value is an int variable. (The lines are numbered for reference purposes.) 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 in lines 4, 5, and 6, stores the number popped from the stack in the value variable.
What will the statement in line 7 display?
Free
(Multiple Choice)
4.9/5
(41)
Correct Answer:
A
This is a container that provides quick access to elements at the front and the back of the list.
Free
(Multiple Choice)
4.8/5
(30)
Correct Answer:
C
In the following code, assume the myQueue object is a queue that can hold integers, and that value is an int variable. (The lines are numbered for reference purposes.) 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 in lines 4, 5, and 6, stores the number removed from the queue in the value variable.
What will the statement in line 7 display?
Free
(Multiple Choice)
4.8/5
(37)
Correct Answer:
C
In the following code, assume the myQueue object is a queue that can hold integers, and that value is an int variable. (The lines are numbered for reference purposes.)
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 in lines 4, and 6, stores the number removed from the queue in the value variable.
What will the statement in line 7 display?
(Multiple Choice)
5.0/5
(32)
A __________ stack or queue is built around the linked-list.
(Multiple Choice)
4.9/5
(31)
The programmer must declare in advance the size of a dynamic stack or queue.
(True/False)
5.0/5
(40)
In an dequeue operation, the element at the __________ of the queue is removed.
(Multiple Choice)
4.8/5
(39)
The first item placed onto a stack is always the last item removed from the stack.
(True/False)
4.9/5
(44)
Stacks are useful data structures for algorithms that work ___________ with the _________ saved element in the series.
(Multiple Choice)
4.8/5
(42)
The _______ operation allows an item to be stored on a stack.
(Multiple Choice)
4.9/5
(34)
When an element is added to a queue, it is added to the rear. When an element is removed, it is removed from the
(Multiple Choice)
4.9/5
(43)
A dynamic stack has a ___________ size, and is implemented as a(n) ________
(Multiple Choice)
4.9/5
(39)
A practical application of the stack data type in a computer system is:
(Multiple Choice)
4.8/5
(40)
A dynamic stack may be implemented as a(n) ___________, and expand or shrink with each push or pop operation.
(Multiple Choice)
4.8/5
(37)
A __________ is processed in a manner similar to customers standing in a grocery check-out line -- the first customer in line is the first served.
(Multiple Choice)
5.0/5
(41)
The queue data structure is commonly applied in connection with:
(Multiple Choice)
5.0/5
(43)
Showing 1 - 20 of 46
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)