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