Monday, December 1, 2008

C Language Interview Questions And Answers


1)  
main()
{
 char *p;
 p="Hello";
 printf("%c\n",*&*p);
}

Answer:

Explanation:
* is a dereference operator & is a reference  operator. They can be    applied any number of times provided it is meaningful. Here  p points to  the first character in the string "Hello". *p dereferences it and so its value is H. Again  & references it to an address and * dereferences it to the value H.

2) main()
{
    int i=1;
    while (i<=5)
    {
       printf("%d",i);
       if (i>2)
 goto here;
       i++;
    }
}
fun()
{
   here:
     printf("PP");
}

Answer:
Compiler error: Undefined label 'here' in function main

Explanation:
Labels have functions scope, in other words The scope of the labels is limited to functions . The label 'here' is available in function fun() Hence it is not visible in function main.

3)
main()
{
   static char names[5][20]={"pascal","ada","cobol","fortran","perl"};
    int i;
    char *t;
    t=names[3];
    names[3]=names[4];
    names[4]=t;
    for (i=0;i<=4;i++)
     printf("%s",names[i]);
}

Answer:
Compiler error: Lvalue required in function main

Explanation:
Array names are pointer constants. So it cannot be modified.

4) void main()
{
int i=5;
printf("%d",i++ + ++i);
}

Answer:
Output Cannot be predicted  exactly.

Explanation:
Side effects are involved in the evaluation of   i

5) void main()
{
int i=5;
printf("%d",i+++++i);
}

Answer:
Compiler Error 

Explanation:
The expression i+++++i is parsed as i ++ ++ + i which is an illegal combination of operators. 

ALL PLACEMENT TECHNICAL INTERVIEW QUESTION  BANCK   

1Technical /logical interview questions and solution in C language |2Technical / logical interview questions in C language |3C programming Language Technical Questions And Answers |4C Language Technical Questions And Answers |5C Language Technical Interview Questions And solution |6C Language Technical Interview Questions And Answers |7C Language Interview Questions And Solution |8online Placement Question of c programming languge |9online placement c programming question|10online test of c programming languge|11placement c programming quiz with solution |12c programming quiz with solution |13C programming languge quiz with solution |14C quiz with solution |15C languge quiz with solution  |16C programming quiz with solution |17questions with answer in C programming language|18Technical questions with solution in C programming language  |19Technical questions with answer in C programming language |20placement Question and answer in Simple C Language |21Simple C Language placement Question and answer22Simple C programming Question and answer |23Simple C programming Question and answer |24Simple C Language Question and answer |25c progrmming Interview question with solution  |26Technical placement question with solution in c progrmming |27placement c progrmming Question with Answer  |28c progrmming placement question with solution  |29 placement c progrmming languge question with Answer |30placement c progrmming languge question with solution  |31c progrmming languge placement question with solution  |32c languge placement question with solution |33placement c programming languge problem with solution  |34c programming languge placement problem with solution  |35c language placement problem with solution  |36Placement c languge problem with solution  |37c language problem with answer  |38c language problem with solution  |


No comments:

Post a Comment

Thanks to given comments.......

My Blog List