You are on page 1of 2

1. What will be output?

#define double float


#define char c
#define short s
void main() {
double char = 'A';
double *short = NULL;
printf("%u, %.1f, ", sizeof(char), char);
printf("%u, %u\n", sizeof(short), short);
}
Consider 32-bit compiler.
A. 4, 65.0, 4, 0
B. 8, 'A', 4, 0
C. 1, 'A', 2, 0
D. Error
Answer:

2. What will be output?


int main( void ) {
int *a[3];
a = (int*) malloc(sizeof(int)*3);
free(a);
return 0;
}
A. unable to allocate memory
B. compile time error as incompatible types
C. unable to free memory
D. no error
Answer:

3. What will be output?


int main(void) {
enum colors{RED=0,BLUE,GREEN,YELLOW};
enum location{MARKETYARD=-1,HINJAWADI,KARAD,SATARA};
enum colors clr=RED;
enum location lct=HINJAWADI;
printf(clr==lct? "True": "False");
return 0;
}
A. False
B. True
C. Compile time error
D. No output
Answer: B

4. What will be output?


#define print(Y,X) (Y/Y,X*Y)
int main(void) {
printf("%d",print(5,9));
return 0;
}
A. 1
B. 81
C. 45
D. 0
Answer:

5. What will be output?


int main(void) {
char str[] = "PrecatQuiz";
printf("%s %s %sn", &str[5], &5[str], str+5);
printf("%c %c %cn", *(str+6), str[6], 6[str]);
return 0;
}
A. Runtime Error
B. Compiler Error
C. uiz uiz uiz u u u
D. tQuiz tQuiz tQuiz nQ Q Qn
Answer:

You might also like