engineering computer science MCQ #1236

What is the difference between a stack and a queue?

engineering computer science MCQ #1236

  1. Question 1

    Q1. What is the difference between a stack and a queue?

    • A) A stack is FIFO, while a queue is LIFO
    • B) A stack is LIFO, while a queue is FIFO
    • C) A stack is used for recursive algorithms, while a queue is used for iterative algorithms
    • D) A stack is used for dynamic memory allocation, while a queue is used for static memory allocation

    Answer: A stack is LIFO, while a queue is FIFO

    Explanation: A stack follows the Last-In-First-Out (LIFO) principle, while a queue follows the First-In-First-Out (FIFO) principle, making them suitable for different applications.