C Programming Important Questions and Answers Set - 3
41.What will be output if you will compile and execute the following c code?
#define call(x) #x
void main(){
printf(“%s”,call(c/c++));
}
A.c
B.c++
C.#c/c++
D.c/c++
(e). Compiler error
Answer: D. c/c++
42. What will be output if you will compile and execute the following c code?
#define message “union is
power of c” void main(){
clrscr();
printf(“%s”,message);
getch();
}
A. union is power of c
B. union is power of c
C. union is
Power of c
D. Compiler error
(e) None of these
Answer: B. union is power of c
43. What will be output if you will compile and execute the following c code?
void main(){
int a=25;
clrscr();
printf(“%o %x”,a,A.;
getch();
}
A. 25 25
B. 025 0x25
C. 12 42
D. 31 19
(e) None of these
Answer: D. 31 19
44. What will be output if you will compile and execute the following c code?
void main(){
int i=0;
if(i==0){
i=((5,(i=3)),i=1);
printf(“%d”,i);
}
else
printf(“equal”);
}
A. 5
B. 3
C. 1
D. equal
(e) None of above
Answer: C. 1
45.What will be output if you will compile and execute the following c code?
int extern x;
void main()
printf(“%d”,x);
x=2;
getch();
}
int x=23;
A. 0
B. 2
C. 23
D. Compiler error
E. None of these
Answer: C. 23
46.What will be output if you will compile and execute the following c code?
void main(){
int a,b;
a=1,3,15;
b=(2,4,6);
clrscr();
printf(“%d “,a+B.;
getch();
}
A. 3
B. 21
C. 17
D. 7
E. Compiler error
Answer: D. 7
47.What will be output if you will compile and execute the following c code?
void main(){
static main;
int x;
x=call(main);
clrscr();
printf(“%d “,x);
getch();
}
int call(int address){
address++;
return address;
}
A. 0
B. 1
C. Garbage value
D. Compiler error
E. None of these
Answer: B. 1
48.What will be output if you will compile and execute the following c code?
#include “string.h” void main(){
clrscr();
printf(“%d
%d”,sizeof(“string”),strlen(“string”));
getch();
}
A. 6 6
B. 7 7
C. 6 7
D. 7 6
(e) None of these
Answer: D. 7 6
49.What will be output if you will compile and execute the following c code?
void main(){
int huge*p=(int huge*)0XC0563331;
int huge*q=(int huge*)0xC2551341; *p=200;
printf(“%d”,*q);
}
A.0
B.Garbage value
C. null
D. 200
(e)Compiler error
Answer: D. 200
50.What will be output if you will compile and execute the following c code?
struct marks{
int p:3;
int c:3;
int m:2;
};
void main(){
struct marks s={2,-6,5};
printf(“%d %d %d”,s.p,s.c,s.m);
}
A. 2 -6 5
B. 2 -6 1
C. 2 2 1
D. Compiler error
(e) None of these
Answer: C. 2 2 1