C Programming MCQ - Operators & Expressions

16:  

 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.

Write your comments here:



17:  

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.

Write your comments here:



18:  

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.

Write your comments here:



19:  

The expression 4 + 6 / 3 * 2 - 2 + 7 % 3 evaluates to

A.

3

B.

4

C.

6

D.

7

 
 

Option: D

Explanation :

Click on Discuss to view users comments.

Write your comments here:



20:  

Choose the correct statements

A.

address operator cannot be applied to register variables

B.

misuse of register declaration will increase the execution time 

C.

Both (a) & (b)

D.

none of above

 
 

Option: C

Explanation :

Click on Discuss to view users comments.

Write your comments here: