City Guilds Model Questions Vol1 2018 Information Technology Question 38

Practice objective / multiple choice question 38 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 38 CITY_GUILDS_MODEL_QUESTIONS_VOL1 • 2018 • INFORMATION_TECHNOLOGY • objective

Consider the following pseudo‑code: ``` function f(n): if n <= 1: return 1 total = 0 for i from 1 to n: for j from 1 to i: if (i*j) mod 2 == 0: total = total + i return total ``` (a) What value does the function return when called with \(n = 5\)? (b) State the asymptotic time‑complexity of the function in Θ‑notation as a function of \(n\).

Answer Options

Correct Answer A. 33; Θ(n^2)
B. 28; Θ(n log n)
C. 30; Θ(n^2)
D. 35; Θ(n^3)
Correct Answer
A
Correct Option:
33; Θ(n^2)

About This Question

This is City Guilds Model Questions Vol1 2018 Information Technology Question 38. 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