Would the following typedef work? typedef #include l;
A:
Yes
B:
No
C:
D:
Answer:B
Because typedef goes to work after preprocessing.
Discuss About this Question.
Will the program compile successfully?
#include<stdio.h>
#define X (4+Y)
#define Y (X+3)
int main()
{
printf("%d\n", 4*X+2);
return 0;
}
A:
Yes
B:
No
C:
D:
Answer:B
Reports an error: Undefined symbol 'X'
Discuss About this Question.
Once preprocessing is over and the program is sent for the compilation the macros are removed from the expanded source code.
A:
True
B:
False
C:
D:
Answer:A
True, After preprocessing all the macro in the program are removed.
Discuss About this Question.
A preprocessor directive is a message from compiler to a linker.
A:
True
B:
False
C:
D:
Answer:B
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.
Discuss About this Question.
The preprocessor can trap simple errors like missing declarations, nested comments or mismatch of braces.
A:
True
B:
False
C:
D:
Answer:B
False, the preprocessor cannot trap the errors, it only replaces the macro with the given expression. But the compiler will detect errors.
Discuss About this Question.
Ad Slot (Above Pagination)
Install ExamAdept
Fast access — add this app to your device.
To install on iPhone/iPad: tap Share → Add to Home Screen.
Discuss About this Question.