Multiple choice

An expression contains relational operators, assignment operators and arithmetic operators. In the absence of parenthesis, they will be evaluated in which order respectively?

  1. Assignment, relational, arithmetic

  2. Arithmetic, relational, assignment

  3. Relational, arithmetic, assignment

  4. Assignment, arithmetic, relational

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

Operator precedence determines evaluation order: arithmetic operators (+, -, *, /) have highest precedence and are evaluated first, followed by relational operators (>, <, ==, !=, etc.), with assignment operators (=, +=, etc.) having lowest precedence. This hierarchy ensures that mathematical calculations are completed before comparisons, which are resolved before storing results.