C Preprocessor Always A
C Preprocessor Always A
) 1
((CORRECT_CHOICE)) (A/B/C/D) D
((CORRECT_CHOICE)) (A/B/C/D) C
((OPTION_A)) macro
((OPTION_B)) define
((OPTION_C)) #define
((CORRECT_CHOICE)) (A/B/C/D) C
((CORRECT_CHOICE)) (A/B/C/D) A
((OPTION_A)) I and II
((CORRECT_CHOICE)) (A/B/C/D) D
((OPTION_A)) #pragma
((OPTION_B)) #error
((OPTION_C)) #ifndef
((OPTION_D)) #elseif
((CORRECT_CHOICE)) (A/B/C/D) D
((QUESTION)) #include<stdio.h>
#define square(x) x*x
void main()
{
int i;
i = 64/square(4);
printf("%d", i);
}
((OPTION_A)) 4
((OPTION_B)) 64
((OPTION_C)) 16
((CORRECT_CHOICE)) (A/B/C/D) B
((QUESTION)) #include<stdio.h>
#define a 10
void main()
{
#define a 50
printf("%d", a);
}
Guess the output?
((OPTION_A)) 50
((OPTION_B)) 10
((CORRECT_CHOICE)) (A/B/C/D) A
int main(void) {
// your code goes here
int x=3,y=4;
printf("%d", prod(x+2,y-1));
return 0;
}
Guess the output??
((OPTION_A)) 10
((OPTION_B)) 15
((OPTION_C)) 12
((OPTION_D)) 11
((CORRECT_CHOICE)) (A/B/C/D) A
#include <stdio.h>
#define max 5
int main(void) {
// your code goes here
int i = 0;
i = max++;
printf("%d", i++);
return 0;
}
((OPTION_A)) 5
((OPTION_B)) 6
((OPTION_C)) 7
((OPTION_D)) Error
((CORRECT_CHOICE)) (A/B/C/D) D
#define x 10 * 10
#include <stdio.h>
int main()
{
int a = x + x;
printf("%d",a);
return 0;
}
((OPTION_A)) 20
((OPTION_B)) 10
((OPTION_C)) 100
((OPTION_D)) 200
((CORRECT_CHOICE)) (A/B/C/D) D
#define x 10 + 5
#include <stdio.h>
int main()
{
int a = x * x;
printf("%d",a);
return 0;
}
((OPTION_A)) 225
((OPTION_B)) 65
((OPTION_C)) 85
((OPTION_D)) 155
((CORRECT_CHOICE)) (A/B/C/D) B
#include <stdio.h>
#define x 10
int main(void) {
// your code goes here
x = 20;
printf("%d", x);
return 0;
}
((OPTION_A)) 20
((OPTION_B)) 10
((OPTION_C)) 0
((CORRECT_CHOICE)) (A/B/C/D) D
int main(void) {
// your code goes here
x++;
printf("%d", x);
return 0;
}
((OPTION_A)) 10
((OPTION_B)) 11
((CORRECT_CHOICE)) (A/B/C/D) D
#define x 10
#define x 20
#include <stdio.h>
int main()
{
printf("%d", x);
return 0;
}
((OPTION_A)) 10
((OPTION_B)) 20
((OPTION_C)) 0
((OPTION_D)) Error
((CORRECT_CHOICE)) (A/B/C/D) D
int main()
{
printf("%d", x);
return 0;
}
((OPTION_A)) 10
((OPTION_B)) 20
((OPTION_C)) 0
((OPTION_D)) Error
((CORRECT_CHOICE)) (A/B/C/D) D
((EXPLANATION)) (OPTIONAL) Macro definition does not require semicolon at the end
((MARKS)) (1/2/3...) 1
#define x 10
int main()
{
printf("%d %c", x);
return 0;
}
((OPTION_A)) 10 ‘\0’
((OPTION_B)) 10
((OPTION_D)) Error
((CORRECT_CHOICE)) (A/B/C/D) C
((EXPLANATION)) (OPTIONAL) Value of x will be used and for char value garbage will be
displayed
((MARKS)) (1/2/3...) 1
((QUESTION)) #define x 65
int main()
{
printf("%d %c", x, x);
return 0;
}
Guess the output?
((OPTION_A)) 65
((OPTION_B)) 65 65
((OPTION_C)) 65 a
((OPTION_D)) 65 A
((CORRECT_CHOICE)) (A/B/C/D) D
((QUESTION)) Output??
#define x 65
int main()
{
printf("%d", x+5+x/5);
return 0;
}
((OPTION_A)) 27
((OPTION_B)) 79
((OPTION_C)) 83
((OPTION_D)) 0
((CORRECT_CHOICE)) (A/B/C/D) C