This section contains carefully selected MCQs and Previous Year Questions with explanations to help students understand concepts and prepare effectively for examinations, interviews, and competitive tests.
Q: 1A normal queue, if implemented using an array of size N, gets full when ________.
Option C
In a normal or linear queue implemented using an array of size N, the queue becomes full when the value of REAR reaches the last index of the array, that is N−1.
Q: 2After performing following set of operations, what does the final list look contain?
InsertFront(10);
InsertFront(20);
InsertRear(30);
DeleteFront();
InsertRear(40);
InsertRear(10);
DeleteRear();
InsertRear(15);
Display();
Option C
These operations are performed on a double-ended queue (deque) or a list that allows insertion and deletion at both front and rear.
Now apply the operations one by one and show the list after each step:
So, the final list is 10 30 40 15.
Q: 3Which statement is true about condition of overflow in the circular queue?
I. FRONT = 1 AND REAR = N
II. FRONT = REAR+1
Option C
A Circular Queue is a linear data structure in which the last position is connected back to the first position. This allows better memory utilization compared to a simple queue.
Overflow condition occurs when no more elements can be inserted into the circular queue. For a circular queue of size N, overflow occurs in two situations:
When FRONT = 1 and REAR = N
When FRONT = REAR + 1
| CONDITION | MEANING |
|---|---|
| FRONT=1 AND REAR=N | Queue completely filled linearly. |
| FRONT=REAR+1 | Queue full in circular arrangement. |
Q: 4If circular queue is implemented using array having size MAX_SIZE in which array index start with 0, front points to the first element in the queue, and rear points to the last element in the queue. Which one of the following conditions is used to specify that the circular queue is empty?
Option A
In a circular queue implemented using an array, the queue is considered empty when there are no elements stored in it. The most common and standard way to represent an empty circular queue is if front=rear=-1.
When the circular queue is first created, it contains no elements. To show this, both front and rear are initialized to -1. As soon as we insert the first element both front and rear becomes 0. When all elements are deleted again, we reset them to -1 to show the queue is empty.
Q: 5Consider the following sequence of operations on an empty stack.
push(54); push(52); pop(); push(55); push(62); s=pop();
Consider the following sequence of operations on an empty queue.
enqueue(21); enqueue(24); dequeue(); enqueue(28); enqueue(32); q=dequeue();
The value of s+q is _______.
Option B
First, consider the stack operations (LIFO). The stack is initially empty. After push(54) and push(52), the stack becomes [54, 52]. The pop() operation removes 52. Then push(55) and push(62) make the stack [54, 55, 62]. Finally, s=pop() removes the top element 62, so s=62.
Next, consider the queue operations (FIFO). The queue is initially empty. After enqueue(21) and enqueue(24), the queue becomes [21, 24]. The dequeue() operation removes 21. Then enqueue(28) and enqueue(32) make the queue [24, 28, 32]. Finally, q = dequeue() removes 24, so q=24.
Therefore, s+q = 62+24 = 86
Q: 6The minimum number of stacks needed to implement a queue is:
Option A
A queue follows the FIFO (First In First Out) principle, whereas a stack follows the LIFO (Last In First Out) principle.
To implement a queue using stacks, we need two stacks. One stack is used for enqueue operations, and the other stack is used for dequeue operations.
By transferring elements between the two stacks, the order of elements is reversed, which helps achieve FIFO behavior.
Q: 7The five items: A, B, C, D, and E are pushed in a stack, one after other starting from A. The stack is popped four items and each element is inserted in a queue. The two elements are deleted from the queue and pushed back on the stack. Now one item is popped from the stack. The popped item is _____.
Option B
First, the elements A, B, C, D, E are pushed onto the stack in this order. Since a stack follows LIFO, after all pushes the stack (Top → Bottom) becomes: E, D, C, B, A.
| Operation | Stack Status (Top → Bottom) | Queue |
|---|---|---|
| Push A | A | — |
| Push B | B, A | — |
| Push C | C, B, A | — |
| Push D | D, C, B, A | — |
| Push E | E, D, C, B, A | — |
Now, four elements are popped from the stack and inserted into a queue.
| Operation | Stack Status (Top → Bottom) | Queue Status (Front → Rear) |
|---|---|---|
| Pop E → Enqueue | D, C, B, A | E |
| Pop D → Enqueue | C, B, A | E, D |
| Pop C → Enqueue | B, A | E, D, C |
| Pop B → Enqueue | A | E, D, C, B |
Next, two elements are deleted from the queue and pushed back on the stack.
| Operation | Stack Status (Top → Bottom) | Queue Status (Front → Rear) |
|---|---|---|
| Dequeue E → Push | E, A | D, C, B |
| Dequeue D → Push | D, E, A | C, B |
Finally, one item is popped from the stack, which removes the top element D.
| Operation | Stack Status (Top → Bottom) | Popped Item |
|---|---|---|
| Pop | E, A | D |
Q: 8The data structure in which data are added at the rear and deleted from front is called
Option B
A data structure in which elements are inserted at the rear and deleted from the front follows the FIFO (First In, First Out) principle. This is exactly how a queue works. In a queue, new data always enters from the rear (back or end), and the oldest data is removed from the front.
Q: 9A linear list in which elements can be added or removed at either end but not in the middle, is called ___________.
Option C
A Dequeue stands for Double Ended Queue. It is a linear data structure where:
In priority queue, elements are inserted in any order but removed based on priority, not position.
The threaded binary tree is type of binary tree optimized for in-order traversal, not a linear list.
The linked list allows insertions and deletions at any position, including the middle.
Q: 10What is another name for the circular queue among the following options?
Option C
In a normal Queue, we can insert elements until queue becomes full. But once queue becomes full, we cannot insert the next element even if there is a space in front of queue.
A Circular Queue is a type of queue in which the last position is connected back to the first position, forming a circle. This allows efficient use of memory by reusing empty spaces when elements are deleted.
Another common name for a circular queue is a Ring Buffer, because conceptually the storage forms a ring where the front and rear wrap around.
If we want to insert new element in circular queue using REAR end, then the value of REAR can be calculated as: REAR=(REAR+1)%CAPACITY
Similarly, when we want to delete existing element from the circular queue using FRONT end, then the value of FRONT can be calculated as: FRONT=(FRONT+1)%CAPACITY
Q: 11A queue has configuration a, b, c, d. if you want to get the configuration d, c, b, a, you need a minimum of ___________.
Option B
To reverse a queue from configuration [a, b, c, d] to [d, c, b, a] using only queue operations, the minimum required is 3 deletions and 3 additions.
| STEP | OPERATION | DEQUEUED ELEMENT | ENQUEUED ELEMENT | QUEUE STATUS |
|---|---|---|---|---|
| Initially | — | — | — | [a,b,c,d] |
| 1 | Dequeue | a | — | [b,c,d] |
| 2 | Dequeue | b | — | [c,d] |
| 3 | Dequeue | c | — | [d] |
| 4 | Enqueue | — | c | [d,c] |
| 5 | Enqueue | — | b | [d,c,b] |
| 6 | Enqueue | — | a | [d,c,b,a] |
Q: 12A data structure in which elements can be inserted or deleted at/from both ends but not in the middle is?
Option B
A Deque (Double-Ended Queue) is a data structure in which elements can be inserted and deleted at both ends, the front as well as the rear but not in the middle.
Q: 13A linear list of elements in which deletion can be done from one end and insertion can take place only at the other end is known as:
Option B
A queue is a linear data structure in which insertion of elements is performed at one end called rear end and deletion of elements is performed from the other end called front end. This behavior follows the FIFO (First In, First Out) principle.
Q: 14Queue data structure uses
Option A
A queue is a linear data structure that manages elements in a specific order, like people waiting in line at a ticket counter, the first to arrive is served first. A queue follows the FIFO (First In, First Out) principle.
Q: 15What is the another name for the circular queue among the following options?
Option C
A Circular Queue is also commonly known as a Ring Buffer. It is a data structure that connects the last position back to the first, forming a circle, which allows efficient reuse of buffer space.
Same as queue the circular queue data structure follows the FIFO (First In, First Out) principle and is widely used in scenarios where fixed size buffer management is needed.
The circular queue is empty (underflow) when front == -1 and full (overflow) when (rear + 1) % capacity == front.
Thank you so much for taking the time to read my Computer Science MCQs section carefully. Your support and interest mean a lot, and I truly appreciate you being part of this journey. Stay connected for more insights and updates! If you'd like to explore more tutorials and insights, check out my YouTube channel.
Don’t forget to subscribe and stay connected for future updates.