Prepare for the A Level Computer Science OCR Exam with engaging quizzes, detailed explanations, and effective study tips. Maximize your readiness and boost your confidence for exam day!

Practice this question and more.


What is recursion in programming?

  1. A repetitive loop structure

  2. A method that breaks problems into smaller parts

  3. A function calling itself

  4. A type of array structure

The correct answer is: A function calling itself

Recursion in programming is characterized primarily by a function that calls itself. This self-referential function performs a specific task by breaking a problem down into smaller, more manageable instances of the same problem. Each recursive call works toward a base case that stops the recursion and begins the unraveling of those calls. For instance, when calculating factorial numbers or traversing data structures like trees or graphs, recursion is often implemented as it simplifies complex problems by allowing the programmer to describe the solution in terms of smaller instances of the same problem. While breaking problems into smaller parts is a characteristic of recursion, the definitive aspect is the function's self-invocation—making "a function calling itself" the most precise definition of recursion within programming contexts.