Difficulty: Easy
Correct Answer: -8.1
Explanation:
Introduction / Context:
Literals (constants) in programming languages are categorized by type—integer, floating-point, character, string, etc. Being able to recognize integer vs. floating-point constants is foundational for understanding type rules and compiler behavior.
Given Data / Assumptions:
Concept / Approach:
An integer constant contains only digits (optionally with base prefixes/suffixes) and no decimal point. A floating-point constant contains a decimal point and/or exponent part with a fractional component. Thus, any literal with a decimal point like '-8.1' is not an integer constant.
Step-by-Step Solution:
Verification / Alternative check:
Compiling small snippets confirms types via typeof or format specifiers (e.g., printf with %d vs. %f).
Why Other Options Are Wrong:
Common Pitfalls:
Treating a leading '+' as invalid—most languages accept it; confusing a minus sign with part of the literal vs. unary negation (type remains integer).
Final Answer:
-8.1
Discussion & Comments