Question 51
MediumWhat is the output of this pseudocode?
Integer x = 100
x = x / 3 * 3
Print x, 100 * 3 / 3
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 is the output of this pseudocode?
Integer x = 100
x = x / 3 * 3
Print x, 100 * 3 / 3
33 100
99 100
99 99
100 100
Sign up free to see the answer and a step-by-step explanation.
What does the following pseudocode print?
Integer a = 4
Integer b = (a + 2) * (a - 2) / 3 mod 3
Print a, b
4 0
6 1
4 1
4 4
Sign up free to see the answer and a step-by-step explanation.
What will be printed by the following pseudocode?
Integer x = 7
Boolean p = x > 5, q = x mod 2 == 0
Print p and not q, p or q, p == q
false true false
true true true
true false false
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 total = 0, i
for (each i from 1 to 10)
total = total + (i mod 3 == 0 ? i : 0)
end for
Print total
3
55
30
18
Sign up free to see the answer and a step-by-step explanation.
What will be the output of the following pseudocode?
Integer a = 2, b = 3
Print a + b * a - b / a + a mod b // integer division
10
7
8
9
Sign up free to see the answer and a step-by-step explanation.
What will be the output of the following pseudocode?
Integer x = 5
Integer y = x * 2
x = y - x
y = y - x
x = x + y
Print x, y
5 5
5 10
10 5
15 5
Sign up free to see the answer and a step-by-step explanation.
What will be the output of the following pseudocode?
Integer a = 7
Integer b = (a > 5) ? ((a > 6) ? 1 : 2) : 3
Print b
3
7
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 n = 1234
Print (n / 100) mod 10 + (n mod 100) / 10 // integer division
5
4
7
3
Sign up free to see the answer and a step-by-step explanation.
What will be the output of the following pseudocode?
Integer a = -7, b = 2
Print a / b, a mod b // C-style: division truncates towards zero
-4 1
-3 1
-3 -1
-4 -1
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
x = x * x - x / 2 * 2 + x mod 2 // integer division
Print x
8
7
10
9
Sign up free to see the answer and a step-by-step explanation.