C Objective Tricky Questions for Interview Preparations

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.

Interview Objective Question

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;
}
A
20
B
25
C
0
D
None
Question 2
Output of following code will be.
int main(){
        char c='A';
        printf("%d",c);
}
A
A
B
65
C
Both
D
None
Question 3
Choose the correct answer.
int main()
{
    int a[3]={11,5};
    printf("%d,%d",a[1],a[2]);
    return 0;
}
A
5, 0
B
11,5
C
5,11
D
None
Question 4
int main()
{
    int a=0;
    printf("%d,%d",a++,++a);
    return 0;
}
A
1,2
B
2,1
C
1,1
D
2,2
Question 5
int main()
{
    int a=5,b=6;
    a = a++;
    b = ++b;
    
    printf("%d,%d",a,b);
    return 0;
}

A
7,5
B
5,7
C
7,7
D
5,1
Once you are finished, click the button below. Any items you have not completed will be marked incorrect. Get Results
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.

For reference check the code

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.

Tagged , , . Bookmark the permalink.

About WebRewrite

I am technology lover who loves to keep updated with latest technology. My interest field is Web Development.