Exam 21: Stacks and Queues
Exam 1: Introduction to Computers and Java42 Questions
Exam 2: Java Fundamentals53 Questions
Exam 3: Decision Structures52 Questions
Exam 4: Loops and Files48 Questions
Exam 5: Methods50 Questions
Exam 6: A First Look at Classes49 Questions
Exam 7: A First Look at Gui Applications49 Questions
Exam 8: Arrays and the Arraylist Class52 Questions
Exam 9: A Second Look at Classes and Objects40 Questions
Exam 10: Text Processing and More About Wrapper Classes49 Questions
Exam 11: Inheritance49 Questions
Exam 12: Exceptions and Advanced File Io46 Questions
Exam 13: Advanced Gui Applications46 Questions
Exam 14: Applets and More39 Questions
Exam 15: Recursion34 Questions
Exam 16: Sorting, Searching, and Algorithm Analysis46 Questions
Exam 17: Generics50 Questions
Exam 18: Collections50 Questions
Exam 19: Array-Based Lists20 Questions
Exam 20: Linked Lists36 Questions
Exam 21: Stacks and Queues36 Questions
Exam 22: Binary Trees, Avl Trees, and Priority Queues45 Questions
Select questions type
A stack based on a linked list is based on the following code
Class Node{
String element;
Node next;
Node(String el,Node n){
Element = el;
Next = n;
}
}
Node top = null;
The code for implementing the String pop()operation is
Free
(Multiple Choice)
4.8/5
(40)
Correct Answer:
B
A queue based on a linked list uses the following code
Class Node{
String element;
Node next;
Node (String el,Node n){
Element = el;
Next = n;
}
}
Node front = null,rear = null;
What is the right code for String remove()operation? Such an operation removes and returns an element from the queue.
Free
(Multiple Choice)
4.8/5
(47)
Correct Answer:
D
In a list implementation of a queue,the end of the list from which elements are removed is called
Free
(Multiple Choice)
4.9/5
(38)
Correct Answer:
A
Consider a class that uses the following variables to implement an array-based stack:
String [ ] s = new String[100];
Int top = -1;// Note top == -1 indicates stack is empty
A method that implements a String pop()operation can be written as
(Multiple Choice)
4.8/5
(27)
A queue is a container that allows elements to be stored and removed
(Multiple Choice)
4.9/5
(38)
Consider a class that uses the following variables to implement an array-based stack:
String [ ] s = new String[100];
Int top = 0;
A method that implements the String peek()operation can be written as
(Multiple Choice)
4.9/5
(38)
Consider a class that uses the following variables to implement an array-based stack:
String [ ] s = new String[100];
Int top = 0;
A method for adding an item x to the stack can be written as
(Multiple Choice)
4.9/5
(35)
In an implementation of a stack based on a singly-linked list,it is most efficient to add a new item so that
(Multiple Choice)
4.9/5
(27)
A queue based on a linked list uses the following code
Class Node{
String element;
Node next;
Node (String el,Node n){
Element = el;
Next = n;
}
}
Node front = null,rear = null;
What is the right code for the boolean empty()method?
(Multiple Choice)
5.0/5
(28)
In a list implementation of a stack,the end of the list at which elements are added and removed is called
(Multiple Choice)
4.9/5
(38)
Compilers of modern programming languages support method calls and returns with an internal
(Multiple Choice)
4.9/5
(36)
Consider a class that uses the following variables to implement an array-based stack:
String [ ] s = new String[100];
Int top = -1;// Note top == -1 indicates stack is empty
A method that implements a String peek()operation can be written as
(Multiple Choice)
4.9/5
(30)
In an array-based implementation of a stack,an operation that needs to add a new element to the stack may not be able to complete because the array is full.In this case,the failed operation should
(Multiple Choice)
4.8/5
(38)
The JCF Stack class is used to instantiate a stack:
Stack< Integer > intStack = new Stack< Integer >();
The statements
Int k = 77;
IntStack.push(k*k);
Use the primitive type int instead of the wrapper type Integer.These statements
(Multiple Choice)
4.9/5
(34)
A stack is a container that allows elements to be stored and removed
(Multiple Choice)
4.9/5
(39)
A stack based on a linked list is based on the following code
Class Node{
String element;
Node next;
Node(String el,Node n){
Element = el;
Next = n;
}
}
Node top = null;
The code for implementing the String peek()operation is
(Multiple Choice)
4.8/5
(46)
Showing 1 - 20 of 36
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)