C Preprocessor MCQs

93 questionsC-ProgramPage 6 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 46easy
What will be the output of the following C code?
#include <stdio.h>
#define Shyam(x)  #x
int main()
{
    int marks=100;
    printf("value of %s is = %d\n",Shyam(marks),marks);
    return 0;
}
Question 47easy
What will be the output of the following C code?
#include<stdio.h>
#define max 100
void main()
{
    #if(max%10)
    printf("Exam");
    #endif
    printf("Veda");
}
Question 48medium
. . . . . . . . is the preprocessor directive which is used to end the scope of #ifdef.
Advertisement
Question 49medium
In the directive #pragma pack(n), if the value of 'n' is given to be 5, then what happens?
Question 50easy
What will be the output of the following C code?
#include<stdio.h>
#define INDIA 1
#define US 2
#define CC US
main()
{
    #if CC==INDIA
    printf("Rupee");
    #elif CC==US
    printf("Dollar");
    #else
    printf("Euro");
    #endif 
}
Question 51hard
What will be the output of the following C code, if it is run on a 32 bit platform?
#include<stdio.h>
#pragma(1)
struct test
{
    int i;
    char j;
};
main()
{
    printf("%d",sizeof(struct test));
}
Advertisement
Question 52easy
What will be the output of the following C code?
#include <stdio.h>
#define p( m ) printf( "t*" #m " = %s", t##m )
char tram[]="tram";
int main()
{
    int x;
    x=p(ram);
}
Question 53easy
What will be the output of the following C code?
#include<stdio.h>
#define sf 10
main()
{
    if(sf==100)
        printf("good");
    else
    {
        printf("bad");
        sf=100;
    }
    printf("%d",sf);
}
Question 54medium
What will be the output of the following C code?
#include<stdio.h>
void main()
{
    #ifndef max
    printf("hello");
    #endif
    printf("hi");
}