CSC 345 Section 5.13

Ace your homework & exams now with Quizwiz!

If the characters 'D', 'C', 'B', 'A' are placed in a queue (in that order), and then removed one at a time, in what order will they be removed? DCBA ABDC DCAB ABCD

DCBA

It is an error to dequeue data from a(n) _______ queue. Array-based Linked Full Empty

Empty

It is an error to dequeue data from a(n) _______ queue. Full Array-based Linked Empty

Empty

It is an error to pop data from a(n) _______ stack. Full Empty Linked Initialized Array-based

Empty

Stack A has entries a, b, c (in that order with a on top), while Stack B is initially empty. When an entry is popped out of stack A, it can be printed immediately or pushed to stack B. When an entry is popped out of stack B, it can only be printed. Which of the following permutations of a, b, c is not possible to print? a b c b a c c a b b c a

c a b

The following sequence of operations is performed on a queue: enqueue(1), enqueue(2), dequeue, enqueue(1), enqueue(2), dequeue, dequeue, dequeue, enqueue(2), dequeue. The values will be output in this order: 1,2,1,1,2 2,1,2,2,1 2,2,1,1,2 2,2,1,2,2 1,2,1,2,2 2,1,2,2,2

1,2,1,2,2

The following sequence of operations is performed on a stack: push(1), push(2), pop, push(1), push(2), pop, pop, pop, push(2), pop. The values will be output in this order: 2,1,2,2,2 2,1,2,2,1 2,2,1,2,2 1,2,1,2,2 1,2,2,1,2 2,2,1,1,2

2,2,1,1,2

If the characters 'D', 'C', 'B', 'A' are placed in a stack (in that order), and then removed one at a time, in what order will they be removed? DCAB ABCD DCBA ABDC

ABCD

In the linked implementation of a queue, a new item would be added: After all other entries that are greater than the new entry At the current position After all other entries that are smaller than the new entry At the rear At the head

At the rear

Queue behavior is typically referred to as: Just-in-Time First-In, First-Out Last-In, First-Out First Come, First Served

First-In, First-Out

It is an error to enqueue data onto a(n) _______ queue. Empty Array-based Linked Full Initialized

Full

One difference between a queue and a stack is: Stacks require linked lists, but queues do not Queues require linked lists, but stacks do not Stacks use two ends of the structure, queues use only one Queues use two ends of the structure; stacks use only one

Queues use two ends of the structure; stacks use only one

In the linked implementation of a queue, a new item would be added to the: None of these Current position Front Rear

Rear

Which value of a queue is accessible? The bottom item The root The rear item The lowest-valued item The highest-valued item The top item The front item

The front item

Which value of a stack is accessible? The top item The root The front item The lowest-valued item The highest-valued item The bottom item The rear item

The top item


Related study sets

Cold War/ Decolonization Questions

View Set

Identifying web 2.0 technologies

View Set

Chapter 25 - Suicide and Nonsuicidal Self-Injury

View Set

AP GOVERNMENT CHAPTER 12: BUREAUCRACY

View Set

6c) Human Growth and Development chapter 6 questions

View Set

DECA Hospitality and Tourism Cluster Study Set

View Set