Difference between revisions of "2022 Paper 1 Revision Quiz"
Line 44: | Line 44: | ||
||Correct | ||Correct | ||
+ | {Look at this sample code: | ||
+ | |||
+ | <nowiki> | ||
+ | 1: public int Fact(int num) | ||
+ | 2: { | ||
+ | 3: if (num == 0) | ||
+ | 4: return 1; | ||
+ | 5: else | ||
+ | 6: return num * Fact(num-1); | ||
+ | 7: }</nowiki> | ||
+ | |||
+ | Which of these lines are the Base Case? | ||
+ | |type="()"} | ||
+ | -3 | ||
+ | ||Almost, this is the condition which causes the base case | ||
+ | +4 | ||
+ | ||Correct | ||
+ | -5 | ||
+ | ||Incorrect | ||
+ | -6 | ||
+ | ||Incorrect | ||
</quiz> | </quiz> |