Gce Model Questions Vol1 2021 Computer Studies Question 47

Practice objective / multiple choice question 47 from the 2021 Gce Model Questions Vol1 Computer Studies examination.

Gce Model Questions Vol1 2021 Computer Studies Objective / Multiple Choice Hard Difficulty
Question 47 GCE_MODEL_QUESTIONS_VOL1 • 2021 • COMPUTER_STUDIES • objective

Consider the following Python function that uses a mutable default argument and memoisation: ```python def ways(n, memo={0:0, 1:1}): if n in memo: return memo[n] memo[n] = ways(n-1, memo) + ways(n-2, memo) return memo[n] ``` What value is returned by `ways(4)`? Explain the reasoning, noting any effect of the initial values in `memo`.

Answer Options

A. 2
B. 4
Correct Answer C. 3
D. 5
Correct Answer
C
Correct Option:
3

About This Question

This is Gce Model Questions Vol1 2021 Computer Studies Question 47. It is one of the objective questions from the 2021 Gce Model Questions Vol1 Computer Studies examination.

Difficulty level: Hard .

Master the Exam!

You've seen a preview, but there are thousands more questions plus AI tutor to break down complex solutions.

Unlock Full Access Available for Android & Windows
Chat with Support