Multiple choice

Which of the following is an invalid example of a numeric constant?

  1. 14.85

  2. 98

  3. – 1890

  4. $75
Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

Numeric constants in programming must contain only digits, a decimal point, and optional sign. Option A (14.85) is a valid decimal, Option B (98) is a valid integer, and Option C (– 1890) with negative sign is valid. Option D ($75) contains a currency symbol, making it invalid as a numeric constant - the dollar sign is not part of numeric representation in programming.