Every C program will contain at least one preprocessor directive.
Answer: B
False, the preprocessor directive is not mandatory in any c program.
Enter details here
Will the program compile successfully?
#include
#define X (4+Y)
#define Y (X+3)
int main()
{
printf("%d\n", 4*X+2);
return 0;
}
Answer: B
Reports an error: Undefined symbol 'X'
Enter details here
The following program won’t compile because there’re space between macro name and open parenthesis.
#include "stdio.h"
#define MYINC ( a ) ( ( a ) + 1 )
int main()
{
printf("GeeksQuiz!");
return 0;
}
Answer: B
No answer description available for this question.
Enter details here
The purpose of the preprocessor directive #error is that ____________
Answer: C
#error is a preprocessor directive which causes the preprocessor to report a fatal error. The tokens which form the rest of the line after #error are used as the error message.
Enter details here
Identify the stringizing operator.
Answer: C
No answer description available for this question.
Enter details here
In a program the statement: #include "filename" is replaced by the contents of the file "filename"?
Answer: A
Before compilation is the answer.
Enter details here
Identify the trigraph sequence for .
Answer: A
The trigraph sequence for is ??/
Enter details here
Which of the following are correct preprocessor directives in C?
1. #ifdef
2. #if
3. #elif
4. #undef
Answer: D
No answer description available for this question.
Enter details here
What will be the output of the following C code if the value of ‘p’ is 10 and that of ‘q’ is 15?
#include
int main()
{
int p,q;
printf("Enter two numbers\n");
scanf("%d",&p);
scanf("%d",&q);
#if(4<2>-1)
printf("%d",q);
#else
printf("bye");
#endif
}
Answer: B
The output of the code shown above is 15. The values given for ‘p’ and ‘q’ are 10 and 15 respectively. Since the condition given for #elif is true, the value stored in ‘q’ will be printed, that is 15.
Enter details here
The preprocessor directive which is used to remove the definition of an identifier which was previously defined with #define?
Answer: B
#undef is used to remove the definition of any identifier which had been previously defined in the code with #define.
Enter details here