1What will be output if you will execute following c code? #include int main(){
ID: 3538381 • Letter: 1
Question
1What will be output if you will execute following c code?
#include
int main(){
int i;
for(i=0;i<5;i++){ o:p="">
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
2What will be output if you will execute following c code?
#include
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
3What will be output if you will execute following c code?
#include
auto int a=5;
int main(){
int x;
x=~a+a&a+a<;>
printf("%d",x);
return 0;
}
(A)5 (B)0 (C)153 (D)Compilation error
4What will be output if you will execute following c code?
#include
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
5What will be output if you will execute following c code?
#include
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
6What will be output if you will execute following c code?
#include
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
7What will be output if you will execute following c code?
#include
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
8What will be output if you will execute following c code?
#include
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
Explanation / Answer
1)d
2)a
3)b
4)a
5)a
6)d
7)b
8)b
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.