Question 51
MediumWhat does the following pseudocode print?
Integer x = 200
x = x >> 2 << 2
Print x, 203 >> 2 << 2
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 does the following pseudocode print?
Integer x = 200
x = x >> 2 << 2
Print x, 203 >> 2 << 2
800 812
200 200
50 50
200 203
Sign up free to see the answer and a step-by-step explanation.
What will be printed by the following pseudocode?
Integer n = 19, mask = 15
Print n & mask, n | mask, n ^ mask
15 19 4
4 31 28
3 31 28
3 31 12
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, mask
for (each mask from 0 to 7)
if (mask & 4)
s = s + 1
end if
end for
Print s
3
1
4
8
Sign up free to see the answer and a step-by-step explanation.
What will be the output of the following pseudocode?
Integer x = 9
x = x ^ 15
Print x, x ^ 15
6 6
6 9
15 9
9 6
Sign up free to see the answer and a step-by-step explanation.
What will be the output of the following pseudocode?
Integer a[] = {4, 7, 4, 9, 7}
Integer r = 0
for (each i from 0 to 4)
r = r ^ a[i]
end for
Print r
9
4
7
0
Sign up free to see the answer and a step-by-step explanation.
What will be the output of the following pseudocode?
Integer n = 6, rev = 0
for (each i from 1 to 4)
rev = (rev << 1) | (n & 1)
n = n >> 1
end for
Print rev
12
3
9
6
Sign up free to see the answer and a step-by-step explanation.
What will be the output of the following pseudocode?
Integer n = 64
if (n > 0 AND (n & (n - 1)) == 0)
Print "Yes"
else
Print "No"
end if
0
64
Yes
No
Sign up free to see the answer and a step-by-step explanation.
What will be the output of the following pseudocode?
Integer x = 13, y = 0, i = 0
while (x > 0)
if (x & 1)
y = y + (1 << i)
end if
x = x >> 2
i = i + 1
end while
Print y
3
7
5
13
Sign up free to see the answer and a step-by-step explanation.
What will be the output of the following pseudocode?
Integer n = 5
Print (n << 2) + (n >> 1)
22
20
25
12
Sign up free to see the answer and a step-by-step explanation.
What will be the output of the following pseudocode?
Integer n = 6
Print n ^ (n >> 1) // ^ is XOR
3
7
5
6
Sign up free to see the answer and a step-by-step explanation.