Home / C++ Programming / Functions - C++ :: Discussion

Discussion :: Functions - C++

  1. What will be the output of the following program?

    
     #include 
     struct Freshergate
     {   
         int arr[5];   
         public:    
         void GATEFunction(void);    
         void Display(void);
     }; 
     void Freshergate::Display(void)
     {   
      for(int i = 0; i 5; i++)          
         cout" " ; 
     }
     void Freshergate::GateFunction(void) 
     {   
        static int i = 0, j = 4;   
        int tmp = arr[i];     
        arr[i]  = arr[j];   
        arr[j]  = tmp   ;     
        i++;   
        j--;   
        if(j != i) GateFunction(); 
    } 
    int main() 
    {    
       Freshergate objGate = {{ 5, 6, 3, 9, 0 }};     
       objGate.GateFunction();     
       objGate.Display();  
       return 0;  
    }
    

  2. A.

    0 9 3 6 5

    B.

    9 3 6 5 0

    C.

    5 6 3 9 0

    D.

    5 9 3 6 0

    View Answer

    Workspace

    Answer : Option A

    Explanation :

    No answer description available for this question.


Be The First To Comment