Exam 21: Stacks and Queues

arrow
  • Select Tags
search iconSearch Question
flashcardsStudy Flashcards
  • Select Tags

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 testing whether the stack is empty is

(Multiple Choice)
4.9/5
(39)

A stream of cars going through a toll booth is an example of a

(Multiple Choice)
4.8/5
(43)

Consider a class that uses the following variables to implement an array-based stack: String [ ] s = new String[100]; Int top = 0; The boolean method to check for an empty stack can be written as:

(Multiple Choice)
4.9/5
(45)

A queue invariant is a condition

(Multiple Choice)
4.9/5
(35)

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 pop()operation can be written as

(Multiple Choice)
4.8/5
(40)

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 void push(String x)operation can be written as

(Multiple Choice)
4.8/5
(33)

In a list implementation of a queue,the end of the list at which elements are added is called

(Multiple Choice)
5.0/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 operation void push(String x)can be written as

(Multiple Choice)
4.7/5
(28)

In a queue implementation that uses an array of fixed size,

(Multiple Choice)
4.7/5
(35)

Which of the following operations is not a stack operation?

(Multiple Choice)
4.8/5
(44)

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?

(Multiple Choice)
4.9/5
(36)

The stack push operation

(Multiple Choice)
4.8/5
(37)

The stack class provided by the Java Collections Framework

(Multiple Choice)
4.7/5
(38)

The operation for adding an item to a queue is called

(Multiple Choice)
4.9/5
(31)

The stack empty operation

(Multiple Choice)
4.9/5
(32)

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

(Multiple Choice)
4.8/5
(33)
Showing 21 - 36 of 36
close modal

Filters

  • Essay(0)
  • Multiple Choice(0)
  • Short Answer(0)
  • True False(0)
  • Matching(0)