What will be output if
you will execute following c code?
#include<stdio.h>
int main(){
int i;
for(i=0;i<5;i++){
int i=10;
printf(" %d",i);
i++;
}
return 0;
}
(A)
|
10
11 12 13 14
|
|
(B)
|
10
10 10 10 10
|
|
(C)
|
0 1
2 3 4
|
|
(D)
|
Compilation
error
|
2
What will be output if
you will execute following c code?
#include<stdio.h>
int main(){
register a,b,x;
scanf("%d %d",&a,&b);
x=a+~b;
printf("%d",x);
return 0;
}
(A)
|
0
|
|
(B)
|
It
will be difference of a and b
|
|
(C)
|
It
will be addition of a and b
|
|
(D)
|
Compilation
error
|
3
What will be output if
you will execute following c code?
#include<stdio.h>
auto int a=5;
int main(){
int x;
x=~a+a&a+a<<a;
printf("%d",x);
return 0;
}
(A)
|
5
|
|
(B)
|
0
|
|
(C)
|
153
|
|
(D)
|
Compilation
error
|
4
What will be output if
you will execute following c code?
#include<stdio.h>
int main(){
register int a,b;
int c;
scanf("%d%d",&a,&b);
c=~a + ~b + ++a + b++;
printf(" %d",c);
return 0;
}
//User input is: 1 2
(A)
|
-1
|
|
(B)
|
0
|
|
(C)
|
1
|
|
(D)
|
Compilation
error
|
5
What will be output if
you will execute following c code?
#include<stdio.h>
int main(){
int arr[3]={10,20,30};
int x=0;
x = ++arr[++x] + ++x + arr[--x];
printf("%d ",x);
return 0;
}
(A)
|
22
|
|
(B)
|
23
|
|
(C)
|
43
|
|
(D)
|
44
|
6
What will be output if
you will execute following c code?
#include<stdio.h>
int main(){
int a[]={10,20,30,40};
int i=3,x;
x=1*a[--i]+2*a[--i]+3*a[--i];
printf("%d",x);
return 0;
}
(A)
|
30
|
|
(B)
|
60
|
|
(C)
|
90
|
|
(D)
|
Compilation
error
|
7
What will be output if
you will execute following c code?
#include<stdio.h>
int main(){
static int a[][2][3]={0,1,2,3,4,5,6,7,8,9,10,11,12};
int i=-1;
int d;
d=a[i++][++i][++i];
printf("%d",d);
return 0;
}
(A)
|
9
|
|
(B)
|
10
|
|
(C)
|
11
|
|
(D)
|
Compilation
error
|
8
What will be output if
you will execute following c code?
#include<stdio.h>
int f(int);
int main(){
int i=3,val;
val=sizeof (f(i)+ +f(i=1)+ +f(i-1));
printf("%d %d",val,i);
return 0;
}
int f(int num){
return num*5;
}
(A)
|
2 3
|
|
(B)
|
4 3
|
|
(C)
|
3 2
|
|
(D)
|
Compilation
error
|
9
What will be output if
you will execute following c code?
#include<stdio.h>
int main(){
int x,a=3;
x=+ +a+ + +a+ + +5;
printf("%d %d",x,a);
return 0;
}
(A)
|
10 3
|
|
(B)
|
11 3
|
|
(C)
|
10 5
|
|
(D)
|
Compilation
error
|
10
What will be output if
you will execute following c code?
#include<stdio.h>
int main(){
int num,i=0;
num=-++i+ ++-i;
printf("%d",num);
return 0;
}
(A)
|
0
|
|
(B)
|
1
|
|
(C)
|
-2
|
|
(D)
|
Compilation
error
|
11
What will be output if
you will execute following c code?
#include<stdio.h>
int main(){
int num,a=5;
num=-a--+ +++a;
printf("%d %d",num,a);
return 0;
}
(A)
|
1 5
|
|
(B)
|
-1 6
|
|
(C)
|
1 6
|
|
(D)
|
0 5
|
12
What will be output if
you will execute following c code?
#include<stdio.h>
int main(){
int num,a=15;
num=- - - -a--;
printf("%d %d",num,a);
return 0;
}
(A)
|
15 14
|
|
(B)
|
14 15
|
|
(C)
|
14 14
|
|
(D)
|
15 15
|
13
What will be output if
you will execute following c code?
#include<stdio.h>
int main(){
int x,a=2;
x=++a,++a,a++;
printf("%d %d",x,a);
return 0;
}
(A)
|
5 5
|
|
(B)
|
3 5
|
|
(C)
|
4 5
|
|
(D)
|
5 4
|
14
What will be output if
you will execute following c code?
#include<stdio.h>
int main(){
int x,i=2;
x=~-!++i;
printf("%d",x);
return 0;
}
(A)
|
-2
|
|
(B)
|
-1
|
|
(C)
|
0
|
|
(D)
|
1
|
15
What will be output if
you will execute following c code?
#include<stdio.h>
int main(){
static double *p,*q,*r,*s,t=5.0;
double **arr[]={&p,&q,&r,&s};
int i;
*p=*q=*r=*s=t;
for(i=0;i<4;i++)
printf("%.0f ",**arr[i]);
return 0;
}
(A)
|
5 5
5 5 5
|
||
(B)
|
5 6
7 8 9
|
||
(C)
|
Infinite
loop
|
||
(D)
|
Run time error
|
16
What will be output if
you will execute following c code?
#include<stdio.h>
int main(){
float x;
x=0.35==3.5/10;
printf("%f",x);
return 0;
}
(A)
|
0.000000
|
|
(B)
|
1.000000
|
|
(C)
|
0.350000
|
|
(D)
|
Compilation
error
|
17
#include<stdio.h>
int main(){
int arr[]={6,12,18,24};
int x=0;
x=arr[1]+(arr[1]=2);
printf("%d",x);
return 0;
}
(A)
|
4
|
|
(B)
|
8
|
|
(C)
|
14
|
|
(D)
|
Compilation
error
|
18
What will be output if
you will execute following c code?
#include<stdio.h>
int sq(int);
int main(){
int a=1,x;
x=sq(++a)+sq(a++)+sq(a++);
printf("%d",x);
return 0;
}
int sq(int num){
return num*num;
}
(A)
|
15
|
|
(B)
|
16
|
|
(C)
|
17
|
|
(D)
|
18
|
19
What will be output if
you will execute following c code?
#include<stdio.h>
int main(){
printf("%c",*"abcde");
return 0;
}
(A)
|
acbcd
|
|
(B)
|
e
|
|
(C)
|
a
|
|
(D)
|
NULL
|
20
What will be output if
you will execute following c code?
#include<stdio.h>
int main(){
printf("%d","abcde"-"abcde");
return 0;
}
(A)
|
0
|
|
(B)
|
-1
|
|
(C)
|
1
|
|
(D)
|
Garbage
|
No comments:
Post a Comment