Any2Quiz
ICSE / 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.

Play all 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?

    1. 1, 2, 3, 4, 5
    2. 5, 4, 3, 2, 1
    3. 1, 5, 2, 4, 3
    4. 5, 1, 4, 2, 3
    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?

    1. Front end
    2. Rear end
    3. Both ends
    4. Middle
    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?

    1. To remove the element from the front.
    2. To add an element to the rear.
    3. To view the element at the front without removing it.
    4. To check if the queue is empty.
    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?

    1. +
    2. *
    3. -
    4. d
    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?

    1. 3, 1, 2
    2. 1, 2
    3. 3, 2
    4. 1, 3, 2
    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 quizzes

Browse all Computer Science quizzes