# Capgemini Sample Question Paper II | Codewindow.in

#### Q1. What will be the output of the following pseudocode for a=6, b=3, c=4?

``````Integer funn(Integer a, Integer b, Integer c)
for(each c from 5 to 6)
b=(b+a)^a
End for
return a+b
``````

#### Q2. What will be the output of the following pseudocode?

``````Integer a,b,c
set a=5, b=3, c=5
if((c+b+a)<(a+c))
a=(a+b)+a
End if
if((7+a-b)<(b+c))
c=(3+8)+c
End if
print a+b+c
``````

#### Q3. What will be the output of the following pseudocode?

``````Integer a,b,c
set a=5, b=7, c=8
if((c-9)<(9-c))
a=c^b
a=b+c
else
a=a+b
b=(b+5)+a
if(5>b)
c=(b+a)+c
a=c+a
End if
a=(b&5)+a
End if
print a+b+c``````

#### Q4. What will be the output of the following pseudocode?

``````Integer p,q,r
set p=2, q=8, r=9
for(each r from 5 to 9)
q=q+r
if((9&q)<r)
q=3^pa
q=5+q
Else
jump out of the loop
End if
p=5+r
End for
print p+q``````

#### Explanation:POT is 28, 33, 47, 61, 55, 99, 82, 75, 41So 41 is the root. 75 is the right children of 41, and as it is a BST 33 will the left children. 28 will be the only left children of 33.47 has to be the left most child of 75. 61 or 55 has to be its parent but as 61 comes before 55, 55 is parent of 61. Same goes for 82 and 99.

``````                        41
/	  \
33	   75
/	  /  \
28	55    82
/  \	\
47	   61	 99``````