Questions 1: What will be the output of the following pseudocode?
Integer value, n, num
Set value = 1, n = 45
num = num >> 1
num = num + value
Print num
Answer: c) 1
Questions 2: What will be the output of the following pseudocode?
Integer x, y
for(each x from 1 to 11)
x = x + 2
end for
Print x
Answer: d) 13
Questions 3: What will be the output of the following pseudocode?
Integer j, m
Set m = 1, j = 1
Integer a[3] = {0, 1, 0}
a[0] = a[0] + a[1]
a[1] = a[1] + a[2]
a[2] = a[2] + a[0]
if(a[0])
a[j] = 5
End if
m = m + a[j]
Print m
Answer: c) 6
Questions 4: What will be the output of the following pseudocode for k = 150?
fun(integer k)
if(k>155)
return
end if
print k
fun(k+2)
print k
End of function fun()
Answer: b) 150 152 154 154 152 150
Questions 5: What will be the output of the following pseudocode?
Integer a, n, b
Set a = 0, n = 0, b
for(each n from 0 to 4)
n = n + 1
if(n EQUALS 3)
Print 'Hello World'
end if
Jump out of the loop
End for
Print n
Answer: b) 1
Questions 6: What will be the output of the following pseudocode?
Integer a[5], b[5], c[5], k, l
Set a[5] = {5, 9, 7, 3, 1}
Set b[5] = {2, 4, 6, 8, 10}
for(each k from 0 to 4)
c[k] = a[k] - b[k]
end for
for(each 1 from 0 to 4)
Print c[1]
end for
Answer: b) 3 5 1 -5 -9
Questions 7: How many times “A” will be printed in the following pseudocode?
Integer a, b, c
for(a = 0 to 4)
for(b = 0 to 2)
if(a is greater than b)
Print 'A'
End if
End for
End for
Answer: c) 9
Questions 8: What will be the output of the following pseudocode?
Integer p, q, r
Set q = 13
for(each p from 1 to 4)
r = q mod p
p = p + 5
q = p + r
end for
r = q / 5
Print q, r
Answer: d) 6 1
Questions 9: What will be the output of the following pseudocode?
Integer x
Set x = 259
if(x EQUALS 0)
Print '0'
otherwise if(x MOD 9 EQUALS 0)
Print '9'
otherwise
Print x MOD 9
end if
Answer: c) 7
Questions 10: What will be the output of the following pseudocode?
Integer a, b
et a = 12, b = 25
a = (a + b) MOD 2
b = b = a
a = a + b - 13
Print a, b
Answer: a) -11 1