Questions 11: What will be the output of the following pseudo code?
Integer a
Integer p
Set a=8
p=a+5/7*4
print p*8
Answer: b
Questions 12: What will be the output of the following pseudo code for a=50?
Integer fun( Integer a)
Integer b
Set b = 10
Return a-b
End function fun()
Answer: b
Questions 13: What will be the output of the following pseudo code ?
Integer x, y, z
Set x=0, y=1
For( each z from 0 to 2 )
x = x + y + z
End for
print x
Answer: b
Questions 14: What will be the output of the following pseudo code ?
( Note : mod finds the remainder after division of one number by another. ^ is the bitwise XOR operator here )
Integer i, j, k, m
Set j = 6, i = 8, k = 7, m = 1
If (( i^j ) mod k EQUALS 0 )
m = m + 1
else
m = m – 1
End If
Print m
Answer: d
Questions 15: What will be the output of the following pseudo code for input 134 ?
Integer fun( Integer num )
Static Integer a = 0
If (num > 0)
a = a + 1
fun ( num /10 )
Else
Return a
End Function
Answer: c
Questions 16: What will be the output of the following pseudo code?
Integer a, b, c
Set a = 3, b = -2
if ( b – 1 > b )
for ( each c from 1 to 2 )
a = a – 1
If ( c > 0 )
Jump out of the loop
End If
Continue
a = a + 1
a = a – 3
a = a + 2
End For
End If
Print a + b
Answer: a
Questions 17: What will be the output of the following pseudo code?
Integer j, m
Set m = 2
Integer a[4] = { 2, 4, 2, 2 }
If ( a[1] > 3 )
a [1] = a [2]
End If
If (1)
a [2] = a [1] + 2
End If
m = m + a[3] + a[2]
Print m
Answer: b
Questions 18: What will be the output of the following pseudo code?
Integer a, b, c
Set a = -3, b = -2
if ( b – 1 > b )
for ( each c from 1-1 to 1-2 )
If ( c < 0 )
Jump out of the loop
End If
a = a + b
End For
End If
Print a + b
Answer: c
Questions 19: What will be the output of the following pseudo code?
Integer a, b, c
Set a = 5, b = 3
For ( each c from b to a )
If ( a )
a = a -1
End if
If ( b )
b = b -1
End if
End for
Print a + b
Answer: b
Questions 20: What will be the output of the following pseudo code?
Integer a, b, c
Set b = 10, a = 20, c = 20
a = a – c
c = c + a
Print b + c
Answer: c