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.
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
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.