Open In App

Capgemini | Pseudocode Questions | Question 8

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

(A)

14 26



(B)

15 17



(C)

4 13

(D)

4

Answer: (C)
Explanation:

Firstly variables x and y are initialized, then x and y are assigned values 4 and 8 respectively. 

do while loop runs till x is less than 15 print x and assign x with the value of y + 1 
The order in which value of x changes is 4 then 13(4 + 8 + 1) then 22(13 + 8 + 1), then do while loop terminates. 

The final series obtained is 4, 13

Quiz of this Question
Please comment below if you find anything wrong in the above post

Article Tags :
Uncategorized