Difference between revisions of "2022 Paper 1 Revision Quiz"

From TRCCompSci - AQA Computer Science
Jump to: navigation, search
Line 23: Line 23:
  
 
{Look at this sample code:
 
{Look at this sample code:
<syntaxhighlight lang=c#>
+
 
public int Fact(int num)
+
public int Fact(int num)
{
+
{
 
   if (num == 0)
 
   if (num == 0)
 
       return 1;
 
       return 1;
Line 31: Line 31:
 
       return num * Fact(num-1);
 
       return num * Fact(num-1);
  
}
+
}
</syntaxhighlight>
+
 
 
|type="()"}
 
|type="()"}
 
</quiz>
 
</quiz>

Revision as of 10:18, 2 June 2022

1. In Recursion, the part of the code which runs itself is called?

General Case.
Correct
Base Case.
Incorrect
Repeating Case.
Incorrect
Recursive Case.
Incorrect

2. In Recursion, the condition which stops the recursive calls is called?

General Case.
Correct
Base Case.
Incorrect
Repeating Case.
Incorrect
Recursive Case.
Incorrect

3. Look at this sample code:

public int Fact(int num)
{
  if (num == 0)
      return 1;
  else
      return num * Fact(num-1);

Your score is 0 / 0