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

Capgemini Pseudo Code Asked on 19th december 2021 slot 1

Capgemini Pseudo Code Asked on 19th december 2021 slot 1


1)What will be the output of the following pseudocode?
Integer a,b,c
Set a=0, b=8, c=9
for(each c from 5 to 9)
a=(a&9)^b
End for
a=c+a
for(each c from 3 to 5)
b=(12+6)+c
b=(c+a)+b
End for
Print a+b

a) 59
b) 69
c) 64
d) 66

Ans: Option c

2)What will be the output of the following pseudocode?
Integer j,m
Set m=2
Integer a[4] = {2,1,3,1}
for(each j from 0 to 2)
if (a[j] > j)
Continue
Else
m=a[j]+2
End if
m=m+1
End for
Print m

a) 17
b) 9
c) -11
d) 4

Ans: Option d

3) What will be the output of the following pseudocode if a=5,b=10,c=15?
Start
Number, a, b, result
Input: a , b
result = ++a + b++ + –c
print a,b,c,result

a) 6 11 14 30
b) 5 10 15 0
c) 6 11 14 31
d)None

Ans: Option a

4)What will be the output of the following pseudocode?
Integer a,b,c
Set a=10 , c=5
b=a++
c+=b++
print a,b,c

a) 11 11 15
b) 11 11 10
c) 11 10 11
d) 10 10 10

Ans: Option a

For more pseudo codes click here

5)What will be the output of the following pseudocode for n=127?
Read n
Integer x, y Set x=5
for i ( 1 to 10 ) x = x + 1
y = x + 1
END for
if (++x % 2 = = 0)
print(x)
END IF
print(y)
print(x)

a)16 15 15
b)16 16 15
c)15 16 17
d)16 16 16

Ans: Option d

6)What will be the output of the following pseudocode ?
Integer x,y
Set x=25 , y=5
print(x)
LABEL : x = x + ++y
if(x<50)
print(x)
goto label
END if
print(y)

a) 25 31 36 46 54
b) 25 31 38 46 9
c) 25 30 35 45 9
d) None

Ans: Option b

7) What will be the output of the following pseudocode if a=10,b=12 ?
FUNCTION temp(int x , int y)
if(x>1)
temp (x-3 ,y-2)
else
print(y)
END if-else
temp(a,b)

a) 5
b) 10
c) 6
d) 12

Ans: Option c

8) What will be the output of the following pseudocode if a = 10, b =12?
FUNCTION temp(int x, int y)
if(x>1)
temp (x-1 ,y-1)
else
print(y)
END if-else
temp(a,b)

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

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