Gce Model Questions Vol1 2018 Computer Studies Question 4

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

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

The following Python function is intended to return the sum of the first \(N\) odd numbers, but it contains an error. ```python def sum_odds(N): total = 0 i = 1 count = 0 while count <= N: total += i i += 2 count += 1 return total ``` Identify the error and state the correct output of `sum_odds(7)` after fixing the code.

Answer Options

A. 56
B. 42
Correct Answer C. 49
D. 64
Correct Answer
C
Correct Option:
49

About This Question

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