Java comparison operators and meanings: Match each symbol with its relational meaning. List I (Symbol) List II (Meaning) A. == 1. Greater than or equal to B. != 2. Equal C. >= 3. Not equal
Electronics and Communication Engineering
Matching Questions
Difficulty: Easy
Choose an option
-
AA-1, B-2, C-3
-
BA-3, B-2, C-1
-
CA-1, B-3, C-2
-
DA-2, B-3, C-1
Answer
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:
- Java syntax is being referenced (== for equality, != for inequality).
- Operators are used in boolean expressions.
- Comparison context is value comparison for primitives.
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:
Identify A: == ⇒ Equal ⇒ A-2.Identify B: != ⇒ Not equal ⇒ B-3.Identify C: >= ⇒ Greater than or equal to ⇒ C-1.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:
- Swapping == with != flips conditions and logic.
- Treating >= as equality or strict greater-than is incorrect and would fail boundary checks.
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