Difficulty: Easy
Correct Answer: c=1
Explanation:
Introduction / Context:
In C, relational and logical operators yield an int result: 1 for true and 0 for false. This question checks that knowledge using a simple disjunction (logical OR).
Given Data / Assumptions:
Concept / Approach:
The logical OR operator || returns 1 if either operand is nonzero. Since the first operand is true, the overall result is true and short-circuiting applies; the second comparison need not change the outcome.
Step-by-Step Solution:
Compute a == 100 → 1.Compute b > 200 → 0.Evaluate 1 || 0 → 1; assign to c.printf prints "c=1".
Verification / Alternative check:
Change b to 250 to see that the expression still yields 1. Change a to 99 and b to 200 to see it yields 0.
Why Other Options Are Wrong:
(a), (b), and (d) misinterpret logical results as variable values. (e) would only occur if both comparisons were false.
Common Pitfalls:
Expecting printf to print the value of true as true instead of 1; forgetting that C uses integers for boolean outcomes.
Final Answer:
c=1
Discussion & Comments