All mock tests are FREE till 31 December — register to save your progress

Consider the conditional statement if (m == 20 − 10 || n > 10). The order of execution of the following operations is
A. ==
B. −
C. ||
D. >
Choose the correct answer from the options given below:

Pick an option to check yourself, or open the answer below.

Show answer & explanation

Correct answer: C. B, D, A, C

Explanation

Precedence in C: arithmetic (−) is highest, then relational (>), then equality (==), then logical OR (||). So 20 − 10 is computed first, then n > 10, then m == 10, and finally ||: B, D, A, C.

More Programming Languages and Computer Graphics questions