Right Place For Right PersonTM 
Sponsored Ads
Home Tutorials Articles Forums Source Code Books Certifications Interviews Questions

C Interview Questions And Answers( Objective and Subjective)( NEW )

C Interview Questions And Answers

C Objective Interview Questions And Answers(10)

C Subjective Interview Questions And Answers(100)     

C syntax, semantics and simple programming questions(61)    

C Aptitude Questions(179) Objectives 

C Aptitude Questions

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30

C Aptitude Questions   

Questions 83
# include<stdio.h>
aaa() {
  printf("hi");
 }
bbb(){
 printf("hello");
 }
ccc(){
 printf("bye");
 }
main()
{
  int (*ptr[3])();
  ptr[0]=aaa;
  ptr[1]=bbb;
  ptr[2]=ccc;
  ptr[2]();
}
Answer:
bye

Explanation:
ptr is array of pointers to functions of return type int.ptr[0] is assigned to address of the function aaa. Similarly ptr[1] and ptr[2] for bbb and ccc respectively. ptr[2]() is in effect of writing ccc(), since ptr[2] points to ccc.

Questions 85
 #include<stdio.h>
main()
{
FILE *ptr;
char i;
ptr=fopen("zzz.c","r");
while((i=fgetch(ptr))!=EOF)
printf("%c",i);
}
Answer:
contents of zzz.c followed by an infinite loop 

Explanation:
The condition is checked against EOF, it should be checked against NULL.

Questions 86
main()
{
 int i =0;j=0;
 if(i && j++)
      printf("%d..%d",i++,j);
printf("%d..%d,i,j);
}
Answer:

0..0

Explanation:
The value of i is 0. Since this information is enough to determine the truth value of the boolean expression. So the statement following the if statement is not executed.  The values of i and j remain unchanged and get printed.

Questions 87
  main()
{
 int i;
 i = abc();
 printf("%d",i);
}
abc()
{
 _AX = 1000;
}
Answer:

1000

Explanation:
Normally the return value from the function is through the information from the accumulator. Here _AH is the pseudo global variable denoting the accumulator. Hence, the value of the accumulator is set 1000 so the function returns value 1000.
Questions 88
   int i;
            main(){
int t;
for ( t=4;scanf("%d",&i)-t;printf("%d\n",i))
                  printf("%d--",t--);
                  }
      // If the inputs are 0,1,2,3 find the o/p
Answer:
      4--0

      3--1

       2--2

Explanation:Let us assume some x= scanf("%d",&i)-t the values during execution                   will be,

          t        i       x

          4       0      -4

          3       1      -2

          2       2       0

Questions 89
   main(){
  int a= 0;int b = 20;char x =1;char y =10;
  if(a,b,x,y)
        printf("hello");
 }
Answer:
hello

Explanation:
The comma operator has associatively from left to right. Only the rightmost value is returned and the other values are evaluated and ignored. Thus the value of last variable y is returned to check in if. Since it is a non zero value if becomes true so, "hello" will be printed.

 Questions 90
   main(){
 unsigned int i;
 for(i=1;i>-2;i--)
                  printf("c aptitude");
}
Explanation:
i is an unsigned integer. It is compared with a signed value. Since the both types doesn't match, signed is promoted to unsigned value. The unsigned equivalent of -2 is a huge value so condition becomes false and control comes out of the loop.

Questions 91
In the following pgm add a  stmt in the function  fun such that the address of 'a' gets stored in 'j'.
main(){
  int * j;
  void fun(int **);
  fun(&j);
 }
 void fun(int **k) {
  int a =0;
  /* add a stmt here*/
 }
Answer:

            *k = &a

Explanation:
The argument of the function is a pointer to a pointer.

Questions 92:
What are the following notations of defining functions known as?
  int abc(int a,float b)
                  {
                  /* some code */
 }
ii.    int abc(a,b)
        int a; float b;
                  {
                  /* some code*/
                  }
Answer:

i.  ANSI C notation

ii. Kernighan & Ritche notation

Questions 93
   main()
{
char *p;
p="%d\n";
           p++;
           p++;
           printf(p-2,300);

}

Answer:
      300
Explanation:
The pointer points to % since it is incremented twice and again decremented by 2, it points to '%d\n' and 300 is printed.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30

Contact Us

Interview Questions And Answers
Struts interview questions and answers (Subjective)
500 Java Objective Questions and Answer
Core Java Objective Questions And Answers
Core Java Subjective Questions And Answers
Core Java Interview Questions And Answers
Core Java Interview Questions and Answers (Subjective)
Core Java Interview Questions and Answers( Objective)
50 Servlet interview questions
155 Java Interview Questions
EJB Interview Questions and Answers(Subjective)
R4R,JSP Interview Questions and Answer(Subjective)
R4R,Java Servlets Interview Questions and Answers(Subjective)
Core Java Subjective ,Objective and Interview Questions And Answers
275 Core java interview questions
Java Objective Questions and Answer
Java Architect Interview Questions
Applet Interview Questions and Answers
Core Java example
Servlet Objective Questions And Answers
Servlet Subjective Questions And Answers
Servlet Interview Questions And Answers
JSP Objective Questions And Answers
JSP Subjective Questions And Answers
JSP Interview Questions And Answers

Contact US:

Your Name:


Your Email:

Message:

Comments:

Give Your Comments:


Advertiser PRIVACY POLICY ||User PRIVACY POLICY || R4R Group Srvices