What will be the output of the following pseudo code? Integer a=5, b=4, c=3 a…

2025

What will be the output of the following pseudo code?

Integer a=5, b=4, c=3

a = b + c

c = a – b

c = c + a

c = b + c

b = b + c

Print a, b, c

Answer: D. 7 18 14Correct answer: 7, 18, 14 Explanation: Start with the initial values Initial state: a = 5, b = 4, c = 3. a = b + c => a = 4 + 3 = 7 (state: a=7, b=4, c=3) c =…

  1. A.

    7 14 7

  2. B.

    7 14 10

  3. C.

    7 8 14

  4. D.

    7 18 14

Attempted by 175 students.

Show answer & explanation

Correct answer: D

Correct answer: 7, 18, 14

Explanation: Start with the initial values

  • Initial state: a = 5, b = 4, c = 3.

  1. a = b + c => a = 4 + 3 = 7 (state: a=7, b=4, c=3)

  2. c = a - b => c = 7 - 4 = 3 (state: a=7, b=4, c=3)

  3. c = c + a => c = 3 + 7 = 10 (state: a=7, b=4, c=10)

  4. c = b + c => c = 4 + 10 = 14 (state: a=7, b=4, c=14)

  5. b = b + c => b = 4 + 14 = 18 (state: a=7, b=18, c=14)

Therefore, Print a, b, c => 7 18 14.

Explore the full course: Infosys Preparation

Loading lesson…