Which of these is not a valid octal literal?

Enhance your programming skills with the RECF Programming Test. Features flashcards and multiple choice questions with hints and explanations. Prepare for success!

Multiple Choice

Which of these is not a valid octal literal?

Explanation:
Octal literals are base-8 numbers that use only digits 0 through 7 (often written with a leading zero). Because of that, any value containing a digit outside that range cannot be octal. The option that includes the digit 8, 0800, is not a valid octal literal. The other options—0777, 040, and 0123—use only digits 0–7, so they are valid octal literals.

Octal literals are base-8 numbers that use only digits 0 through 7 (often written with a leading zero). Because of that, any value containing a digit outside that range cannot be octal. The option that includes the digit 8, 0800, is not a valid octal literal. The other options—0777, 040, and 0123—use only digits 0–7, so they are valid octal literals.

Subscribe

Get the latest from Passetra

You can unsubscribe at any time. Read our privacy policy