Exam 14: Introduction to Collections and Stacks

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

Write a push method for a stack implemented with an array. You may assume that the stack is referenced by an array named stack, and that there is an integer variable named count that keeps track of the number of elements in the stack. You may not assume that you have access to an expandCapacity method (meaning that your method should include code to expand the capacity of the array if it is full).

(Essay)
4.9/5
(37)

It is possible to implement a stack and a queue in such a way that all operations take a constant amount of time.

(True/False)
4.7/5
(36)

A stack is a ___________________ data structure.

(Multiple Choice)
4.9/5
(35)

Which of the following methods removes an element from a queue?

(Multiple Choice)
4.9/5
(44)

Which of the following methods inserts an element into a stack data structure?

(Multiple Choice)
4.8/5
(39)

What is wrong with implementing a queue via an array where index 0 represents the front of the queue?

(Essay)
4.9/5
(31)

A postfix expression can be easily evaluated using a queue.

(True/False)
4.9/5
(38)

Suppose there were no count variable stored for the linked implementation of a queue. Would it still be possible to implement a constant time size operation? How about if there were no count variable stored for an array based implementation of a queue?

(Essay)
4.7/5
(41)

What exception is thrown if the pop method is called on an empty stack?

(Multiple Choice)
4.7/5
(32)

Which of the following is not a queue operation?

(Multiple Choice)
4.8/5
(42)

A queue is a FIFO structure.

(True/False)
4.8/5
(35)

Write out the order of elements that are contained in a stack after the following operations are performed. Write out the order of elements that are contained in a stack after the following operations are performed.

(Short Answer)
4.9/5
(32)

It is only possible to implement a queue using an array-based structure.

(True/False)
4.8/5
(35)

List the five basic operations on a stack.

(Short Answer)
4.7/5
(34)

Suppose the following sequence of elements are inserted into a stack and a queue in the following order: 50, 26, 32, 18, 26, 51. What is the result of three pop operations of the stack and three dequeue operations of the queue?

(Essay)
4.8/5
(37)

What is the fundamental difference between radix sort and the other sorting techniques that have been studies.

(Short Answer)
4.9/5
(35)

In an ideal implementations of a stack and a queue, all operations are ______________________ .

(Multiple Choice)
4.8/5
(36)

The peek operation on a stack returns a reference to the element at the bottom of the stack.

(True/False)
4.9/5
(34)

In a linked implementation of a stack, a pushed element should be added to the end of the list.

(True/False)
4.7/5
(34)

A stack is the ideal collection to use when _______________________ .

(Multiple Choice)
4.9/5
(38)
Showing 21 - 40 of 40
close modal

Filters

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