What data type is the literal -11?

Study for the End of Year 8 Computer Science Test. Prepare with flashcards and multiple choice questions, each with hints and explanations. Get ready for your exam!

Multiple Choice

What data type is the literal -11?

Explanation:
A negative numeric literal with no fractional part is an integer. The value -11 has no decimal point, so it’s classified as an integer, with the minus sign simply applying negation to the number 11. It isn’t a boolean (true/false), not a string (text), and not a float (which would include a decimal point like -11.0 or -3.14).

A negative numeric literal with no fractional part is an integer. The value -11 has no decimal point, so it’s classified as an integer, with the minus sign simply applying negation to the number 11. It isn’t a boolean (true/false), not a string (text), and not a float (which would include a decimal point like -11.0 or -3.14).

Subscribe

Get the latest from Passetra

You can unsubscribe at any time. Read our privacy policy