Difficulty: Easy
Correct Answer: 2
Explanation:
Introduction / Context:
The expression casts i through char, then float, then int, and sizeof is applied to the resulting type. In Turbo C (16-bit DOS), int is typically 2 bytes.
Given Data / Assumptions:
Concept / Approach:
The final cast determines the sizeof result. Intermediate casts do not matter for sizeof once the final type is known.
Step-by-Step Solution:
1) (char)i yields type char.2) (float)(char)i yields type float.3) (int)(float)(char)i yields type int.4) sizeof(int) on Turbo C is 2 ⇒ the program prints 2.
Verification / Alternative check:
Print sizeof(int) directly to confirm 2 on the target toolchain.
Why Other Options Are Wrong:
Options C/D assume 32-/64-bit sizes not applicable to Turbo C; Option A confuses char size with the final cast.
Common Pitfalls:
Believing that the value of i or intermediate types influence sizeof once the final cast is int.
Final Answer:
2
Discussion & Comments