Top

C Preprocessor

31.

#include 
#define a 10
int main()
{
  printf("%d ",a);
 
  #define a 50
 
  printf("%d ",a);
  return 0;
}

 

Answer: B

No answer description available for this question.

Enter details here

32.

What is the output of this program?

#include 
int main()
{
  printf("%d",30);
  return 0;
}

 

Answer: C

No answer description available for this question.

Enter details here

33.

In a macro call the control is passed to the macro.

Answer: B

False, Always the macro is substituted by the given text/expression.

Enter details here

34.

Will the following program print the message infinite number of times?

#include
#define INFINITELOOP while(1)

int main()
{
    INFINITELOOP
    printf("IndiaBIX");
    return 0;
}

 

Answer: A

No answer description available for this question.

Enter details here

35.

What will be the output of the program?

#include
#define FUN(i, j) i##j

int main()
{
    int va1=10;
    int va12=20;
    printf("%d\n", FUN(va1, 2));
    return 0;
}

 

Answer: B

No answer description available for this question.

Enter details here

36.

Preprocessor directive #ifdef .. #else ... #endif is used for conditional compilation.

Answer: A

No answer description available for this question.

Enter details here

37.

A preprocessor directive is a message from compiler to a linker.

Answer: B

No answer description available for this question.

Enter details here

38.

What will be the output of the following C code?

#include
#define hello 
main()
{
    #ifdef hello
    #define hi 4
    #else
    #define hi 5
    #endif
    printf("%d",hi);
 
}

 

Answer: A

The code shown above illustrates #define, #ifdef, #else, #endif. Since the identifier hello is defined (condition of #if is true), another identifier names hi is defined and it’s value is 4. If hello was not defined, then the value of hi would be 5.

Enter details here

39.

In which stage the following code

#include

gets replaced by the contents of the file stdio.h

Answer: D

The preprocessor replaces the line #include  with the system header file of that name. More precisely, the entire text of the file 'stdio.h' replaces the #include directive.

Enter details here

40.

What will be the output of the following C code?

#include
#define hello 10
void main()
{
    printf("%d",hello);
    #undef hello
    printf("%d",hello);
}

 

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