Correct Answer : A
Execution of program starts from main
. Inside main
five integer variables are declared and initialized as follows:
i = 200
j = 020
k = 002
l = 220
m = 202
variables i, l, m
are decimals (base = 10) and variables j, k
are octals (base = 8) since they are preceeded by 0. Variable sum
is declared and assigned to sum of all above variables. But to add them, all numbers must be of the same base. So convert from octals to decimals and add.
020 = 2 * 8 ^ 1 + 0 * 8 ^ 0 = 16
002 = 0 * 8 ^ 1 + 2 * 8 ^ 0 = 2
So sum = 200 + 16 + 2 + 220 + 202 = 640