City Guilds Model Questions Vol1 2017 Information Technology Question 39
Practice objective / multiple choice question 39 from the 2017 City Guilds Model Questions Vol1 Information Technology examination.
Consider the following pseudo‑code:\n\n``\ninteger n = input positive integer\ninteger count = 0\nfor i = 1 to n do\n for j = i to n do\n if (i + j) mod 3 = 0 then\n count = count + 1\n end if\n end for\nend for\noutput count\n```\n\n(a) What is the output when \(n = 6\)?\n(b) Derive a formula for \(count\) as a function of \(n\).\n(c) State the time‑complexity of the algorithm in Big‑O notation.\n(d) Propose an algorithm that computes the same \(count\) in \(O(n)\) time.
Answer Options
About This Question
This is City Guilds Model Questions Vol1 2017 Information Technology Question 39. It is one of the objective questions from the 2017 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.