• Courses
  • Tutorials
  • Jobs
  • Practice
  • Contests

Capgemini Pseudocode Quiz Questions

Question 1

What will be the output of the following pseudocode?

Initialize Integer x, y, z
Set y = 1, x = 2
z = x ^ y
Print z
  • 1

  • 2

  • 4

  • 3

Question 2

Which of the following series will be printed by the given pseudocode? 

Integer a, b, c 
Set b = 4, c = 5 
for(each a from 2 to 4) 
  print c 
  b = b - 1 
  c = c + b 
end for
  • 5 8 10

  • 1 3 6

  • 8 9 10

  • 3 6 9

Question 3

Predict the output of the following pseudocode.

Integer value, n
Set value = 1, n = 45
while(value less than equal to n)
  value = value << 1
end loop
Print value
  • 16

  • 32

  • 64

  • 36

Question 4

Integer x, y 
Set x = 15, y = 12 
y = x – 1 
do{ 
  Print x 
  x = y + (x – 2) 
} 
while(x < 40) 
end do while
  • 14 26

  • 15 27 39

  • 27 39

  • 15

Question 5

What will be the output of the following pseudocode?

Initialize Integer x, y, z
Set y = 1, x = 2
z = x & y
Print z
 
  • 0

  • 2

  • 4

  • 3

Question 6

Which of the following series will be printed by the given pseudocode? 

Integer a, b, c 
Set b = 0, c = 0 
for(each a from 1 to 5) 
  print c 
  b = b + 1 
  c = c + b 
end for
  • 5 4 3 2 1

  • 0 1 3 6 10

  • 2 5 8 9 10

  • 0 0 0 0 0

Question 7

Integer value, n 
Set value = 32, n = 1 
while(value greater than equal to n) 
  value = value >> 1 
end loop 
Print value
  • 16

  • 32

  • 64

  • 0

Question 8

Integer x, y
Set x = 4, y = 8
do{
  Print x 
  x = x + y + 1
}
while(x < 15)
end do while
  • 14 26

  • 15 17

  • 4 13

  • 4

Question 9

Predict the output of the following pseudo-code if x= 1 and y=2: 

Integer solve(int x, int y) 
if(x > 1) 
  solve(x – 1, y + 3) 
end if 
print y 
End function solve()
  • 2

  • 3

  • 6

  • 4

Question 10

Integer a, b, c
Set c = 12, b = 4
a = c / b
c = b >> a
Print c

  • 2

  • 0

  • 6

  • 4

There are 20 questions to complete.

Last Updated :
Take a part in the ongoing discussion