Gce Model Questions Vol1 2021 Computer Studies Question 15
Practice objective / multiple choice question 15 from the 2021 Gce Model Questions Vol1 Computer Studies examination.
Consider the following Python program intended to compute the sum \(S = 1! + 2! + \dots + n!\):\n\n```python\ndef fact(k):\n if k == 0:\n return 0\n else:\n return k * fact(k-1)\n\ndef series(n):\n total = 0\n for i in range(1, n+1):\n total += fact(i)\n return total\n\nn = int(input())\nprint(series(n))\n```\nThe program is run with input \(n = 5\). Identify the logical error, give the corrected version of the function \(fact\), and state the output produced after the correction.
Answer Options
About This Question
This is Gce Model Questions Vol1 2021 Computer Studies Question 15. 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.