C Preprocessor MCQs

93 questionsC-ProgramPage 5 of 11

Practice free C Preprocessor multiple-choice questions with instant answer feedback and step-by-step solutions. Click an option to check yourself, reveal the full explanation, and work through all 93 questions — no login required.

Question 37easy
Determine output:
#include<stdio.h>
#define clrscr() 100
void main()
{
      clrscr();
      printf("%dn", clrscr());
}
Question 38easy
What will be the output of the following program?
#include<stdio.h>
#define prod(a,b)  a*b
void main()
{
      int x=3,y=4;
      printf("%d", prod(x+2,y-1));
}
Question 39medium
In which stage the following code #include gets replaced by the contents of the file stdio.h
Advertisement
Question 40easy
What will be output if you will compile and execute the following c code?
#include<stdio.h>
#define max 5
void main(){
    int i = 0;
    i = max++;
    printf("%d", i++);
}
Question 41easy
What will be output after executing following code?
#include<stdio.h>
# define a 10
void main()
{
    printf("%d..", a);
    foo();
    printf("%d", a);
}
void foo()
{
   #undef a
   #define a 50
}
Question 42easy
The output of the following program is:
#define f(g,g2) g##g2
void main()
{
   int var12=100;
   printf("%d", f(var,12));
}
Advertisement
Question 43easy
Find the output of the following program.
#define INC(X) X++
void main()
{
   int x=4;
   printf("%d", INC(x++));
}
Question 44easy
What will be the output of the following C code?
#include<stdio.h>
#define max 20
main()
{
    #ifndef max
    #define min 10
    #else
    #define min 30
    #endif
    printf("%d",min);
}
Question 45easy
What will be the output of the following C code?
#define display(text) "$" #text
main()
{
    printf(display(hello	   world));
}