Top

C Preprocessor

81.

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

82.

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

83.

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

84.

The following line in a program # represents

Answer: B

No answer description available for this question.

Enter details here

85.

Identify the trigraph sequence for^.

Answer: C

 

The trigraph sequence for ^ is ??

Enter details here

86.

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

87.

The C-preprocessors are specified with _________symbol.

Answer: A

No answer description available for this question.

Enter details here

88.

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

89.

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

90.

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

Loading…
Tags: C Preprocessor Questions and Answers || C Preprocessor MCQ Questions and Answers || C Preprocessor GK Questions and Answers || C Preprocessor GK MCQ Questions || C Preprocessor Multiple Choice Questions and Answers || C Preprocessor GK || GK on C Preprocessor || C Programming Questions and Answers || C Programming MCQ Questions and Answers || C Programming GK Questions and Answers || GK on C Programming