Discussion
In case of ordinary int variables
Answer: A
Correct answer: leftmost bit is reserved for sign
A plain int is signed, and in the two's complement representation used by essentially every current implementation the most significant - leftmost - bit carries the sign: 0 for non-negative, 1 for negative.
That bit is not available for magnitude, which is why a 32-bit int spans roughly \( -2^{31} \) to \( 2^{31}-1 \) rather than 0 to \( 2^{32}-1 \). Declaring the variable unsigned releases the bit for magnitude and doubles the positive range.
No comment is present. Be the first to comment.
Loading…
Post your comment
Please log in or register to post a comment.
Examination Categories
- SSC Exams
- Banking Exams
- Teaching Exams
- Civil Services Exams
- Railways Exams
- Engineering Recruitment Exams
- Defence Exams
- State Government Exams
- Police Exams
- Insurance Exams
- Nursing Exams
- Other Government Exams
- NRA CET
- PG Entrance Exams
- Campus Placement
- MBA Entrance Exams
- CUET and UG Entrance
- Judiciary Exams
- Regulatory Body Exams
- Software Development