C Programming - C Preprocessor

6. 

A macro must always be defined in capital letters.

A. True
B. False

Answer: Option B

Explanation:

FALSE, The macro is case insensitive.


7. 

Macros have a local scope.

A. True
B. False

Answer: Option B

Explanation:

False, The scope of macros is globals and functions. Also the scope of macros is only from the point of definition to the end of the file.


8. 

Every C program will contain at least one preprocessor directive.

A. True
B. False

Answer: Option B

Explanation:

False, the preprocessor directive is not mandatory in any c program.


9. 

Preprocessor directive #ifdef .. #else ... #endif is used for conditional compilation.

A. True
B. False

Answer: Option A

Explanation:

True, these macros are used for conditional operation.


#if <constant-expression>
#elif <constant-expression>
#endif

10. 

Macros with arguments are allowed

A. True
B. False

Answer: Option A

Explanation:

True, A macro may have arguments.

Example: #define CUBE(X)(X*X*X)