C Output Questions

  1. Find Error/Output in follwing code:
  2.                             
    int main()
    
    {
      int x = 7538;
      printf("%d %dn", x % 100, x / 10);
    }
    1. 38 753
    2. 75 538
    3. 538 38
    4. 0 753
Answer :
A
Explanation:
Added By : Shashank

  1. Find Error/Output in follwing code:
  2.                             
    int main ()
    
    {
      int x = 20, y = 35;
      x = y++ + x++;
      y = ++y + ++x;
      printf ("%d %d n", x, y);
    }
    1. 55 92
    2. 56 93
    3. 57 94
    4. None of the above
Answer :
B
Explanation:
Added By : Nikhil


  1. Find Error/Output in follwing code:
  2.                             
    void fn()
    
    {
      static int i = 10;
      printf("%d ", ++i);
    }
    int main()
    {
      fn();
      fn();
    }
    1. 10 10
    2. 11 11
    3. 11 12
    4. 12 12
Answer :
C
Explanation:
Added By : Rajiv

  1. Find Error/Output in follwing code:
  2.                             
    int main ()
    
    {
      int x = 24, y = 39, z = 45;
      z = x + y;
      y = z - y;
      x = z - y;
      printf ("n%d %d %d", x, y, z);
    }
    1. 24 39 63
    2. 39 24 63
    3. 24 39 45
    4. 39 24 45
Answer :
B
Explanation:
Added By : Akhil

  1. Find Error/Output in follwing code:
  2.                             
    int main ()
    
    {
      int check = 2;
      switch (check)
        {
        case 1:
          printf ("D.W.Steyn");
        case 2:
          printf (" M.G.Johnson");
        case 3:
          printf (" Mohammad Asif");
        default:
          printf (" M.Muralidaran");
        }
      return 0;
    }
    1. D.W.Steyn
    2. D.W.Steyn M.G.Johnson
    3. M.G.Johnson
    4. M.G.Johnson Mohammad Asif M.Muralidaran
Answer :
D
Explanation:
Added By : Abhilasha

  1. Find Error/Output in follwing code:
  2.                             
    int main ()
    
    {
      int a = 5;
      float b;
      printf ("%d", sizeof (++a + b));
      printf (" %d", a);
      return 0;
    }
    1. 6 5
    2. 5 6
    3. 4 5
    4. 5 4
Answer :
C
Explanation:
Added By : Shiva


  1. Find Error/Output in follwing code:
  2.                             
    int main() {
    
      int m = -10, n = 20;
      n = (m < 0) ? 0 : 1;
      printf("%d %d", m, n);
    }
    1. -10 0
    2. 10 20
    3. 20 -10
    4. 0 1
Answer :
A
Explanation:
Added By : Vijay

  1. Find Error/Output in follwing code:
  2.                             
    int main() {
    
      int i=0;
      for(;;) 
        printf("%d",i); 
      return 0;

    1. 0 times
    2. Infinite times
    3. 10 times
    4. 1 times
Answer :
B
Explanation:
Added By : Pankaj

Social Sharing
Search