Wednesday, September 17, 2008

Placement Technical C programming Question with answer

1.
int b=10;
  int *p=&b;
  *p++;
  printf("%d",*p);

what is the output?

output:- Garbage value 

2.
 int b=10;
  int *p=&b;
  ++*p;
  printf("%d",*p);

what is the output?

output:- 11

3. main()
{
char *a="hello";
char *b="bye";
char *c="hai";
int x=10,y=100;
c=(x
printf("%s",c);
}
whats the output?

output:-hello

4. main()
{
char *a="hello";
char *b="bye";
char *c="hai";
int x=10,y=100;
c=(x>y)?a:b;
printf("%s",c);
}
whats the output?

output:-
bye

5.
void main()
 {
  int a,b;
  a=sumdig(123);
  b=sumdig(123);
  printf("%d %d",a,b);
  getch();
 }
 int sumdig(int n)
  {
  static int sum;
  int d;
  if(n!=0)
  {
   d=n%10;
   n=(n-d)/10;
   sum=sum+d;
   sumdig(n);
  }

    return sum;
  }
whats the output?

output:-
6  12

No comments:

Post a Comment

Thanks to given comments.......

My Blog List