A PHP Error was encountered

Severity: Warning

Message: A non-numeric value encountered

Filename: controllers/home.php

Line Number: 222

A PHP Error was encountered

Severity: Warning

Message: A non-numeric value encountered

Filename: controllers/home.php

Line Number: 228

Control Instructions - C Programming Questions and Answers
Home / C Programming / Control Instructions :: Find Output of Program

C Programming :: Control Instructions

  1. What will be the output of the program?

     #include
     int main()
     {   
         int i=0;  
         for(; i5; i++);          
               printf("%d", i); 
         return 0; 
      }
    

     

  2. A.

    0, 1, 2, 3, 4, 5

    B.

    5

    C.

    1, 2, 3, 4

    D.

    6

    View Answer

    Workspace

    Discuss Discuss in Forum


  3. What will be the output of the program?

     #include
     int main()
     {     
         char str[]="C-program";  
         int a = 5;  
         printf(a >10?"Ps\n":"%s\n", str);     
         return 0;
     } 
    

  4. A.

    C-program

    B.

    Ps

    C.

    Error

    D.

    None of above

    View Answer

    Workspace

    Discuss Discuss in Forum


  5. What will be the output of the program?

    #include 
     int main() 
     {  
         int a = 500, b = 100, c;      
         if(!a >= 400)   
             b = 300;   
      c = 200;    
       printf("b = %d c = %d\n", b, c);         
       return 0; 
    } 
    

  6. A.

    b = 300 c = 200

    B.

    b = 100 c = garbage

    C.

    b = 300 c = garbage

    D.

    b = 100 c = 200

    View Answer

    Workspace

    Discuss Discuss in Forum


  7. What will be the output of the program?

     #include
     int main()
     {   
        unsigned int i = 65535; /* Assume 2 byte integer*/   
       while(i++ != 0)         
            printf("%d",++i);       
          printf("\n");  
          return 0; } 
    

  8. A.

    Infinite loop

    B.

    0 1 2 ... 65535

    C.

    0 1 2 ... 32767 - 32766 -32765 -1 0

    D.

    No output

    View Answer

    Workspace

    Discuss Discuss in Forum


  9. What will be the output of the program?

    #include
     int main()
     {   
        int x = 3;   
        float y = 3.0;    
        if(x == y)       
           printf("x and y are equal");      
        else     
           printf("x and y are not equal");  
       return 0; 
     } 
    

  10. A.

    x and y are equal

    B.

    x and y are not equal

    C.

    Unpredictable

    D.

    No output

    View Answer

    Workspace

    Discuss Discuss in Forum


  11. What will be the output of the program, if a short int is 2 bytes wide?

     #include
     int main()
     {   
         short int i = 0; 
         for(i5 && i>=-1; ++i; i>0)          
             printf("%u,", i); 
         return 0; 
    } 
    

  12. A.

    1 ... 65535

    B.

    Expression syntax error

    C.

    No output

    D.

    0, 1, 2, 3, 4, 5

    View Answer

    Workspace

    Discuss Discuss in Forum


  13. What will be the output of the program?

    #include
     int main() 
     {   
        char ch;    
        if(ch = printf(""))          
            printf("It matters\n");      
       else     
            printf("It doesn't matters\n");   
       return 0; 
    } 
    

  14. A.

    It matters

    B.

    It doesn't matters

    C.

    matters

    D.

    No output

    View Answer

    Workspace

    Discuss Discuss in Forum


  15. What will be the output of the program?

     #include
     int main() 
     {  
        unsigned int i = 65536; /* Assume 2 byte integer*/   
      while(i != 0)           
          printf("%d",++i);       
      printf("\n");   
      return 0; 
    } 
    

  16. A.

    Infinite loop

    B.

    0 1 2 ... 65535

    C.

    0 1 2 ... 32767 - 32766 -32765 -1 0

    D.

    No output

    View Answer

    Workspace

    Discuss Discuss in Forum


  17. What will be the output of the program?

     #include
     int main()
     {   
        float a = 0.7;   
        if(0.7 > a)         
           printf("Hi\n"); 
        else     
           printf("Hello\n");  
        return 0;
     } 
    

  18. A.

    Hi

    B.

    Hello

    C.

    Hi Hello

    D.

    None of above

    View Answer

    Workspace

    Discuss Discuss in Forum


  19. What will be the output of the program?

     #include 
     int main()
     {   
         int a=0, b=1, c=3;   
         *((a) ? &b : &a) = a ? b : c;     
         printf("%d, %d, %d\n", a, b, c);     
         return 0;
     } 
    

  20. A.

    0, 1, 3

    B.

    1, 2, 3

    C.

    3, 1, 3

    D.

    1, 3, 1

    View Answer

    Workspace

    Discuss Discuss in Forum