Monday, December 1, 2008

questions with answer in C programming language

1)
struct aaa
{
struct aaa *prev;
int i;
struct aaa *next;
};
main()
{
 struct aaa abc,def,ghi,jkl;
 int x=100;
 abc.i=0;abc.prev=&jkl;
 abc.next=&def;
 def.i=1;def.prev=&abc;def.next=&ghi;
 ghi.i=2;ghi.prev=&def;
 ghi.next=&jkl;
 jkl.i=3;jkl.prev=&ghi;jkl.next=&abc;
 x=abc.next->next->prev->next->i;
 printf("%d",x);
}

Answer:
2

Explanation:
above all statements form a double circular linked list;
abc.next->next->prev->next->i 
this one points to "ghi" node the value of at particular node is 2.


2)
struct point
 {
 int x;
 int y;
 };
struct point origin,*pp;
main()
{
pp=&origin;
printf("origin is(%d%d)\n",(*pp).x,(*pp).y);
printf("origin is (%d%d)\n",pp->x,pp->y);
Answer:
origin is(0,0)
origin is(0,0) 

Explanation:
pp is a pointer to structure. we can access the elements of the structure either with arrow mark or with indirection operator. 
Note: 
Since structure point  is globally declared x & y are initialized as zeroes 
3)
main()
{
 int i=_l_abc(10);
  printf("%d\n",--i);
}
int _l_abc(int i)
{
 return(i++);
}

Answer:
9

Explanation: 
return(i++) it will first return i and then increments. i.e. 10 will be returned.

4)
main()
{
 char *p;
 int *q;
 long *r;
 p=q=r=0;
 p++;
 q++;
 r++;
 printf("%p...%p...%p",p,q,r);
}

Answer:
0001...0002...0004

Explanation:
++ operator  when applied to pointers increments address according to their corresponding data-types.

 5)
main()
{
 char c=' ',x,convert(z);
 getc(c);
 if((c>='a') && (c<='z'))
 x=convert(c);
 printf("%c",x);
}
convert(z)
{
  return z-32;
}

Answer: 
Compiler error

Explanation:
declaration of convert and format of getc() are wrong. 

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