Open In App

Capgemini | Pseudocode Questions | Question 16

Predict the output of the following pseudo-code

Integer x = 1, y = 1 z = 1
x = y * z
z = y - z
y = z / y
Print x, y, z

(A)



1 2 1

(B)



1 0 0

(C)

2 1 0

(D)

3 4 1

Answer: (B)
Explanation:

Initial value of x = 1, y = 1, z = 1 
Then X = y*z = 1*1 = 1 
z = y – z = 1 – 1 = 0 
y = z / y = 0/1 = 0

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

Article Tags :
Uncategorized