Classical

C Programming MCQ - Mixed Bag

41:  

 Consider the following statement.
# define hypotenuse(a, b) sqrt (a * a + b * b ) ;

The macro-call hypotenuse ( a + 2, b + 3) ;

A.

finds the hypotenuse of a triangle with sides a + 2 and b + 3

B.

finds the square root of (a + 2)2 + (b + 3)2

C.

is invalid

D.

finds the square root of 3 * a + 4 * b + 5

 
 

Option: D

Explanation :

The macro call will be expanded as
 sqrt(a + 2 * a + 2 + b + 3 * b +3).
i-e, sqrt(3 * a + 4 * b + 5). Hence the answer.


42:  

The ascending order of precedence of the bit-wise operators &, ^, | is

A.

&, ^, |

B.

^, &, I

C.

|, ^, &

D.

 &, |, ^

 
 

Option: C

Explanation :


43:  

The scope of a macro definition

A.

cannot be beyond the file in which it is defined

B.

may be part of a file

C.

is the entire program

D.

excludes string of characters within double quotes

 
 

Option: D

Explanation :


44:  

Which of the following comments are correct when macro definition includes arguments?

A.

The opening parenthesis should immediately follow the macro name

B.

There should be at least one blank between the macro name and the opening parenthesis

C.

There should be only one blank between the macro name and the opening parenthesis

D.

All the above comments are correct

 
 

Option: A

Explanation :


45:  

 lint is

A.

 a C compiler

B.

an inter-active debugger

C.

a C interpreter

D.

a tool for analyzing a C program

 
 

Option: D

Explanation :




Suggest an improvement