Difficulty: Easy
Correct Answer: A-2, B-3, C-1
Explanation:
Introduction / Context:
Relational operators are foundational in programming. Misreading ==, !=, or >= can invert logic and break conditionals.
Given Data / Assumptions:
Concept / Approach:
Map each operator symbol to its English meaning: == means “equal,” != means “not equal,” and >= means “greater than or equal to.”
Step-by-Step Solution:
Verification / Alternative check:
Short code test: if (x == 5), if (x != 0), if (x >= y) behave exactly as the meanings indicate.
Why Other Options Are Wrong:
Common Pitfalls:
Confusing assignment (=) with equality (==) and misusing object equality versus reference equality (requires .equals for objects).
Final Answer:
A-2, B-3, C-1
Discussion & Comments