City Guilds Model Questions Vol1 2023 Information Technology Question 7

Practice objective / multiple choice question 7 from the 2023 City Guilds Model Questions Vol1 Information Technology examination.

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

Consider the following pseudo‑code where (N = 30\): ``` int sum = 0; for (int i = 2; i <= N; i++) { // test primality of i bool isPrime = true; for (int d = 2; d*d <= i; d++) { if (i % d == 0) { isPrime = false; break; } } if (isPrime) { // compute digit sum of i int temp = i, digitSum = 0; while (temp > 0) { digitSum += temp % 10; temp /= 10; } if (digitSum % 3 == 0) { sum += i; } } } print(sum); ``` What integer value is printed?

Answer Options

Correct Answer A. 3
B. 9
C. 6
D. 0
Correct Answer
A
Correct Option:
3

About This Question

This is City Guilds Model Questions Vol1 2023 Information Technology Question 7. It is one of the objective questions from the 2023 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