MCQs
Unless the header file has taken care to ensure that if already included it doesn't
get included again.
Turbo C, GCC compilers would take care of these problems, generate no error.
Yes, this program will compile and run successfully and prints 20.
The macro #ifdef NOTE evaluates the given expression to 1. If satisfied it executes the
#ifdefblock statements. Here #ifdef condition fails because the Macro NOTE is nowhere declared.
Hence the #else block gets executed, the variable a is declared and assigned a value of 20.
printf("%dn", a); It prints the value of variable a 20.
No, the header files have any kind of extension.
Because typedef goes to work after preprocessing.
Reports an error: Undefined symbol 'X'
True, After preprocessing all the macro in the program are removed.
FALSE
Example: #define symbol replacement
When the preprocessor encounters #define directive, it replaces any occurrence of symbol in
the rest of the code by replacement. This replacement can be an statement or expression or a
block or simple text.
False, the preprocessor cannot trap the errors, it only replaces the macro with the given
expression. But the compiler will detect errors.
True, the header file contains classes, function prototypes, structure declaration, macros.
False, Always the macro is substituted by the given text/expression.