What is the output of this program?
#include
#define clrscr() 17
int main()
{
clrscr();
printf("%d",clrscr());
return 0;
}
Answer: C
Preprocessor in any programming language executes as a seperate pass before the execution of the compiler. So textual replacement of clrscr() to 17 occurs with no errors.
Enter details here
If the file to be included doesn't exist, the preprocessor flashes an error message.
Answer: A
No answer description available for this question.
Enter details here
A preprocessor directive is a message from programmer to the preprocessor.
Answer: A
True, the programmer tells the compiler to include the preprocessor when compiling.
Enter details here
The following line in a program # represents
Answer: B
No answer description available for this question.
Enter details here
Identify the trigraph sequence for^.
Answer: C
The trigraph sequence for ^ is ??
Enter details here
The preprocessor can trap simple errors like missing declarations, nested comments or mismatch of braces.
Answer: B
False, the preprocessor cannot trap the errors, it only replaces the macro with the given expression. But the compiler will detect errors.
Enter details here
The C-preprocessors are specified with _________symbol.
Answer: A
No answer description available for this question.
Enter details here
What is the output for the following code snippet?
#include
#define A -B
#define B -C
#define C 5
int main()
{
printf("The value of A is %dn", A);
return 0;
}
Answer: B
No answer description available for this question.
Enter details here
Macro calls and function calls work exactly similarly.
Answer: B
False, A macro just replaces each occurrence with the code assigned to it. e.g. SQUARE(3) with ((3)*(3)) in the program.
A function is compiled once and can be called from anywhere that has visibility to the funciton.
Enter details here
What will be the output of the program?
#include
#define MAX(a, b, c) (a>b ? a>c ? a : c: b>c ? b : c)
int main()
{
int x;
x = MAX(3+2, 2+7, 3+7);
printf("%d\n", x);
return 0;
}
Answer: C
No answer description available for this question.
Enter details here