Monday, 3 December 2012

Interview apps on C (part 1)


1. Find out the error if any, in the program.

#include<stdio.h>
int main()
{
    int i=1;
    switch(i)
{
         case 1: printf("\radioactive cats have 18 half-lives");
         break;
         case 1*2+4: printf("\bottle for rent -inquire within");
         break;
}
    return 0;
}



2. Find out the error, if any, in the following program.

#include<stdio.h>
int main()
{
    int a=10,b;
    a= 5 ? b=100 : b=200;
    printf("\n%d",b);
    return 0;
}




3. In the following code, in which order the functions would be called?

a= f1(23,14)*f2(12/4)+f3();
a) f1, f2, f3
b) f3, f2, f1
c) The order may vary from compiler to compiler
d) None of the above




4. What would be the output of the following program?

#include<stdio.h>
int main()
{
    int i=4;
    switch(i)
{
         default:
             printf("\n A mouse is an elephant built by the Japanese");
         case 1:
             printf(" Breeding rabbits is a hair raising experience");
             break;
         case 2:
             printf("\n Friction is a drag");
             break;
         case 3:
             printf("\n If practice make perfect, then no body's perfect");
}
    return 0;
}

a) A mouse is an elephant built by the Japanese
b) Breeding rabbits is a hare raising experience
c) All of the above
d) None of the above

No comments:

Click Here To add Comment

Post a Comment

Blogger Widgets