📢 Too many exams? Don’t know which one suits you best? Book Your Free Expert 👉 call Now!


    Question

    Which of the following scenarios is best suited for

    implementation using a stack data structure?
    A Managing print jobs in a printer queue. Correct Answer Incorrect Answer
    B Implementing the "undo" functionality in a text editor. Correct Answer Incorrect Answer
    C Storing a history of visited web pages for a "back" button. Correct Answer Incorrect Answer
    D Processing tasks in a round-robin CPU scheduling algorithm. Correct Answer Incorrect Answer
    E Storing data packets in a network router for transmission. Correct Answer Incorrect Answer

    Solution

    Stacks follow the Last-In, First-Out (LIFO) principle. The "undo" functionality requires reversing the most recent action first, which perfectly aligns with LIFO.

    Practice Next
    ask-question