Question-12
GATE-2019 (modified)
Consider the following python program:
What is the output of the given code?
Answer
\(26\)
Solution
- Initially, in the
main()
function,x = 2
andy = 5
. y
is updated tojumble(5, 2)
, which evaluates to \(2 \times 5 + 2 = 12\).- Subsequently,
x
is updated tojumble(12, 2)
, which evaluates to \(2 \times 12 + 2 = 26\). - Therefore, the final value of
x
printed by the program is \(26\).