Questions 21: What will be the output of the following pseudo code for a=34?
Integer fifo(Integer a)
If ( a equals 1 )
return a + 9
Else
return fifo( a/5+ a/35)
End if
End Function fifo()
Answer: b
Questions 22: What will be the output of the following pseudo code?
Integer a, b, c, s
Set a = 16, b = 23, c = 7
s = ( a + b ) && ( a – b ) || ( a * c )
if ( s not equals 0 )
print s + a – b * c
else
print s + s
end if
Answer: c
Questions 23: What will be the output of the following pseudo code for a = 132 and b = 41?
Integer funn( Integer a, Integer b)
a = a + b
b = a – b
return b + a
End function funn()
Answer: d
Questions 24: What will be the output of the following pseudo code for a =12, b = 41?
Integer funn( Integer a, Integer b)
if ( a - b )
return b + a
Else
return a - b
End if
Answer: d
Questions 25: What will be the output of the following pseudo code ?
Read Integer
j=41, k= 37
j=j+1
k=k-1
j=j/k
k=k/j
print(k,j)
Answer: b
Questions 26: What will be the output of the following pseudo code for s = 8 ?
Integer shift(Integer s)
if ( s is greater than equal to 3)
return shift( s >> 1 )
else
return s
end if
End function shift()
Answer: c
Questions 27: What will be the output of the following pseudo code ?
Integer a, b, c
Set b = 2, a = 1
for ( each c from 1 to 1 )
a = a * c
b = b* c
End for
If ( (1&4) || ( 1^1) || (2^1) )
b = a - 1
a = a - 1
Else
b = a ^ 1
a = a ^ 1
End if
Print a + b + c
Answer: c
Questions 28: What will be the output of the following pseudo code ?
Integer a, b
Set a = 7
b = 10 ^ a
if ( a & b )
a = a >> 2
End if
a = a - b
Printf a + b
Answer: a
Questions 29: What will be the output of the following pseudo code ?
Integer a, b, c, d
Set a = 3, b = 1, c = 3
for ( each d from 1 to 3 )
if ( d > 2)
a = a - b
b = a
End if
End for
Print a + c
Answer: b
Questions 30: What will be the output of the following pseudo code ?
Integer a
String str1
Set str1 = "goose"
a = stringLength(str1)
Print a
Answer: c