These C objective questions test your basic understanding of C language and it’s concept. The questions i included is a short piece of c code, every question has four options, you have to choose the correct answer.
Objective Questions on Recursion
C Objective Interview Questions
Question 1 |
#include <stdio.h>
int main()
{
int a=20;
int b;
b = a;
b=25;
printf("%d",b);
return 0;
}20 | |
25 | |
0 | |
None |
Question 2 |
int main(){
char c='A';
printf("%d",c);
}
A | |
65 | |
Both | |
None |
Question 3 |
int main()
{
int a[3]={11,5};
printf("%d,%d",a[1],a[2]);
return 0;
}
5, 0 | |
11,5 | |
5,11 | |
None |
Question 4 |
int main()
{
int a=0;
printf("%d,%d",a++,++a);
return 0;
}
1,2 | |
2,1 | |
1,1 | |
2,2 |
Question 5 |
int main()
{
int a=5,b=6;
a = a++;
b = ++b;
printf("%d,%d",a,b);
return 0;
}
7,5 | |
5,7 | |
7,7 | |
5,1 |
Explanation
Question 2
Every character has some ASCII value.
printf(“%d”,c);
Here we use %d, so it will print the ASCII value of character.
Question 3
int a[3]={11,5};
So a[0] = 11 , a[1]=5
No value is for a[2] so 0 is assigned.
Question 5
Initially we assign a = 5 and b=6
a = a++;
In post increment,first value is assigned and then it will be incremented so 5 is assigned
b = ++b;
In pre increment, firs value is incremented and then assigned. So 7 is assigned.