A Level Computer Science OCR Test 2026 – 400 Free Practice Questions to Pass the Exam

Question: 1 / 400

Which programming concept is utilized to store temporary values during sub-routines?

Queues

Stacks

The concept of storing temporary values during sub-routines is best captured by using stacks. A stack is a data structure that follows the Last In, First Out (LIFO) principle, meaning that the last value added to the stack is the first one to be removed.

When a sub-routine is called, the current execution context, including local variables and return addresses, is pushed onto the stack. This allows the sub-routine to use these temporary values while it is running. Once the sub-routine completes its execution, the values can be popped off the stack, restoring the previous execution context and allowing the main program to continue from where it left off.

This mechanism is fundamental in programming languages that support recursion, as it efficiently keeps track of multiple calls to sub-routines without losing the context of previous calls. The stack also helps manage memory in a structured way, making it easier to allocate and deallocate space for temporary data.

While the other options—queues, paging, and arrays—are valid data structures, they do not operate on the same LIFO principle and are not specifically designed to manage temporary values related to sub-routine calls in the same way that stacks do.

Get further explanation with Examzify DeepDiveBeta

Paging

Arrays

Next Question

Report this question

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy