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

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

C Programming :: Functions

  1. What will be the output of the program in 16 bit platform (Turbo C under DOS)?

     #include 
     
      int main() 
      {     
         int fun();  
         int i;    
         i = fun();    
         printf("%d\n", i);   
         return 0; 
     } 
     int fun()
     {     _
         AX = 1990;
     } 

     

  2. A.

    Garbage value

    B.

    0 (Zero)

    C.

    1990

    D.

    No output

    View Answer

    Workspace

    Discuss Discuss in Forum


  3. What will be the output of the program?

    #include
     void fun(int*, int*); 
     int main() 
    {   
        int i=5, j=2;    
        fun(&i, &j);    
        printf("%d, %d", i, j);    
        return 0;
     }
     void fun(int *i, int *j) 
     {   
        *i = *i**i;    
        *j = *j**j; 
     } 
    

  4. A.

    5, 2

    B.

    10, 4

    C.

    2, 5

    D.

    25, 4

    View Answer

    Workspace

    Discuss Discuss in Forum


  5. What will be the output of the program?

    #include 
     int i;
     int fun();  
    
     int main() 
     {    
        while(i)     
        {        
            fun();       
            main();    
        }     
        printf("Hello\n");   
        return 0; 
     }
     int fun()
     {    
       printf("Hi");
     } 

     

  6. A.

    Hello

    B.

    Hi Hello

    C.

    No output

    D.

    Infinite loop

    View Answer

    Workspace

    Discuss Discuss in Forum


  7. What will be the output of the program?

    include 
     int reverse(int); 
    
     int main() 
     {   
         int no=5;    
         reverse(no);     
         return 0;
     }
     int reverse(int no)
     {    
        if(no == 0)       
           return 0;    
       else       
           printf("%d,", no);    
      reverse (no--);
     } 
    

     

  8. A.

    Print 5, 4, 3, 2, 1

    B.

    Print 1, 2, 3, 4, 5

    C.

    Print 5, 4, 3, 2, 1, 0

    D.

    Infinite loop

    View Answer

    Workspace

    Discuss Discuss in Forum


  9. What will be the output of the program?

     #include
     void fun(int); 
     typedef int (*pf) (int, int);
     int proc(pf, int, int);  
    
      int main() 
      {   
         int a=3;   
         fun(a);     
         return 0; 
     } 
     void fun(int n) 
     {     
         if(n > 0)    
         {       
            fun(--n);       
            printf("%d,", n);       
            fun(--n);    
       }
     } 
    

     

  10. A.

    0, 2, 1, 0,

    B.

    1, 1, 2, 0,

    C.

    0, 1, 0, 2,

    D.

    0, 1, 2, 0,

    View Answer

    Workspace

    Discuss Discuss in Forum


  11. What will be the output of the program?

    #include
     int sumdig(int); 
     int main()
     {     
        int a, b; 
        a = sumdig(123);   
        b = sumdig(123);   
        printf("%d, %d\n", a, b);    
        return 0; 
    }
    int sumdig(int n)
    {    
       int s, d;    
       if(n!=0)   
       {
           d = n%10;        
           n = n/10;        
           s = d+sumdig(n);   
       }
     else      
          return 0;  
       return s;
    } 
    

     

  12. A.

    4, 4

    B.

    3, 3

    C.

    6, 6

    D.

    12, 12

    View Answer

    Workspace

    Discuss Discuss in Forum


  13. What will be the output of the program?

    #include 
     int main() 
     {    
         void fun(char*);   
         char a[100];     
         a[0] = 'A'; a[1] = 'B';     
         a[2] = 'C'; a[3] = 'D';    
         fun(&a[0]);   
         return 0; 
    } 
    void fun(char *a) 
    {     
        a++;   
        printf("%c", *a);  
        a++;    
       printf("%c", *a);
     } 

     

     

  14. A.

    AB

    B.

    BC

    C.

    CD

    D.

    No output

    View Answer

    Workspace

    Discuss Discuss in Forum


  15. What will be the output of the program?

    #include 
     int main()
     {
         int fun(int);    
         int i = fun(10); 
         printf("%d\n", --i);  
         return 0; 
    }
    int fun(int i) 
    {   
        return (i++); 
    } 

     

  16. A.

    9

    B.

    10

    C.

    11

    D.

    8

    View Answer

    Workspace

    Discuss Discuss in Forum


  17. What will be the output of the program?

    #include
     int check (int, int); 
    
     int main() 
     {   
        int c;   
        c = check(10, 20);    
        printf("c=%d\n", c);    
        return0;
    } 
    int check(int i, int j)
    {    
        int *p, *q;  
        p=&i;     
        q=&j;    
        i>=45 ? return(*p): return(*q); 
    } 
    

  18. A.

    Print 10

    B.

    Print 20

    C.

    Print 1

    D.

    Compile error

    View Answer

    Workspace

    Discuss Discuss in Forum


  19. What will be the output of the program?

    #include 
    
     int main() 
     {    
        int i=1;    
        if(!i)        
           printf("FRESHERGATE,");    
        else    
        { 
          i=0;      
          printf("C-Program");     
          main();   
        }
      return 0;
    
     } 

     

     

  20. A.

    prints "FRESHERGATE, C-Program" infinitely

    B.

    prints "C-Program" infinetly

    C.

    prints "C-Program, FRESHERGATE" infinitely

    D.

    Error: main() should not inside else statement

    View Answer

    Workspace

    Discuss Discuss in Forum