Pseudo-code · Question 3 · Easy
What will be the output of the following pseudocode? (Note: for-loop bounds are inclusive.)
Integer i, s
Set s = 0
for (i = 1 to 5)
s = s + i * i
end for
Print s
- 55
- 15
- 30
- 25
Answer and explanation
Answer: A. 55
Explanation: The loop adds the squares 1 + 4 + 9 + 16 + 25 = 55.
Previous: What will be the output of the following pseudocode? · Next: What will be the output of the following pseudocode? (Note: &, | and ^ are…
Practise pseudo-code
Try a fresh set of pseudo-code questions with an explanation after every answer, free and without signing up: Pseudo-code practice. Or sit a full placement mock test.
More pseudo-code questions
- What will be the output of the following pseudocode?
- What will be the output of the following pseudocode?
- What will be the output of the following pseudocode? (Note: &, | and ^ are…
- What will be the output of the following pseudocode? (Note: / denotes integer…
- What will be the output of the following pseudocode? (Note: &, | and ^ are…
- What will be the output of the following pseudocode? (Note: for-loop bounds…
- What will be the output of the following pseudocode?
- What will be the output of the following pseudocode?
- What will be the output of the following pseudocode? (Note: << and >> are…
- What will be the output of the following pseudocode? (Note: / denotes integer…
More technical & programming practice
C Programming · Java · Python · Data Structures · Algorithms · Object-Oriented Programming · DBMS · SQL
LogicWiz Exams home · All practice topics · Placement mock tests · Daily 10 challenge