Questions 31: What will be the output of the following pseudo code for number = 3 ?
Integer prime( Integer number)
if ( number less than equal to 1)
return 1
else
return ( number * number * number + prime( number - 1))
End function prime()
Answer: a
Questions 32: What will be the output of the following pseudo code?
Integer a, b, c
Set b = 1
Set a = b + 3
Set c = 10
if ( a )
a = a - 2
End if
if ( a )
a = 10
End if
a = a + b + c
Print a + b
Answer: b) 22
Questions 33: What will be the output of the following pseudo code?
Integer a, b, c
Set a = 3, b = 2, c = 3
If( a >> 1 && b>>1 )
a = a << 1
b = b + 1
Else
b = b >> 1
c = c >> 2
End if
Print a + b - c
Answer: c
Questions 34: What will be the output of the following pseudo code?
Integer a, b, c
Set b = 10, a = 1
if(0)
a = a - 1
Else
a = b + 1
b = a - 1
a = a - 1
End if
Print a
Answer: b
Questions 35: What will be the output of the following pseudo code?
Integer a, b, c, d set d = 6; for ( each a from 1 to 2 ) for( each b from a to 2 ) for( each c from b to 2 ) printf d end for end for end for
Answer: d
Questions 36: What will be the output of the following pseudo code for number = 3 ?
Integer a, b, c
set a = 108, b = 2, c = 3
if( a MOD 9 ) EQUALS 0 )
b = b + ( a MOD 2 )
printf b
else
c = c + (a MOD 7 )
printf c
end if
[Note : MOD finds the remainder after the division of the number by another]
Answer: a
Questions 37: Which of the following values of 'a' the statement under if will excuted?
Integer a
if( a mod 10 > 5 OR a mod 10 equals 3 AND a/100 equals 1 )
print a mod 10 + a/100
else
print a
end
Answer: a
Questions 38: What will be output of following pseudocode which is given below for p=10 and q=11?
Integer fun( Integer p, Integer q)
Integer k
Set k = 0
if( p > 0 && q > 0 )
k = k + 1
fun (p-1, q)
end if
return k
End function fun()
Answer: c
Questions 39: What will be output of the following pseudocode for a = 6?
Integer fun(integer a)
if(a EQUALS 0)
return a + 9
else
return fun(a-1)
End function fun()
Answer: b
Questions 40: What will be the output of the folowing pseudocode?
Integer i
Set i = 45
if( i mod 2 EQUALS 0 OR i mod 2 AND i )
printf i mod 2
else
print i
end if
Answer: a