Multiple choice technology programming languages

What is output of follwoing int main() { int a=000; cout << "R4R:"; cout << a; return 0; }

  1. Execution time error

  2. Syntax error

  3. R4R:0

  4. None

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

In C++, when you initialize an integer with leading zeros like 'int a=000', the compiler interprets it as an octal (base-8) literal. However, 000 in octal equals 0 in decimal. So the program prints 'R4R:' followed by '0', giving the output 'R4R:0'. There's no syntax or execution error - the code is valid and runs correctly.