QCM : Mastering Recursive Algorithms — 9 questions

Questions et réponses du QCM

1. Who is credited with formally proposing the recursive concept in mathematical logic and computing?

Alan Turing
Donald Knuth
Alonzo Church
Kurt Gödel

Alonzo Church

Explication

Alonzo Church is credited with formalizing the recursive concept through his development of lambda calculus, which provides a foundation for defining recursive functions in logic and computer science.

2. What is the explicit base case for the factorial function in its recursive definition?

The factorial of n is n times the factorial of n+1
The factorial of 0 is 1
The factorial of 1 is 1
The factorial of n is n times the factorial of n-1

The factorial of 0 is 1

Explication

The base case in the recursive definition of factorial is when n equals 0, where the factorial is explicitly defined as 1. This base case prevents infinite recursion and provides a stopping point for the recursive process.

3. What is a consequence of using indirect recursion instead of direct recursion in an algorithm?

It prevents the need for base cases in the recursive definition.
It creates a cycle of mutual function calls, complicating the call structure.
It simplifies the recursive process by reducing the number of function calls.
It guarantees faster execution due to multiple recursive calls.

It creates a cycle of mutual function calls, complicating the call structure.

Explication

Indirect recursion results in a cycle of mutual function calls, where functions call each other, forming a recursive cycle that affects the structure of the recursive process. This contrasts with direct recursion, where a function calls itself directly. The other options are incorrect because indirect recursion does not guarantee faster execution, does not eliminate the need for base cases, and does not simplify the recursive process; instead, it creates a more complex call cycle.

4. How does direct recursion differ from indirect recursion in their function call structures?

Direct recursion involves only one function calling itself, while indirect recursion involves multiple functions calling each other.
In direct recursion, a function calls itself only once per invocation, while in indirect recursion, functions can call each other multiple times.
In direct recursion, multiple functions call each other, while in indirect recursion, a single function calls itself.
In direct recursion, a function calls itself explicitly within its own definition, whereas in indirect recursion, functions call each other in a cycle.

In direct recursion, a function calls itself explicitly within its own definition, whereas in indirect recursion, functions call each other in a cycle.

Explication

Direct recursion involves a function explicitly calling itself within its own definition, making the self-reference clear and straightforward. Indirect recursion, on the other hand, involves a cycle of function calls between multiple functions, which call each other in a cycle. The options correctly distinguish these structures, with option 0 accurately describing the structural difference.

5. When was the concept of mutual recursion, exemplified by the definitions of even and odd numbers, formally established in the study of recursive functions?

In the early 19th century, during the development of formal logic and mathematics
In the 17th century, alongside the founding of calculus and early mathematics
In the late 20th century, with the rise of formal language theory and automata
In the mid-20th century, with the advent of computer science and recursive programming

In the early 19th century, during the development of formal logic and mathematics

Explication

The mutual recursion concept, exemplified by the definitions of even and odd numbers, was established in the early 19th century during the development of formal logic and mathematics, when foundational work on recursive functions and formal definitions of number properties was undertaken.

6. How does a recursive function manage its execution environment during each call?

It creates a new environment for each call, stored in a call stack.
It does not use any environment; variables are passed directly without management.
It shares a single environment among all calls, updating variables globally.
It overwrites the previous environment, replacing it entirely.

It creates a new environment for each call, stored in a call stack.

Explication

A recursive function manages its execution environment by creating a new environment for each call, which is stored in the call stack. This allows each recursive invocation to have its own set of variables and ensures correct execution flow, especially during unwinding after reaching the base case.

7. What is a key feature of base cases in recursive definitions?

They are optional conditions that may or may not be included.
They are the recursive steps that continue the process.
They are the explicit conditions that stop recursion.
They are the intermediate solutions used during recursion.

They are the explicit conditions that stop recursion.

Explication

Base cases are the explicit conditions in recursive definitions that stop the recursion process, preventing infinite loops and providing explicit solutions for the simplest instances of a problem.

8. What does the term 'Recursive Case Reduction' refer to in recursive algorithms?

The measure of how deep recursive calls go during execution
The process of transforming a complex problem into a simpler form to approach a base case
The method of defining base cases in recursive functions
The act of calling a recursive function within itself directly

The process of transforming a complex problem into a simpler form to approach a base case

Explication

Recursive Case Reduction involves transforming a complex problem into a simpler version to move closer to the base case, ensuring that recursion terminates. It is a fundamental step in recursive definitions and algorithms for problem-solving.

9. What is the primary role of a recursive algorithm in problem-solving?

To perform iterative loops more efficiently
To store data in a nested structure for future use
To break down complex problems into simpler subproblems via self-invocation
To call itself repeatedly without a stopping condition

To break down complex problems into simpler subproblems via self-invocation

Explication

The primary role of a recursive algorithm is to call itself in order to break down complex problems into simpler subproblems that can be solved more easily, ultimately reducing to base cases for a solution.

Révisez avec les flashcards

Mémorisez les réponses avec 18 flashcards sur Mastering Recursive Algorithms.

Recursivity — definition?

Self-reference in processes or objects.

Recursive process — role?

Involves a function calling itself during execution.

Recursive object — function?

An object containing or defined by itself.

Voir les flashcards →

Approfondir avec la fiche

Consultez la fiche de révision complète sur Mastering Recursive Algorithms.

Voir la fiche →

Cours similaires

Crée tes propres QCM

Importe ton cours et l'IA génère des QCM avec corrections en 30 secondes.

Générateur de QCM