MCQ Hive stays free thanks to ads. Please disable your ad blocker for this site so content and features keep working.
Data Types
Number Systems & Literals
Beginner
Q
In C/C++, what is the decimal value of the literal 017?
ACompilation error
B7
C17
D15
Correct Answer:
D. 15
Explanation:
A leading 0 makes an integer literal octal, so 017 = 1×8 + 7 = 15.
ALSO KNOW (related points):
• What happens when x = 017 is written in Python 3? → SyntaxError: leading zeros are not allowed in decimal literals
• What is the value of int("12", 8) in Python? → 10
• What is the decimal value of the hexadecimal number 0x1F? → 31