Services
Discover
Homeschooling
Ask a Question
Log in
Sign up
Filters
Done
Question type:
Essay
Multiple Choice
Short Answer
True False
Matching
Topic
Computing
Study Set
Starting Out with Java
Quiz 21: Stacks and Queues
Path 4
Access For Free
Share
All types
Filters
Study Flashcards
Practice Exam
Learn
Question 21
Multiple Choice
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
Question 22
Multiple Choice
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
Question 23
Multiple Choice
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,rear; What is the right code for a constructor for such a linked list class?
Question 24
Multiple Choice
In a queue implementation that uses an array of fixed size,
Question 25
Multiple Choice
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 operation void push(String x) can be written as
Question 26
Multiple Choice
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
Question 27
Multiple Choice
In an implementation of a stack based on a singly-linked list,it is most efficient to add a new item so that
Question 28
Multiple Choice
The operation for removing an item from a queue is called
Question 29
Multiple Choice
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
Question 30
Multiple Choice
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 void add(String x) operation? Such an operation adds x to the queue
Question 31
Multiple Choice
A queue invariant is a condition
Question 32
Multiple Choice
The operation for adding an item to a queue is called
Question 33
Multiple Choice
Which of the following operations is not a stack operation?
Question 34
Multiple Choice
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?