Question 21
EasyWhat will be the output of the following pseudocode?
Integer count = 0
for (each i from 1 to 50)
if (i mod 7 == 0)
count = count + 1
end if
end for
Print count
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 count = 0
for (each i from 1 to 50)
if (i mod 7 == 0)
count = count + 1
end if
end for
Print count
7
50
8
6
Sign up free to see the answer and a step-by-step explanation.
What does the following pseudocode print?
Integer x = 5
do
x = x + 2
while (x < 4)
Print x
5
7
9
4
Sign up free to see the answer and a step-by-step explanation.
What will be printed by the following pseudocode?
Integer r = 1
for (each i from 1 to 4)
r = r * 3
end for
Print r
243
81
12
27
Sign up free to see the answer and a step-by-step explanation.
What is the output of this pseudocode?
Integer n = 47285, m = 0
while (n > 0)
if (n mod 10 > m)
m = n mod 10
end if
n = n / 10
end while
Print m
5
26
7
8
Sign up free to see the answer and a step-by-step explanation.
What will be the output of the following pseudocode?
Integer a = 48, b = 18
while (a != b)
if (a > b)
a = a - b
else
b = b - a
end if
end while
Print a
18
6
12
3
Sign up free to see the answer and a step-by-step explanation.
What does the following pseudocode print?
Integer n = 24680135, count = 0
while (n > 0)
if ((n mod 10) mod 2 == 0)
count = count + 1
end if
n = n / 10
end while
Print count
4
3
8
5
Sign up free to see the answer and a step-by-step explanation.
What will be printed by the following pseudocode?
Integer a = 0
for (each i from 1 to 5)
for (each j from 1 to 5)
if (i == j)
a = a + 1
end if
end for
end for
Print a
1
10
25
5
Sign up free to see the answer and a step-by-step explanation.
What will be the output of the following pseudocode?
Integer n = 1234, rev = 0
while (n > 0)
rev = rev * 10 + (n mod 10)
n = n / 10 // integer division
end while
Print rev
10
4321
1234
432
Sign up free to see the answer and a step-by-step explanation.
What will be the output of the following pseudocode?
Integer n = 9875, s = 0
while (n != 0)
s = s + (n mod 10)
n = n / 10 // integer division
end while
Print s
29
28
20
9875
Sign up free to see the answer and a step-by-step explanation.
What will be the output of the following pseudocode?
Integer a = 0, b = 1, t
for (each i from 1 to 6)
t = a + b
a = b
b = t
end for
Print a
13
5
21
8
Sign up free to see the answer and a step-by-step explanation.