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
Congratulations - you have completed C Objective Interview Questions. You scored %%SCORE%% out of %%TOTAL%%. Your performance has been rated as %%RATING%%
Your answers are highlighted below.
Question 1 |
What's the output of the following code
#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 |
Output of following code will be.
int main(){
char c='A';
printf("%d",c);
}
A | |
65 | |
Both | |
None |
Question 3 |
Choose the correct answer.
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 |
Once you are finished, click the button below. Any items you have not completed will be marked incorrect.
There are 5 questions to complete.
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.