Capgemini Pseudo Code MCQs Asked on 20th december 2021

Capgemini Pseudo Code MCQs Asked on 20th december 2021

Capgemini Pseudo Code MCQs Asked on 20th december 2021


1)What will be the output of the following pseudocode?
Integer p,q,r
Set p=9,q=7,r=4
r=q+r
if((p^q) q=11+r
q=(q+p)+r
End if
Print p+q+r

a) 27
b)13
c) 34
d) 46

Ans: Option a

2)What will be the output of the following pseudocode?
integer a,b,c
Set a=3,b=7,c=10
for(each c from 2 to 4)
a=(b^b)+b
if(c>a)
continue
else
jump out of the loop
a=(8&12)+a
Print a+b

a) 17
b) 10
c) 7
d) 22

Ans: Option d

3) What will be the output of the following pseudocode?
integer a,b,c
Set a=8,b=4,c=9
for(each c from 5 to 7)
a=3+b
if(5<a)
a=(c+3)+b
Print a+b

a) 18.
b) 36.
c) 12.
d) 20

Ans: Option a

4)What will be the output of the following pseudocode?
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

For more pseudo codes click here

a) 21
b) 22
c) 28
d) 11

Ans: Option b

5)What will be the output of the following pseudocode ?
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

a) 9
b) 12
c) 6
d) 3

Ans: Option c

6)What will be the output of the following pseudocode ?
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

a) 6 6 6 6 6 6
b) 6 6
c) 6 6 6
d) 6 6 6 6

Ans: Option d

7) What will be the output of the following pseudocode ?
nteger 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

a) 2
b) 7
c) 1
d) 3

Ans: Option a

8) What will be the output of the following pseudocode?
Integer fun(integer a)
if(a EQUALS 0)
return a + 9
else
return fun(a-1)
End function fun()

a) 6
b) 9
c) 1
d) 0

Ans: Option b

For more pseudo codes click here

Comments

Popular posts from this blog

Capgemini Analyst Interview Experience | Experience 2

Capgemini Pseudocode Question Asked on 19th december 2021 | slot 2

Capgemini Pseudocodes MCQs Part 2