1).What will be output of the following c program?
#include // here stdio.h file
int main(){
int a[]={6,7,8,9},i;
compute(a);
for(i=3;i>=0;i--)
printf(“%d”,a[i]);
return 0;
}
compute(int *p){
int i;
for(i=0;i<4;i++){
*p=*p-1;
p++;
}
}
(A) 5 6 7 8
(B) 6 7 8 9
(C) 8 7 6 5
(D) None of these
(E) Compilation error
2).What will be output of the following c program?
#include // here include stdio.h file
int main(){
int a[]={4,5,6,7,8},i,*p;
for(p=a+4,i=2;i<=4;i++)
printf(“%d”,p[-i]);
return 0;
}
(A) 6
(B) 6 5 4
(C) 8 7 6 5 4
(D) 6 7 8
(E) Compilation error
3).What will be output of the following c program?
#include // here include file
int main(){
int a[2][2][3]={{1,2,3,6,7,8},
{5,7,9,3,4,1}
};
printf(“%d”,*(*(*(a+1)+1)+1));
return 0;
}
(A) 5
(B) 3
(C) 4
(D) 6
(E) Compilation error
4).What will be output of the following c program?
#include // here include stdio.h file
int main(){
char str[]="HELLO";
char *p= "HAI";
str="INDIA";
printf("%s",str);
return 0;
}
(A) HELLO
(B) HAI
(C) INDIA
(D) Compilation error
(E) None of these
5).What will be output of the following c program?
#include //here include stdio.h file
int main(){
char * emp name= "raja";
printf("%s",emp name);
return 0;
}
(A) raja
(B) ra
(C) r
(D) Compilation error
(E) None of these
6).What will be output of the following c program?
#include // here include stdio.h file
int main(){
long int new=5l;
printf("%ld",new);
return 0;
}
(A) 5
(B) 51
(C) 0
(D) Compilation error
(E) None of these
7).What will be output of the following c program?
#include //here include stdio.h file
int main(){
long int _=5l;
printf("%ld",_);
return 0;
}
(A) 5
(B) 51
(C) 0
(D) Compilation error
(E) None of these
8).What will be output of the following c program?
#include // here include stdio.h file
int main(){
char * __WORLD__="world";
printf("%s ",__WORLD__);
return 0;
}
(A) world
(B) null
(C) __WORLD__
(D) Compilation error
9).What will be output of the following c program?
#include // here include stdio.h file
int main(){
char * __TIME__="world";
printf("%s ",__TIME__);
return 0;
}
(A) world
(B) null
(C) w
(D) Compilation error
(E) None of these
Answer : D
10).What will be output of the following c program?
#include // here include stdio.h file
int main(){
long int a;
(float)a=6.5;
printf("%f",a);
return 0;
}
(A) 6.5
(B) 6.500000
(C) 7.000000
(D) Compilation error
(E) None of these
Answer : (D)
11).What will be output of the following c program?
#include // here include stdio.h file
int main(){
long int a,b=10;
++a=b++;
printf("%d %d",a,b);
return 0;
}
(A) 10
(B) 0
(C) 11
(D) Compilation error
(E) None of these
Answer : (D)
12).What will be output of the following c program?
#include // here include stdio.h file
int main(){
long int a,b=5;;
~a=++b + ++b + ++b;
printf("%d %d",++a,++b);
return 0;
}
(A) 5
(B) 6
(C) 7
(D) Compilation error
(E) None of these
Answer : (D).
13).What will be output of the following c program?
#include // here include stdio.h file
int main(){
int x;
int y;
x+y=10;
x=3;
printf("%d",y);
return 0;
}
(A) 10
(B) 7
(C) Garbage value
(D) Compilation error
(E) None of these
Answer : (D).
14).What will be output of the following c program?
#include // here include stdio.h file.
int main(){
int x=5;
int y=10;
&x=y;
printf("%d %d",x,y);
return 0;
}
(A) 5 10
(B) 10 5
(C) 10 10
(D) Compilation error
(E) None of these
Answer : (D).
15).What will be output of the following c program?
#include // here include stdio.h file.
int main(){
const a=10;
a=~a;
printf("%d",a);
return 0;
}
(A) 10
(B) -11
(C) 12
(D) Compilation error
(E) None of these
Answer: (D).
16).What will be output of the following c program?
#include // here include stdio.h file.
int main(){
const _=10;
int *p=&_;
printf("%d",*p);
}
(A) 10
(B) 11
(C) Any address
(D) Compilation error
(E) None of these
Answer : (D).
17).What will be output of the following c program?
#include //here include stdio.h file.
int main(){
const int *a=12;
a++;
printf("%d",a);
return 0;
}
(A) 12
(B) 13
(C) 14
(D) Compilation error
(E) None of these
Answer : (D).
18).What will be output of the following c program?
#include // here include stdio.h file.
int main(){
const int *a=(const int * )12;
*a=(const int *)25;
printf("%d",a);
return 0;
}
(A) 12
(B) 25
(C) Any address
(D) Compilation error
(E) None of these
Answer : (D).
19).What will be output of the following c program?
#include // here include stdio.h file.
int main(){
int * const a=(int * const)12;
a=25;
printf("%d",a);
return 0;
}
(A) 12
(B) 25
(C) Any address
(D) Compilation error
(E) None of these
Answer : (D).