Difficulty: Easy
Correct Answer: 4294967295, 4294967295
Explanation:
Introduction / Context:
This checks knowledge of unsigned wraparound and typical widths under Turbo C. Casting -1 to an unsigned type yields the maximum representable value for that type.
Given Data / Assumptions:
Concept / Approach:
Two's complement and modulo arithmetic: (unsigned long)-1 maps to 2^32 - 1 = 4294967295.
Step-by-Step Solution:
1) a = (unsigned long)-1 ⇒ 4294967295.2) b = (unsigned long)-1 via typedef u ⇒ 4294967295.3) Printing both yields "4294967295, 4294967295".
Verification / Alternative check:
Print sizeof(unsigned long) to confirm 4, then print the values.
Why Other Options Are Wrong:
Options A/B are arbitrary numbers; Option D is incorrect because defined unsigned wraparound is not garbage.
Common Pitfalls:
Using a wrong format specifier (e.g., %u) or assuming 64-bit widths on modern systems; this is specific to Turbo C.
Final Answer:
4294967295, 4294967295
Discussion & Comments