Any2Quiz
Quizzes / ICSE / Class 11 / Computer Science

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, free

Sample questions

  1. 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.

  2. 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.

  3. 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.

  4. 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.

  5. 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].

Take the full quiz

More questions in this quiz

Answers and explanations are in the full quiz.

  1. Which of the following operations is NOT typically associated with a stack?
  2. 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?
  3. Which data structure is most suitable for implementing a breadth-first search (BFS) algorithm?
  4. 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?
  5. 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?
  6. Consider an empty stack. What is the result of performing a pop operation on it?
  7. Which data structure is often used to manage function call contexts (i.e., return addresses and local variables)?
  8. 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?
  9. What is the primary difference between a stack and a queue in terms of element access?
  10. A stack is used to reverse a string. If the input string is 'HELLO', what will be the string after the reversal?
  11. Which of the following operations on a deque returns the element at the front without removing it?
  12. 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?
  13. 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++)?
  14. 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?
  15. A postfix expression is evaluated using a stack. For the expression `5 2 + 3 *`, what is the final result?
  16. What is the primary benefit of using a deque over a standard queue or stack in certain scenarios?
  17. 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?
  18. Which data structure is ideal for managing a history of actions where the most recent action is the first one to be undone?
  19. If a deque is implemented using a doubly linked list, what is the time complexity for `insert_front()` and `delete_rear()` operations?
  20. Consider a stack implemented using an array. If the stack is full, and we attempt to push another element, what will occur?
  21. 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?
  22. 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?
  23. Which of the following is a common application of a stack?
  24. In a queue implemented using an array with wrap-around, if `front = 2`, `rear = 4`, and `capacity = 7`, what is the number of elements?
  25. What is the condition for stack overflow when using a fixed-size array implementation?
  26. Which of the following operations is NOT typically supported by a standard queue?
  27. When converting an infix expression like `a + b * c` to postfix using a stack, which operator would be pushed onto the stack first?
  28. Which data structure is most efficient for finding the smallest element among a collection of elements that are dynamically changing?
  29. What is the condition for stack underflow when using a linked list implementation?
  30. If a queue uses two stacks, `in_stack` and `out_stack`, to implement its operations, which stack is used for `enqueue` operations?
  31. Which operation on a deque would be most appropriate to add an element to the beginning of the structure?
  32. What is the condition for stack underflow when using an array implementation with `top` pointing to the last inserted element?
  33. 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?
  34. 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?
  35. Which of the following is NOT a valid operation for a deque?
  36. What is the primary difference in conceptual behavior between a stack and a queue?
  37. 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?
  38. In a deque, what is the time complexity for `pop_front()` and `push_back()` when implemented using a doubly linked list?
  39. If a stack is implemented as a linked list, what must be true for the `peek` operation to be valid?
  40. What is the primary reason for using a circular queue instead of a linear queue implemented with an array?
  41. Which operation is used to insert an element at the end of a queue?
  42. What is the time complexity of `pop()` on a stack implemented using a singly linked list, assuming `head` points to the top element?
  43. 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)`?
  44. Which of the following correctly describes the operation of a queue?
  45. What is the primary disadvantage of implementing a stack using a linked list when compared to an array?
  46. Consider a circular queue of capacity N. If `front = (rear + 1) % N`, what does this condition indicate?
  47. 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?
  48. What is the time complexity for accessing the k-th element in a stack implemented using an array?
  49. Consider an empty queue. If you perform `enqueue(X)`, `enqueue(Y)`, `dequeue()`, `enqueue(Z)`. What is the order of elements when dequeued subsequently?
  50. Which of the following data structures is most analogous to a row of people waiting in a line?
  51. If a stack is implemented using a dynamic array, what is the worst-case time complexity for a `push` operation?

More quizzes

Browse all Computer Science quizzes

More to play

Daily ChallengeA new quiz every day. Keep your streak.HangmanGuess the word, letter by letter.Story QuestLearn through short interactive stories.All quizzesCBSE, ICSE, competitive exams and more.