Question 41
MediumWhat will be printed by the following pseudocode?
Integer a = 7, b = 3
a += b
b *= a
a -= b / 5
Print a, b
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 printed by the following pseudocode?
Integer a = 7, b = 3
a += b
b *= a
a -= b / 5
Print a, b
3 30
10 30
4 21
4 30
Sign up free to see the answer and a step-by-step explanation.
What does the following pseudocode print?
Integer x = -17
Print x / 5, x mod 5
-4 -2
-4 3
-3 2
-3 -2
Sign up free to see the answer and a step-by-step explanation.
What will be the output of the following pseudocode?
Integer a = 3, b = 4, c = 5
Print a < b and b < c, a < b and b > c, not (a == 3)
true false false
true true false
false false true
true false true
Sign up free to see the answer and a step-by-step explanation.
What will be the output of the following pseudocode?
Integer x = 10
x = x + x * x / x - x mod 3
Print x
1
19
10
20
Sign up free to see the answer and a step-by-step explanation.
What does the following pseudocode print?
Integer a = 1, b = 2, c = 3
a = b = c
Print a, b, c
3 3 3
1 2 3
2 3 3
3 2 3
Sign up free to see the answer and a step-by-step explanation.
What will be printed by the following pseudocode?
Integer n = 7
String r = (n mod 2 == 0) ? "even" : (n > 5 ? "big odd" : "small odd")
Print r
odd
big odd
even
small odd
Sign up free to see the answer and a step-by-step explanation.
What does the following pseudocode print?
Integer a = 8, b = 3
Print a / b * b + a mod b, a * 1.0 / b > 2
9 true
6 true
8 true
8 false
Sign up free to see the answer and a step-by-step explanation.
What is the output of this pseudocode?
Integer x = 5, y = 10
x = x + y
y = x - y
x = x - y
Print x, y
15 5
5 10
10 10
10 5
Sign up free to see the answer and a step-by-step explanation.
What will be printed by the following pseudocode?
Integer a = 2, b = 3
Print a ^ b, a * a * a
1 8
8 8
6 8
5 8
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, i
for (each i from 1 to 30)
if (i mod 2 == 0 and i mod 3 == 0 or i mod 5 == 0)
count = count + 1
end if
end for
Print count
5
9
11
10
Sign up free to see the answer and a step-by-step explanation.