Elementary Data Structures – stacks, queues, dequeue Quiz - ICSE Class 11 Computer Science
Free practice quiz: Elementary Data Structures – stacks, queues, dequeue (ICSE Class 11 Computer Science). 56 multiple-choice questions with answers and explanations. Play online, no sign-up needed.
This ICSE Class 11 Computer Science practice quiz has 56 multiple-choice questions on Elementary Data Structures – stacks, queues, dequeue, and 56 of them come with an explanation. Try the 5 sample questions below (tap an option to check yourself), then play the full quiz online. No sign-up needed.
Start quiz: 56 questions, freeSample questions
Consider a stack where elements are pushed and popped. If elements 1, 2, 3, 4, and 5 are pushed in that order, what will be the order of elements when popped?
Show answer
Answer: B. 5, 4, 3, 2, 1
A stack follows the Last-In, First-Out (LIFO) principle. The last element pushed (5) is the first one to be popped.
In a queue, which end is used for deletion?
Show answer
Answer: A. Front end
Queues follow the First-In, First-Out (FIFO) principle. Elements are deleted from the front (where the oldest element is) and inserted at the rear.
What is the purpose of the `peek` operation in a queue?
Show answer
Answer: C. To view the element at the front without removing it.
Similar to a stack's peek, a queue's peek operation allows inspection of the front element (the next to be dequeued) without altering the queue's state.
Consider the expression `(a + b) * (c - d)`. If this is converted to postfix notation, which operator will appear last?
Show answer
Answer: B. *
The expression is `(a + b) * (c - d)`. In postfix notation, this becomes `a b + c d - *`. The operators are processed based on precedence and parentheses. The outermost operation is the multiplication between the results of `(a + b)` and `(c - d)`. Therefore, '*' is the last operator to be evaluated and appears last in the postfix string.
Consider the following operations on a deque: `push_front(1)`, `push_back(2)`, `push_front(3)`, `pop_front()`. What is the final state of the deque from front to rear?
Show answer
Answer: B. 1, 2
Initial: [] `push_front(1)`: [1] `push_back(2)`: [1, 2] `push_front(3)`: [3, 1, 2] `pop_front()`: Removes 3. Deque: [1, 2] The final state from front to rear is [1, 2].
More questions in this quiz
Answers and explanations are in the full quiz.
- Which of the following operations is NOT typically associated with a stack?
- A queue is implemented using an array. If the front of the queue is at index 3 and the rear is at index 7, and the array size is 10, what is the size of the queue?
- Which data structure is most suitable for implementing a breadth-first search (BFS) algorithm?
- A deque (double-ended queue) allows insertion and deletion from both ends. If elements A, B, C, D are inserted into an empty deque, with A inserted at the front, then B at the rear, C at the front, and D at the rear. What is the state of the deque from front to rear?
- In a circular queue implemented with an array of size N, if front = k and rear = (k + m) % N, what is the current number of elements in the queue?
- Consider an empty stack. What is the result of performing a pop operation on it?
- Which data structure is often used to manage function call contexts (i.e., return addresses and local variables)?
- If a queue contains elements [10, 20, 30, 40] from front to rear, and we perform a dequeue operation followed by two enqueue operations (50 and 60), what will be the new state of the queue from front to rear?
- What is the primary difference between a stack and a queue in terms of element access?
- A stack is used to reverse a string. If the input string is 'HELLO', what will be the string after the reversal?
- Which of the following operations on a deque returns the element at the front without removing it?
- If you have a stack with elements [A, B, C] (bottom to top) and you perform `pop()`, `push('D')`, `pop()`, what is the final top element?
- What is the time complexity of pushing an element onto a stack implemented using a dynamic array (like ArrayList in Java or vector in C++)?
- Consider a queue implemented using a linked list. If we want to add an element to the rear, which pointer do we need to manipulate?
- A postfix expression is evaluated using a stack. For the expression `5 2 + 3 *`, what is the final result?
- What is the primary benefit of using a deque over a standard queue or stack in certain scenarios?
- Consider a circular queue with a capacity of 5. If `front` is at index 0 and `rear` is at index 4, what is the next position for `rear` after an `enqueue` operation?
- Which data structure is ideal for managing a history of actions where the most recent action is the first one to be undone?
- If a deque is implemented using a doubly linked list, what is the time complexity for `insert_front()` and `delete_rear()` operations?
- Consider a stack implemented using an array. If the stack is full, and we attempt to push another element, what will occur?
- A deque can be used to implement a palindrome checker. If the string is 'racecar', which of the following operations would confirm it's a palindrome?
- Consider an abstract data type (ADT) with operations `add_item(item)` and `remove_item()`. If `add_item` adds to the end and `remove_item` removes from the beginning, which ADT is being implemented?
- Which of the following is a common application of a stack?
- In a queue implemented using an array with wrap-around, if `front = 2`, `rear = 4`, and `capacity = 7`, what is the number of elements?
- What is the condition for stack overflow when using a fixed-size array implementation?
- Which of the following operations is NOT typically supported by a standard queue?
- When converting an infix expression like `a + b * c` to postfix using a stack, which operator would be pushed onto the stack first?
- Which data structure is most efficient for finding the smallest element among a collection of elements that are dynamically changing?
- What is the condition for stack underflow when using a linked list implementation?
- If a queue uses two stacks, `in_stack` and `out_stack`, to implement its operations, which stack is used for `enqueue` operations?
- Which operation on a deque would be most appropriate to add an element to the beginning of the structure?
- What is the condition for stack underflow when using an array implementation with `top` pointing to the last inserted element?
- Consider a circular queue. If `front` is at index 3 and `rear` is at index 1 (with capacity 5), what is the number of elements?
- If you are evaluating an arithmetic expression in infix notation using two stacks (one for operands, one for operators), when do you pop an operator from the operator stack?
- Which of the following is NOT a valid operation for a deque?
- What is the primary difference in conceptual behavior between a stack and a queue?
- Consider a queue of capacity 3. If elements 1, 2, 3 are enqueued, followed by dequeuing one element and then enqueuing 4. What is the state of the queue?
- In a deque, what is the time complexity for `pop_front()` and `push_back()` when implemented using a doubly linked list?
- If a stack is implemented as a linked list, what must be true for the `peek` operation to be valid?
- What is the primary reason for using a circular queue instead of a linear queue implemented with an array?
- Which operation is used to insert an element at the end of a queue?
- What is the time complexity of `pop()` on a stack implemented using a singly linked list, assuming `head` points to the top element?
- If a deque is represented by the array `[5, 10, 15, 20]` with `front = 0` and `rear = 3`, what would be the state of the deque after `pop_front()` and `push_back(25)`?
- Which of the following correctly describes the operation of a queue?
- What is the primary disadvantage of implementing a stack using a linked list when compared to an array?
- Consider a circular queue of capacity N. If `front = (rear + 1) % N`, what does this condition indicate?
- If `push_front(A)`, `push_back(B)`, `push_front(C)` are performed on an empty deque, what is the state of the deque from front to rear?
- What is the time complexity for accessing the k-th element in a stack implemented using an array?
- Consider an empty queue. If you perform `enqueue(X)`, `enqueue(Y)`, `dequeue()`, `enqueue(Z)`. What is the order of elements when dequeued subsequently?
- Which of the following data structures is most analogous to a row of people waiting in a line?
- If a stack is implemented using a dynamic array, what is the worst-case time complexity for a `push` operation?
More quizzes
- Numbers – Number systems, base conversion, arithmetic in bases▶ Play
- Packages – user-defined packages, imports, interaction▶ Play
- Propositional Logic – WFF, truth tables, logic gates, adder circuits▶ Play
- Software – System vs application software, OS overview▶ Play
- Computer Hardware – System architecture, processor, memory types▶ Play
Browse all Computer Science quizzes