City Guilds Model Questions Vol1 2018 Information Technology Question 5
Practice objective / multiple choice question 5 from the 2018 City Guilds Model Questions Vol1 Information Technology examination.
The following algorithm counts pairs of distinct elements whose sum is divisible by 3:\n\n``` count = 0 for i = 1 to n‑1 for j = i+1 to n if (A[i] + A[j]) mod 3 = 0 count = count + 1 ```\nAssume the array A contains the first n positive integers, where n is a multiple of 3.\n\n(a) Derive a formula for count in terms of n.\n(b) Using your formula, find count when n = 12.
Answer Options
About This Question
This is City Guilds Model Questions Vol1 2018 Information Technology Question 5. It is one of the objective questions from the 2018 City Guilds Model Questions Vol1 Information Technology 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.