Q: 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()
Solution: 40
Q: 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
Solution: 6
Q: 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
Solution: 2
Q: 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
Solution: 3
Q: 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 mSolution: 8
Q: 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
Solution: 4
| You Have Score    | /6 |