Difficulty: Easy
Correct Answer: -65321
Explanation:
Introduction / Context:
This tests knowledge of integer literal ranges for a 16-bit int
. While modern systems typically use 32-bit int
, many exam questions still assume a 16-bit range for portability and historical reasons.
Given Data / Assumptions:
int
range: −32768 to +32767.
Concept / Approach:
Any literal outside the stated range is invalid for assignment to a 16-bit int
without causing overflow or requiring a larger integer type. The syntax of the constants is otherwise standard (leading +
or −
sign allowed).
Step-by-Step Solution:
int
.Hence, −65321 is not a valid 16-bit integer constant under the assumption.
Verification / Alternative check:
Consider storage width: 16-bit two’s complement cannot encode magnitude 65321; wrap-around would occur if forced, which is undefined/implementation-specific in literal typing context.
Why Other Options Are Wrong:
Common Pitfalls:
Final Answer:
Discussion & Comments