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.

City Guilds Model Questions Vol1 2018 Information Technology Objective / Multiple Choice Hard Difficulty
Question 5 CITY_GUILDS_MODEL_QUESTIONS_VOL1 • 2018 • INFORMATION_TECHNOLOGY • objective

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

A. 24
B. 18
C. 20
Correct Answer D. 22
Correct Answer
D
Correct Option:
22

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.

Unlock Full Access Available for Android & Windows
Chat with Support