Difficulty: Easy
Correct Answer: A-2, B-3, C-1
Explanation:
Introduction / Context:Many programming languages use distinct operators for boolean logic and for assignment. Misreading these symbols is a common source of bugs. This matching task reinforces the difference between logical conjunction/disjunction and variable assignment in mainstream C-like languages.
Given Data / Assumptions:
Concept / Approach:Disambiguate symbols by role: logical operators combine boolean results; assignment stores a value. Remember that equality comparison is '==' (not '='), which prevents confusing assignment with testing for equality.
Step-by-Step Solution:
Map '&&' → Logical AND → A-2.Map '||' → Logical OR → B-3.Map '=' → Assignment operator → C-1.Verification / Alternative check:Consider code: if (x > 0 && y > 0) {...} executes only if both comparisons are true; flag = (x > 0 || y > 0); assigns a boolean result to flag. Using a single '=' inside an if-condition would change a value and is typically flagged by compilers or linters.
Why Other Options Are Wrong:
Common Pitfalls:
Final Answer:A-2, B-3, C-1
Discussion & Comments