## Capgemini Pseudocode MCQ’s(2021)

Question 1 :

Contents

What will be the following output of the following pseudocode for p = 3, q = 1 ?

Integer funn(Integer p,Integer q)

if(p<0)

return 1

End iif

if(q>0 OR p>0)

return funn(p-1, q)

Else

return p

End if

return q

End function funn()

Options :

a. 2

b. -4

c. 1

d. 10

`Answers : c. 1`

Question 2 :

What will be the output of the following pseudocode ?

Integer a, b, c

Set a = 2, b = 11, c = 6

if((b + c) > (c + b))

b = c + a

End if

if((c + b) > (b – c))

c = (9 + 4) + a

End if

Print a + b + c

Options :

a. 47

b. 28

c. 21

d. 32

`Answers : b. 28`

Question 3 :

What will be the output of the following pseudocode ?

Integer a, b, c

Set a = 8, b = 2, c = 15

for (each c from 2 to 4)

b = 6 + b

End for

b = 10 ^ b

Print a + b

Options :

a. 38

b. 49

c. 39

d. 33

`Answers : `

a. 38

Question 4 :

What will be the output of the following pseudocode for p = 2, q = 2 ?

Integer funn(Integer p, Integer q)

if(q>0 OR p>0)

return funn(p-1, q-1) + funn(q-1, p-1)

Else

return p

End if

return q

End function funn()

Options :

a. 3

b. 9

c. 0

d. -4

`Answers : c. 0`

Question 5 :

What will be the output of the following pseudocode ?

Integer a, b, c

Set a = 7, b = 10, c = 10

for(each c from 3 to 7)

a = (8 + 5) + c

End for

for (each c from 3 to 4)

a = (12 + 8) + a

a = b + c

End for

Print a + b

Options :

a. 25

b. 21

c. 24

d. 38

`Answers : d. 38`

Question 6 :

What will be the output of the following pseudocode for a = 5, b =4 ?

Integer funn(Integer a, Integer b)

Integer c

Set c = a + b

c = c + a

a = b + c

return a + b

End function funn()

Options :

a. 21

b. 22

c. 24

d. 30

`Answers : b. 22`

Question 7 :

What will be the output of the following pseudocode ?

Integer a, b, c

Set a = 6, b = 4, c = 13

for(each c from 3 to 5)

b = 4

if(c < b)

Continue

Else

b = 10

a = 11

End if

End for

Print a + b

Options :

a. 23

b. 22

c. 21

d. 16

`Answers : c. 21`

Question 8 :

What will be the output of the following pseudocode ?

Integer a, b, c

Set a = 5, b = 11, c = 7

for(each c from 2 to 3)

b = 9 + a

End for

Print a + b

Options :

a. 19

b. 24

c. 20

d. 15

`Answers : a. 19`

Question 9 :

What will be the output of the following pseudocode for a = 3, b=5, c=4 ?

Integer funn(Integer a, Interger b, Integer c)

if((4+7) < (6-c) OR 3>a)

c = a ^ a

a = 8 + a

Else

a = (4+1) + b

End if

return a + b + c

End function funn()

Options :

a. 27

b. 19

c. 16

d. 22

`Answers : b. 19`

Question 10 :

What will be the output of the following pseudocode ?

Integer pp, qq, rr

Set pp = 5, qq = 10, rr = 5

if(rr>qq OR (qq+pp)>(pp-qq))

qq = pp

pp = (rr + pp) + pp

End if

Print pp + qq + rr

Options :

a. 25

b. 29

c. 42

d. 10

`Answers :a. 25 `

Question 11 :

What will be the output of the following pseudocode ?

1. String str=”oo”, str2=”00″
2. Print isPalin(str1+str2)

Options :

a. 3

b. 0

c. -5

d. 8

`Answers : b. 0 `

1. Rahul