Page 58 - Data Structures Interactive Book
P. 58
6.8 Exercise
Essay Questions
1. Implement a queue using arrays and demonstrate enqueue, dequeue, and peek
operations.
2. Write a program to implement a circular queue and show how it reuses memory.
3. Create a queue using linked lists and demonstrate insertion and deletion.
4. Explain how queues are used in breadth-first search with an example program.
5. Implement a priority queue in C++ and demonstrate how elements are processed
based on priority.
6. Discuss the limitations of queues and suggest scenarios where they are most
effective.
Multiple Choice Questions (MCQ)
Q1. What is the main characteristic of a queue?
a) Last-In First-Out (LIFO) b) First-In First-Out (FIFO)
c) Random access of elements d) Elements stored only in linked lists
Q2. Which of the following operations are associated with queues?
a) Push and Pop b) Enqueue and Dequeue
c) Insert and Delete only d) Peek and Pop
Q3. What is the time complexity of enqueue and dequeue operations in a queue?
a) ( ) b) ( ) c) ( ) d) ( )
Q4. What is the key feature of a circular queue?
a) The last element points to NULL
b) The last element connects back to the first element
c) It cannot be traversed
d) It uses less memory than arrays
Q5. Which of the following is a common application of queues in computer science?
a) Expression evaluation b) Breadth-First Search (BFS)
c) Round-robin scheduling d) Both b and c
58

