Chapter 13

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

An event list contains all future arrival events and what else? a. departure events b. event loops c. clock time d. externally generated events

A

25. What ADT would be used along with a queue to determine if a string is a palindrome? a. list b. sorted list c. stack d. priority queue

C

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 be let go. This is an example of which ADT? a. bag b. list c. stack d. queue

C

A priority queue orders its items by ______. a. position b. value c. priority value d. size

C

According to the text, the first step in simulating a system is to do what? a. write a computer program b. time events with a stopwatch c. construct a mathematical model d. hire a lawyer

C

For a stack, the push method places a new item onto the stack. What method for the queue would do a similar task? a. dequeue b. isEmpty c. enqueue d. peek

C

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)? a. 2, 3, 5 b. 5, 3, 2 c. 4, 6 d. 6, 4

A

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? a. queue b. stack c. list d. sorted list

A

Which ADT would be best use to model the customers at a bakery who take numbers to mark their turn? a. queue b. stack c. list d. bag

A

Which of the following are not position-oriented ADTs? a. bag b. stack c. list d. queue

A

Which of the following characterizes a queue? a. FIFO b. LIFO c. FILO d. LILO

A

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? a. Sid b. Sal c. Sue d. Sam

B

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? a. 4 b. 15 c. 19 d. none of these

B

Which of the following characterizes a stack? a. FIFO b. LIFO c. FILO d. LILO

B

Which of the following is not a similarity between a stack and a queue as described by the text? a. both have an isEmpty method b. both can retrieve an item from any position c. both can insert an entry at one end of the structure d. both can retrieve an entry from one end of the structure

B

Which of the following tasks would be a good application of the ADT Queue? a. generating random numbers for a game b. reading a string of characters c. keeping a grocery list d. parsing a mathematical expression such as (9 + 5) * 7^ 2

B

Which of the following would be an example of a value-oriented ADT? a. bag b. priority queue c. list d. stack

B

You are writing a simple word processor. What ADT would be best to use which would allow the typist to correct typing errors by using the Backspace key. a. queue b. stack c. list d. sorted list

B

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)? a. Bob, Bill, Bud b. Bob, Bud, Boo c. Bill, Bud, Boo d. Boo, Bud, Bill

C

In an event driven simulation, how is simulated time advanced? a. by a single time unit b. by a stop watch c. advanced to the time of the next event d. by a calendar

C

Which of the following ADT Queue operators does not have return type specified as bool? a. isEmpty b. dequeue c. peekFront d. enqueue

C

Which of the following is not an ADT Queue operation as presented by the author? a. test if queue is empty b. add new entry to back of queue c. add new entry to front of queue d. get entry that was added earliest to the queue

C

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? a. Stack. b. tree. c. Linked list d. Queue.

D

Which of the following ADT Queue operators has a parameter? a. isEmpty b. dequeue c. peekFront d. enqueue

D

An algorithm performing simulation of an oft repeated cycle, measuring the times and generating statistics is called what? a. customer loop b. timing loop c. statistical loop d. event loop

D

For a queue, the dequeue removes the first item. What method for the stack is used to remove the appropriate item? a. peek b. poke c. enqueue d. pop

D

The first item to be removed from a priority queue is the item ______. a. at the front of the priority queue b. at the end the priority queue c. with the highest value d. with the highest priority value

D

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

D

You wish to model who gets to land first as airplanes arrive at a busy airport. What kind of simulation would this be? a. time-driven simulation b. customer-driven simulation c. a sorted list d. event-driven simulation

D


Set pelajaran terkait

Missed Retirement Planning Questions

View Set

MORT 234 CHAPTER 9.1 Legal Reasoning

View Set

Biology - Evolution, Reproduction, and Adaptation

View Set

CRMA- Certification in Risk Management Assurance Part 1 of 2

View Set

2.3 Managing a Socially Responsible Business

View Set

C213 Topic 8: Internal Controls: Ensuring the Integrity of Financial Information

View Set

IT Project Management Exam 3 Review Ch 7-8

View Set