Question 61
HardWhat will be the output of the following pseudocode?
Integer a = 5, b = 3, c = 2
Integer r = a + b * c - a / c mod b
Print r
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 a = 5, b = 3, c = 2
Integer r = a + b * c - a / c mod b
Print r
9
7
14
11
Sign up free to see the answer and a step-by-step explanation.
What will be printed by the following pseudocode?
Integer x = 10
x = x++ + x
Print x
11
22
21
20
Sign up free to see the answer and a step-by-step explanation.
What will be the output of the following pseudocode?
Integer x = 7, y = 2
Print x / y, x mod y, -x / y, -x mod y, x / -y
3.5 1 -3.5 -1 -3.5
3 1 -4 1 -4
3 1 -3 1 -3
3 1 -3 -1 -3
Sign up free to see the answer and a step-by-step explanation.
What will be printed by the following pseudocode?
Integer i = 1, s = 0
while (i <= 10)
s += i
i *= 2
end while
Print s, i
10 16
15 8
31 32
15 16
Sign up free to see the answer and a step-by-step explanation.
What will be printed by the following pseudocode?
Boolean a = true, b = false, c = true
Print a and b or c, a and (b or c), not a or b and c, (a or b) and not c
true false false true
false true false false
true true false false
true true true false
Sign up free to see the answer and a step-by-step explanation.
What will be printed by the following pseudocode?
Integer x = 5
Integer y = x > 3 ? x * 2 : x / 2
Integer z = (x mod 2 == 0) ? x : x + 1
Print y + z
15
12
16
11
Sign up free to see the answer and a step-by-step explanation.
What does the following pseudocode print?
Integer a = 2, b = 3
Integer c = a ^ b
Integer d = a * a * a
Integer e = (a + b) * (a - b)
Print c, d, e
5 8 -5
8 8 -5
1 8 -5
1 6 -5
Sign up free to see the answer and a step-by-step explanation.
What will be printed by the following pseudocode?
Integer total = 100
total -= 10
total *= 2
total /= 3
total %= 7
Print total
4
5
60
3
Sign up free to see the answer and a step-by-step explanation.
What will be the output of the following pseudocode?
Integer x = 3
Integer y = ++x * x--
Print x, y
3 9
3 16
4 16
3 12
Sign up free to see the answer and a step-by-step explanation.
What will be printed by the following pseudocode?
Integer a = 17, b = 5
Integer q = a / b, r = a mod b
Print q * b + r == a, a - (a / b) * b
true 3
false 2
true 0
true 2
Sign up free to see the answer and a step-by-step explanation.