1. Find the output for the following C program
#include <stdio.h>
  void main()
   {
    char *p1="Name";
    char *p2;
    p2=(char *)malloc(20);
    while(*p2++=*p1++);
    printf("%sn",p2);
  }

2. Find the output for the following C program
  #include <stdio.h>
void main()
  {
    int x=20,y=35;
    x = y++ + x++;
    y = ++y + ++x;
    printf("%d %dn",x,y);
  }

3. Find the output for the following C program
#include <stdio.h>
void main()
 {
    int x=5;
    printf(”%d %d %dn”,x,x< <2,x>>2);
}

4. Find the output for the following C program
  #define swap1(a,b) a=a+b;b=a-b;a=a-b;
  void main()
  {
    int x=5,y=10;
    swap1(x,y);
    printf("%d %dn",x,y);
    swap2(x,y);
  printf("%d %dn",x,y);
}
int swap2(int a,int b)
  {
    int temp;
    temp=a;
    b=a;
    a=temp;
    return;
  }

5. Find the output for the following C program
#include <stdio.h>
void main()
  {
    char *ptr="Ramco Systems";
    (*ptr)++;
  printf("%sn",ptr);
  ptr++;
  printf(”%sn”,ptr);
}

6. Find the output for the following C program
  #include <stdio.h>
  void main()
  {
    char s1[]="Ramco";
    char s2[]=”Systems”;
    s1=s2;
    printf("%s",s1);
  }

7. Find the output for the following C program
  #include <stdio.h>
  void main()
  {
    char *p1;
    char *p2;
    p1=(char *) malloc(25);
    p2=(char *) malloc(25);
    strcpy(p1,"Ramco");
    strcpy(p2,"Systems");
    strcat(p1,p2);
    printf("%s",p1);
  }

8.While loop is executed in following C program
    #define TRUE 0
  some code
  while(TRUE)
  {
      some code
    }

9.Find the output for the following C program
  #include <stdio.h>
  void main()
  {
    int x=10;
    x++;
    change_value(x);
    x++;
    Modify_value();
    printf("First output: %d\nn",x);
    x++;
    change_value(x);
    printf("Second Output : %d\n",x);
    Modify_value(x);
    printf("Third Output : %d\n",x);
  }
Modify_value()
{
    return (x+=10);
  }
change_value()
{
    return(x+=1);
}

10. Find the output for the following C program
  #include <stdio.h>
  void main()
  {
    int x=10,y=15;
    x=x++;
    y=++y;
    printf("%d %dn",x,y);
  }

11. Find the output for the following C program
  #include <stdio.h>
void main()
  {
  int a=0;
  if(a=0)
    printf("Ramco Systems\n");
  printf("Ramco Systemsn");
}

12. Find the output for the following C program
  #include <stdio.h>
   int SumElement(int*,int);
   void main(void)
   {
      int x[10];
      int i=10;
      for(;i;)
      {
           i-–;
           *(x+i)=i;
      }
      printf("%d",SumElement(x,10));
   }
  int SumElement(int array[],int size)
  {
     int i=0;
     float sum=0;
     for(;i<size;)
       sum+=array[i++];
      return sum;
  }

13. Find the output for the following C program
   #include <stdio.h>
   void main(void)
   {
      int i=100,j=10,k=20;
      int sum;
      float avg;
      char myformat[]="avg=%.2f";
      sum=i+j+k;
     avg=sum/3.0;
     printf(myformat,avg);
  }

14. Find the output for the following C program
   #include <stdio.h>
   void main(void);
  {
     int a[10];
      printf("%d",((a+9) + (a+1)));
  }

15. Find the output for the following C program
   #include <stdio.h>
   void main(void)
   {
      struct s
      {
         int x;
         float y;
     }s1={25,45.00};
      union u
      {
         int x;
         float y;
      }u1;
      u1=(union u)s1;
      printf("%d and %f",u1.x,u1.y);
   }

16. Find the output for the following C program
   #include <stdio.h>
   void main(void)
   {
      unsigned int c;
      unsigned x=0×3;
      scanf("%u",&c);
      switch(c&x)
      {
         case 3: printf("Hello!t");
         case 2: printf("Welcomet");
         case 1: printf("To Allt");
         default:printf("\n");
      }
   }

17. Find the output for the following C program
   #include <stdio.h>
   int fn(void);
     void print(int,int(*)());
   int i=10;
  void main(void)
  {
     int i=20;
     print(i,fn);
  }
   void print(int i,int (*fn1)())
    {
      printf("%d\n",(*fn1)());
   }
  int fn(void)
  {
     return(i-=5);
  }

18. Find the output for the following C program
   #include <stdio.h>
   void main(void);
   {
      char numbers[5][6]={"Zero","One","Two","Three","Four"};
     printf("%s is %c",&numbers[4][0],numbers[0][0]);
  }

19. Find the output for the following C program
   int bags[5]={20,5,20,3,20};
   void main(void)
   {
     int pos=5,*next();
      *next()=pos;
      printf("%d %d %d",pos,*next(),bags[0]);
  }
   int *next()
   {
      int i;
      for(i=0;i<5;i++)
      if (bags[i]==20)
      return(bags+i);
      printf("Error!");
      exit(0);
  }
                                                                                                                                    Continue>>