Chapter 13 questions Data Structures

¡Supera tus tareas y exámenes ahora con Quizwiz!

Given two initially empty queues, queue1 and queue2 and the following commands. queue1.enqueue(1) queue1.enqueue(2) queue2.enqueue(3) queue1.enqueue(4) queue1.dequeue() queueFront = queue1.peekFront() queue1.enqueue(queueFront) queue2.enqueue(5) queue1.dequeue() queue2.enqueue(7) What is the sum of the contents of queue2?

15

Given the following queue operations on an empty existing queue called nameQueue. nameQueue.enqueue(Bob) nameQueue.enqueue(Bill) nameQueue.enqueue(Bud) nameQueue.dequeue() nameQueue.enqueue(Boo) What is now the contents of the queue (with front of the queue listed leftmost)?

Bill,Bud,Boo

Given the following queue operations on an empty existing queue called nameQueue. nameQueue.enqueue(Sid) nameQueue.enqueue(Sal) nameQueue.enqueue(Sue) nameQueue.enqueue(Sam) nameQueue.dequeue() display (nameQueue.peekFront()) What name is displayed?

Sal

Which of the following is not an ADT Queue operation as presented by the author?

add new entry to front of queue

In an event driven simulation, how is simulated time advanced?

advanced to the time of the next event

Which of the following are not position-oriented ADTs?

bag

Which of the following is not a similarity between a stack and a queue as described by the text?

both can retrieve an item from any position

According to the text, the first steep in simulating a system is to do what?

construct a mathematical model

An event list contains all future arrival events and what else?

departure events

For a stack, he push method places a new item onto the stack. What method for the queue would do a similar task?

enqueue

Which of the following ADT Queue operators has a parameter?

enqueue

An algorithm performing simulation of and oft repeated cycle, measuring the times and generating statistics is called what?

event loop

You wish to model who gets to land first as airplanes arrives at a busy airport. What kind of simulation would this be?

event-driven simulation

Which of the following ADT Queue operators do not have return type specified as bool?

peekFront

For a queue, the dequeue removes the first item. What method for the stack is used to remove the appropriate item?

pop

Which of the following would be an example of a value-oriented ADT?

priority queue

You are making a "to do" list for this week. You brainstorm all the things which need your attention, the you arrange them from most important to least. You have just used what kind of ADT?

priority queue

A priority queue orders its items by ______

priority value

Lining up to buy a movie ticket or being put on hold by a computerized phone system are both examples of what type of ADT

queue

Which ADT would be best use to model the customers at a bakery who take numbers to mark their turn?

queue

Which of the following tasks would be a good application of the ADT Queue?

reading a string of characters

A large corporation is facing financial troubles and finds that they must do a reduction in force(RIF). The people who were most recently hired must bet let go. This is an example of which ADT

stack

What ADT would be used along with a queue to determine if a string is a palindrome?

stack

You are writing a simple word processor. What ADT would best to use which would allow the typist to correct typing errors by using the Backspace key

stack

The first item to be removed from a priority queue is the item ______.

with the highest priority value

Given two initially empty queues, queue1 and queue2 and the following commands. queue1.enqueue(1) queue1.enqueue(2) queue2.enqueue(3) queue2.enqueue(4) queue1.dequeue() queueFront = queue2.peekFront() queue1.enqueue(queueFront) queue1.enqueue(5) queue2.dequeue() queue2.enqueue(6) What are now the contents of What is now the contents of queue1 (with front of the queue listed leftmost)?

2,3,5

Which of the following characterizes a queue?

FIFO

Which of the following characterizes a stack?

LIFO

Which data structure represents a waiting line and limits insertions to be made at the back of the data structure and limits removals to be made from the front?

Queue


Conjuntos de estudio relacionados

Chapter 14 Stress, Lifestyle, and Health Quiz

View Set

Chapter 29: The Child With Cancer

View Set

MKTG 310 Exam 2 Chapter 10 - Motivation, Personality, and Emotion

View Set

Chapter 40 - Corporate Directors, Officers, & Shareholders (Final Exam)

View Set

Chapter 1- Application, Underwriting, and Delivering Policy

View Set

ACSR 6 - Causes of Loss and Coverage Forms

View Set

History of Microbiology- Exam #1

View Set

9.9: Smooth muscle is nonstriated involuntary muscle

View Set

Anatomy Unit 4: Practice Questions

View Set