Consider following conditional statements 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:
- AOption (a)
D, B, A, C
- BOption (b)
B, D, C, A
- COption (c)
B, D, A, C
- DOption (d)
A, B, D, C
View answer & explanationHide answer & explanation
Correct answer
B, D, A, C
Why this answer is correct
The correct answer is Option 3.
Key Points
- To determine the order of execution of the operations in the given conditional statement if (m == 20 - 10 || n > 10), we need to consider the operator precedence in C-like programming languages.
- Operator precedence determines the order in which parts of an expression are evaluated.
- Here is the precedence of the operators involved, from highest to lowest:
- Subtraction (-)
- Relational equality (==)
- Relational greater than (>)
- Logical OR (||)
Additional Information
- According to the operator precedence:
- First, the subtraction operation (B) is performed: 20 - 10.
- Then, the equality operation (A) is evaluated: m == 10.
- Next, the relational greater than operation (D) is evaluated: n > 10.
- Finally, the logical OR operation (C) is performed to combine the two relational results.
- Thus, the order of execution is: B, D, A, C.
- Therefore, Option 3 is the correct answer.














