C Preprocessor MCQs

93 questionsC-ProgramPage 7 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 55easy
The following C code results in an error.
#include <stdio.h>
#define world( n ) printf( "t^^" #n" = %c", t##n )
int t3=1;
int main()
{
   world(3);
}
Question 56easy
What will be the output of the following C code?
#define F abc
#define B def
#define FB(arg) #arg
#define FB1(arg) FB(arg)
main()
{
    printf(FB(F B));
    FB1(F B);
}
Question 57easy
What will be the output of the following C code?
#include <stdio.h>
#define p( n,m ) printf( "%d", m##n )
int main()
{
   p(3,4);
}
Advertisement
Question 58easy
What will be the output of the following C code?
#define example(s,n) #s #n
main()
{
    printf(example(hello,world));
}
Question 59easy
What will be the output of the following C code?
#include <stdio.h>
#define hello( n ) a##n
int a3;
int main()
{
    int x;
    x=hello(3);
    if(x!=0)
        printf("hi");
    else
        printf("good");
}
Question 60easy
What will be the output of the following C code?
#include<stdio.h>
#define hello 
main()
{
    #ifdef hello
    #define hi 4
    #else
    #define hi 5
    #endif
    printf("%d",hi);
 
}
Advertisement
Question 61easy
What will be the output of the following C code?
#define display(text) printf(#text "@")
main()
{
    display(hello.);
    display(good morning!);
}
Question 62easy
What will be the output of the following C code?
#include <stdio.h>
#define p( n ) printf( "t%%\n" #n " = %d", t##n )
int t3=10;
int main()
{
    int x;
    x=p(3);
}
Question 63easy
What will be the output of the following C code?
#include <stdio.h>
#define p( n,m ) printf( "%d", m##n )
#define q(a,b) printf("%d",a##b)
main()
{
   p(3,4);
   q(5,6);
}