Pick the operators whose meaning is context dependent
A. | * |
B. | # |
C. | & |
D. | All of the above |
Option: D Explanation : Often the precedence of an operator depends on the context. For example, a minus sign typically has a very high precedence as a unary operator, and a somewhat lower precedence (lower than multiplication) as a binary operator. Click on Discuss to view users comments. |
Which of the following comments about the ++ operator are correct ?
A. | it is a unary operator |
B. | the operand can come before or after the operator |
C. | it cannot be applied to an expression and is ssociated from the right |
D. | All of these |
Option: D Explanation : Click on Discuss to view users comments. |
The expression 5 -2 - 3 * 5 - 2 will evaluate to 18, if
A. | - is left associative and * has precedence over - |
B. | - is rightt associative and * has precedence over - |
C. | - is right associative and - has precedence over * |
D. | - is left associative and - has precedence over * |
Option: C Explanation : 5 - 2 -3 *5 -2 will yield 18, if it is treated as (5-(2-3)) * (5-2).i-e if - has precedence over * and if it associates from the right. Click on Discuss to view users comments. |