Difficulty: Medium
Correct Answer: 4, 4, 2
Explanation:
Introduction / Context:
This problem checks how pointer qualifiers near/far/huge bind to the identifier and how sizeof reports the size of each variable in Turbo C (16-bit DOS).
Given Data / Assumptions:
Concept / Approach:
Read declarations right-to-left. The qualifier directly adjacent to the identifier (ptr1/ptr2/ptr3) governs the representation size of that pointer variable.
Step-by-Step Solution:
1) ptr1 is declared as far * ⇒ sizeof(ptr1) = 4.2) ptr2 is declared as huge * ⇒ sizeof(ptr2) = 4.3) ptr3 is declared as near * ⇒ sizeof(ptr3) = 2.4) Output sequence: 4, 4, 2.
Verification / Alternative check:
Create single-variable tests with the same qualifiers and inspect sizeof to confirm.
Why Other Options Are Wrong:
Option A/D: Assume 8-byte pointers or misassign sizes.Option B: Incorrectly treats ptr1 or ptr2 as near pointers.
Common Pitfalls:
Attaching the qualifier to the wrong level of indirection, or believing inner pointer qualifiers influence the outer pointer's sizeof.
Final Answer:
4, 4, 2
Discussion & Comments