Prepare for the A Level Computer Science OCR Exam with comprehensive quizzes that cover essential topics, flashcards, and detailed explanations to help you excel. Ace your exam with confidence!

Each practice test/flash card set has 50 randomly selected questions from a bank of over 500. You'll get a new set of questions each time!

Practice this question and more.


What operation does a stack support?

  1. Only push operations

  2. Push and pop operations

  3. Only pop operations

  4. Both enqueue and dequeue operations

The correct answer is: Push and pop operations

A stack is a data structure that follows the Last In, First Out (LIFO) principle, meaning that the last element added to the stack is the first one to be removed. The primary operations that a stack supports are push and pop. The push operation allows an element to be added to the top of the stack, while the pop operation removes the top element from the stack. This pair of operations enables stacks to maintain their structured order, making them suitable for various applications such as function call management, expression evaluation, and backtracking algorithms. In summary, stacks facilitate the addition and removal of elements in a specific order through push and pop operations, which are vital for their functionality and usability in computing tasks.