The Priority Queue object implements a FIFO queue. It is well-suited for implementing operator consoles with read-eval-print loops, where the operator’s commands are serviced in priority order. Elements must implement equals() and hashCode(). This class does not allow null elements. These Priority Queue Questions And Answers will help you prepare for any exam including GATE, GRE, IES, PSC, UGC NET, DOEACC Exams at all levels – you just have to practice regularly.
Priority Queue Questions –Data Structure MCQs
1. With what data structure can a priority queue be implemented?
2. Which of the following is not an application of priority queue?
a) Huffman codes
b) Interrupt handling in operating system
c) Undo operation in text editors
d) Bayesian spam filter
Answer: Undo operation in text editors
3. What is the time complexity to insert a node based on key in a priority queue?
4. What is not a disadvantage of priority scheduling in operating systems?
a) A low priority process might have to wait indefinitely for the CPU
b) If the system crashes, the low priority systems may be lost permanently
c) Interrupt handling
d) Indefinite blocking
Answer: Interrupt handling
5. Which of the following is not an advantage of a priority queue?
a) Easy to implement
b) Processes with different priority can be efficiently handled
c) Applications with differing requirements
d) Easy to delete elements in any case
Answer: Easy to delete elements in any case
6. What is the time complexity to insert a node based on position in a priority queue?