1. Select all that apply : When is the queue empty? Front = -1 Back = -1 Front <
ID: 3727970 • Letter: 1
Question
1. Select all that apply: When is the queue empty?
Front = -1
Back = -1
Front <= Back
Front > Back
Front = Back
2. Each item in priority queue has a value denoting its ...
search key
address
relative priority
credit score
timestamp
3. Consider the implementation of a queue using a circular array. What goes wrong if we try to keep all the items at the front of a partially-filled array (so data[0] is always the front).
The insert function would require linear O(n) time.
The front function would require linear O(n) time.
The is_empty function would require linear O(n) time.
The constructor would require linear O(n) time.
segmentation fault
4. Which of the following statements is false?
Stacks and queues are called linear data structures.
Stacks and queues require just three methods each for adding, removing and peeking.
Stacks and queues force data to be added to and removed from particular ends of the data structure.
Stacks and queues include time stamps on data elements so that they know what was added when.
Questions about stacks and queues are common in computer science job interviews.
5. Minimum number of queues needed to implement the priority queue?
one
two
three
none
6. Let Q denote a queue containing sixteen numbers and S be an empty stack. Head(Q) returns the element at the head of the queue Q without removing it from Q. Similarly Top(S) returns the element at the top of S without removing it from S. Consider the algorithm given below.
The maximum possible number of iterations of the while loop in the algorithm is
1
16
32
64
256
7. The initial configuration of a queue is a, b, c, d, ('a' is in the front end). To get the configuration d, c, b, a, one needs a minimum of:
2 deletions and 3 additions
3 deletion and 2 additions
3 deletions and 3 additions
3 deletions and 4 additions
1 deletion and 2 additions
8.
Which queue operation does the above code perform?
enqueue
dequeue
reverse
append
Front = -1
Back = -1
Front <= Back
Front > Back
Front = Back
Explanation / Answer
1. a,b,d,e
2. c
Explanation:- Beacause every time we remove an element from front all the remaining elements should be shifted so that a[0] will be again the front
3. b
4. d
5. b
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.