Neco 2024 Computer Studies Question 18

Practice objective / multiple choice question 18 from the 2024 Neco Computer Studies examination.

Neco 2024 Computer Studies Objective / Multiple Choice Medium Difficulty
Question 18 NECO • 2024 • COMPUTER_STUDIES • objective

Consider the following pseudocode where \(n\) is a positive integer:\n\n``\ncount = 0\nfor i = 1 to n\n for j = i to n\n if (i + j) mod 3 = 0\n count = count + 1\n```\n\nFor \(n = 12\), what is the value of \(count\)? Also give a closed‑form expression for \(count\) as a function of \(n\).

Answer Options

A. 28; count = a(a+1)\/2 + b·c + 1 where a,b,c are the numbers of residues 0,1,2 modulo 3 respectively (see solution for piecewise formula).
Correct Answer B. 26; count = a(a+1)/2 + b·c where a,b,c are the numbers of residues 0,1,2 modulo 3 respectively (see solution for piecewise formula).
C. 30; count = a·b + c·(c+1)\/2 where a,b,c are the numbers of residues 0,1,2 modulo 3 respectively (see solution for piecewise formula).
D. 24; count = a(a-1)\/2 + b·c where a,b,c are the numbers of residues 0,1,2 modulo 3 respectively (see solution for piecewise formula).
Correct Answer
B
Correct Option:
26; count = a(a+1)/2 + b·c where a,b,c are the numbers of residues 0,1,2 modulo 3 respectively (see solution for piecewise formula).

About This Question

This is Neco 2024 Computer Studies Question 18. It is one of the objective questions from the 2024 Neco 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