Question 1 of 25
Hints left: 3
Q1
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)); }
Q2
In the directive #pragma pack(n), if the value of 'n' is given to be 5, then what happens?
Q3
What will be the output of the program? #include<stdio.h> #define int char void main() { int i = 65; printf("sizeof(i)=%d", sizeof(i)); }
Q4
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 }
Q5
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)); }
Q6
The output of the following program is: #define f(g,g2) g##g2 void main() { int var12=100; printf("%d", f(var,12)); }
Q7
In C, what is the purpose of the #line directive?
Q8
Determine output: #include<stdio.h> #define clrscr() 100 void main() { clrscr(); printf("%dn", clrscr()); }
Q9
Choose the correct statement. I. The scope of a macro definition need not be the entire program. II. The scope of a macro definition extends from the point of definition to the end of the file. III. New line is a macro definition delimiter. IV. A macro definition may go beyond a line.
Q10
Find the output of the following program. #define INC(X) X++ void main() { int x=4; printf("%d", INC(x++)); }
Q11
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); }
Q12
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 }
Q13
In which stage the following code #include<stdio.h> gets replaced by the contents of the file stdio.h
Q14
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++); }
Q15
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"); }
Q16
What will be the output of the following program? #include<stdio.h> #define square(x) x*x void main() { int i; i = 64/square(4); printf("%d", i); }
Q17
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); }
Q18
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; }
Q19
What is the result of the #pragma warning directive in C preprocessing?
Q20
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); }
Q21
What will be the output of the program code? #include<stdio.h> #define a 10 void main() { #define a 50 printf("%d", a); }
Q23
What will be the output of the following C code? #define display(text) "$" #text main() { printf(display(hello world)); }
Q24
. . . . . . . . is the preprocessor directive which is used to end the scope of #ifdef.
Q25
A preprocessor command