C Programming Multiple Choice Question - Preprocessor And Macros
This section focuses on the "Preprocessor And Macros" of the C programming. These Multiple Choice Questions (mcq) should be practiced to improve the C programming skills required for various interviews (campus interview, walk-in interview, company interview), placement, entrance exam and other competitive examinations.
1. What is the output of this program?
#include <stdio.h>
#define int char
main()
{
int i=50;
printf ("sizeof (i) =%d", sizeof (i));
}
View Answer
2. What is the output of this program?
#include <stdio.h>
#define x 3
int main()
{
int i;
i = x*x*x;
printf("%d",i);
return 0;
}
View Answer
3. What is the output of this program?
#include <stdio.h>
#include <stdlib.h>
#define square(x) x*x
int main()
{
int i;
i = 27/square(3);
printf("%d",i);
return 0;
}
View Answer
4. What is the output of this program?
#include <stdio.h>
#define i 5
int main()
{
#define i 10
printf("%d",i);
return 0;
}
View Answer
5. What is the output of this program?
#include <stdio.h>
#define clrscr() 17
int main()
{
clrscr();
printf("%d",clrscr());
return 0;
}
View Answer
6. What is the output of this program?
#include <stdio.h>
int main()
{
printf("%d",30);
return 0;
}
View Answer
7. What is the output of this program?
#include <stdio.h>
#define p 17;
int main()
{
printf("%d",p);
return 0;
}
View Answer
8. Which statment is true about the given code ?
#include <stdio.h>
enum colors {lets,find,course};
int main()
{
printf("%d %d %d",course,lets,find);
return 0;
}
View Answer
9. What is the Error of this program?
#include <stdio.h>
#define CONDITION(x)
printf("letsfindcourse");
int main()
{
CONDITION(0);
return 0;
}
View Answer
10. How will you free the memory allocated by the following program?
#include <stdio.h>
#define CONDITION(x)
printf("letsfindcourse");
int main()
{
CONDITION(0);
return 0;
}
View Answer
Also check :