Professional Documents
Culture Documents
DEVA10 to get
MAX Discount
Subscription
C Programming
a) Only S1 is true
b) Only S2 is true
c) Both S1 and S2 are true
d) Both S1 and S2 are false
a) 21
b) 31
c) 41
d) 51
3
What is the value of ABC(10)-ABC(9)?:
int ABC(int a){
static int x=10;
if(a<0) return 0;
else
{ x=x-1;
return x + ABC(--a);
}
}
a) 1
b) 0
c) 10
d) 9
4
What is the return value of the function call
ABC(10,10):
int ABC(int a, int b){
if(a==0) return b;
else return ABC(a-1,a+b);
}
a) 45
b) 55
c) 65
d) 75
5
Predict the output of the following program:
int ABC(int x){
return x==0?0:x%10+ABC(x/10) ;
}
void main(void){
printf("%d", ABC(687)-ABC(1024));
}
a) 10
b) 12
c) 14
d) 16
a) x=n(n-1)/2
b) x=n(n+1)/2
c) x=n+1
d) x=n-1;
e) None of the above
7
Predict the output of the following program:
int f(int x){
if (x == 0 || x ==1) return 1;
return f(x-1)+f(x-2);
}
void main(){
printf("%d", f(4));
}
a) 2
b) 4
c) 5
d) 6
a) 2
b) 3
c) 4
d) 5
a) 2
b) 3
c) 4
d) 5