Question 11
EasyWhat will be the output of the following pseudocode?
Integer p = 1
for (each i from 1 to 5)
p = p * i
end for
Print p
- A.
120
- B.
720
- C.
15
- D.
24
Sign up free to see the answer and a step-by-step explanation.
Popular companies
Prepare company by company
Hiring pattern, syllabus, past questions and mocks for each company.
All companiesPractice by subject
Pseudocode and Output Prediction
What will be the output of the following pseudocode?
Integer p = 1
for (each i from 1 to 5)
p = p * i
end for
Print p
120
720
15
24
Sign up free to see the answer and a step-by-step explanation.
What will be the output of the following pseudocode?
Integer x = 1
repeat 5 times
x = x * 2
end repeat
Print x
32
16
64
10
Sign up free to see the answer and a step-by-step explanation.
What will be printed by the following pseudocode?
Integer i = 10
while (i > 0)
i = i - 3
end while
Print i
0
-1
1
-2
Sign up free to see the answer and a step-by-step explanation.
What will be the output of the following pseudocode?
Integer count = 0
for (each i from 1 to 3)
for (each j from 1 to i)
count = count + 1
end for
end for
Print count
3
9
4
6
Sign up free to see the answer and a step-by-step explanation.
What does the following pseudocode print?
Integer n = 123, r = 0
while (n > 0)
r = r * 10 + n mod 10
n = n / 10
end while
Print r
0
6
123
321
Sign up free to see the answer and a step-by-step explanation.
What is the output of this pseudocode?
Integer n = 9045, s = 0
while (n > 0)
s = s + n mod 10
n = n / 10
end while
Print s
13
9045
9
18
Sign up free to see the answer and a step-by-step explanation.
What will be printed by the following pseudocode?
Integer s = 0
for (each i from 1 to 20 step 4)
s = s + i
end for
Print s
50
45
210
40
Sign up free to see the answer and a step-by-step explanation.
What will be printed by the following pseudocode?
Integer a = 0, b = 1, c
repeat 6 times
c = a + b
a = b
b = c
end repeat
Print b
21
8
6
13
Sign up free to see the answer and a step-by-step explanation.
What will be the output of the following pseudocode?
Integer i
for (each i from 1 to 10)
if (i * i > 30)
break
end if
end for
Print i
5
6
31
10
Sign up free to see the answer and a step-by-step explanation.
What will be the output of the following pseudocode?
Integer s = 0
for (each i from 1 to 6)
if (i mod 3 == 0)
continue
end if
s = s + i
end for
Print s
9
15
21
12
Sign up free to see the answer and a step-by-step explanation.