Question And Answer Section

1. What will be output when you will execute following c code?

  if("ABC") printf("1\n");
  if(-1)    printf("2\n");
  if(6%2)     printf("3\n");
  if('W')   printf("4\n");

2. 
What will be output when you will execute following c code?

    int a=-1,b=3;
    if(++a||++b)
         printf("%d  %d",a,b);
    else
         printf("Waris Shah");

3. What will be output when you will execute following c code?
    if(10001)
      printf("The Pakistan");
      printf("");
    else
      printf("The Lahore");

4. What will be output when you will execute following c code?
    int a=5,b=10;
    if(a++<++a||b++<++b)
         printf("%d  %d",a,b);
    else
         printf("The Pakistan");

5. What will be output when you will execute following c code?
    int x=1,y=2;
    if(--x && --y)
         printf("x=%d  y=%d",x,y);
    else
         printf("%d %d",x,y);


No comments:

Post a Comment

 

Most Reading