Gce Model Questions Vol1 2020 Computer Studies Question 42

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

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

Consider the following pseudocode:\n\n``\ncount = 0\nfor i = 1 to n\n for j = i to n\n if (i + j) mod 3 = 0 then\n count = count + 1\n```\n\nExpress the final value of `count` as a function of \(n\).

Answer Options

Correct Answer A. count = \frac{c_0(c_0+1)}{2}+c_1c_2, where c_0 = \lfloor n/3 \rfloor, c_1 = \lfloor n/3 \rfloor + [n\bmod3 \ge 1], c_2 = \lfloor n/3 \rfloor + [n\bmod3 \ge 2]
B. count = \\frac{c_0(c_0+1)}{2}+c_1c_2, where c_0 = \\lceil n\/3 \\rceil, c_1 = \\lfloor n\/3 \\rfloor + [n\\bmod3 = 1], c_2 = \\lfloor n\/3 \\rfloor + [n\\bmod3 = 2]
C. count = \\frac{c_0(c_0+1)}{2}+c_1 + c_2, where c_0 = \\lfloor n\/3 \\rfloor, c_1 = \\lfloor n\/3 \\rfloor + [n\\bmod3 \\ge 1], c_2 = \\lfloor n\/3 \\rfloor + [n\\bmod3 \\ge 2]
D. count = \\frac{c_0(c_0-1)}{2}+c_1c_2, where c_0 = \\lfloor n\/3 \\rfloor, c_1 = \\lfloor n\/3 \\rfloor + [n\\bmod3 \\ge 1], c_2 = \\lfloor n\/3 \\rfloor + [n\\bmod3 \\ge 2]
Correct Answer
A
Correct Option:
count = \frac{c_0(c_0+1)}{2}+c_1c_2, where c_0 = \lfloor n/3 \rfloor, c_1 = \lfloor n/3 \rfloor + [n\bmod3 \ge 1], c_2 = \lfloor n/3 \rfloor + [n\bmod3 \ge 2]

About This Question

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

Difficulty level: Medium .

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