hamburger menu
All Coursesall course arrow
adda247
reward-icon
adda247
    arrow
    arrow
    arrow
    Which of the following statements is TRUE with respect to differences between stacks and queues?
    Question

    Which of the following statements is TRUE with respect to differences between stacks and queues?

    A.

    Queues use two ends of the structure but stacks use only one.

    B.

    Queues require linked lists but stacks do not.

    C.

    Stacks use two ends of the structure but queues use only one.

    D.

    Stacks require linked lists but queues do not.

    Correct option is A

    A stack is LIFO: both push and pop occur at the top—a single logical end.
    A queue is FIFO: enqueue occurs at the rear and dequeue at the front, thus using two ends.
    Both can be implemented with arrays or linked lists; neither data structure inherently “requires” a specific underlying storage.
    Operation costs are O(1) when implemented properly (e.g., maintaining head/tail pointers).
    Circular queues avoid costly element shifting in array implementations.
    Therefore, only (a) captures the fundamental operational difference.
    Important Key Points

    1. Stack (LIFO): push, pop, peek at one end (top).
    2. Queue (FIFO): enqueue at rear, dequeue at front (two ends).
    3. Implementations: Arrays or linked lists work for both; choice affects resizing and memory overhead.
    4. Complexities: Amortized O(1) for dynamic arrays; strict O(1) for linked lists with proper pointers.
    5. Variants: Deque supports insert/remove at both ends; priority queue orders by key, not arrival time.
    6. Use cases: Stacks for recursion/undo; queues for scheduling/buffering/level-order traversal.

    Knowledge Booster

    • Why (b) is wrong: Queues don’t require linked lists; arrays/circular buffers are common.
    • Why (c) is wrong: Reverses the truth—stacks use one end; queues use two.
    • Why (d) is wrong: Neither structure requires a linked list; both have multiple valid implementations.

    Free Tests

    Free
    Must Attempt

    UP SI 2025 Full Mock Test : 01

    languageIcon English
    • pdpQsnIcon160 Questions
    • pdpsheetsIcon400 Marks
    • timerIcon120 Mins
    languageIcon English
    Free
    Must Attempt

    UP Police Constable Full Mock Test 01

    languageIcon English
    • pdpQsnIcon150 Questions
    • pdpsheetsIcon300 Marks
    • timerIcon120 Mins
    languageIcon English
    Free
    Must Attempt

    Government Policies and Scheme

    languageIcon English
    • pdpQsnIcon10 Questions
    • pdpsheetsIcon20 Marks
    • timerIcon5 Mins
    languageIcon English
    test-prime-package

    Access ‘UPSSSC’ Mock Tests with

    • 60000+ Mocks and Previous Year Papers
    • Unlimited Re-Attempts
    • Personalised Report Card
    • 500% Refund on Final Selection
    • Largest Community
    students-icon
    354k+ students have already unlocked exclusive benefits with Test Prime!
    Our Plans
    Monthsup-arrow