Gce Model Questions Vol1 2020 Computer Studies Question 43

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

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

The following Python function is intended to sum the differences between the larger and the smaller number for every unordered pair of distinct odd elements in a list that are coprime and whose product exceeds 200:\n\n```python\ndef mystery(lst):\n total = 0\n for i in range(len(lst)):\n for j in range(i+1, len(lst)):\n a, b = lst[i], lst[j]\n if a % 2 == 1 and b % 2 == 1: # both odd\n # check coprime\n def gcd(x, y):\n while y:\n x, y = y, x % y\n return x\n if gcd(a, b) == 1 and a*b > 200:\n total += max(a, b) - min(a, b)\n return total\n```\n\nWhat value does `mystery([9, 10, 14, 15, 22, 25])` return?

Answer Options

A. 18
B. 14
C. 20
Correct Answer D. 16
Correct Answer
D
Correct Option:
16

About This Question

This is Gce Model Questions Vol1 2020 Computer Studies Question 43. It is one of the objective questions from the 2020 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