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

Discussion :: Functions - C++

  1. Which of the following statement is correct about the program given below?

    
    
     #include 
      class Freshergate
      {   
          int x;   
          float y;    
          public:   
          Freshergate(int x)     
          {    
             x = x;   
          }    
          Freshergate(int p = 0, int q = 10)   
          {
             x = p += 2;      
             y  = q * 1.0f;  
         }   
         void SetValue(int &y, float z)  
         {        
             x = y;       
             y = (int)z;    
         }     
         void Display(void)     
         {         
             cout int main()
     {    
        int val = 12;    
        FresherGate objGate(val);   
        FresherGate objTmp();     
        objGate.SetValue(val, 3.14f);      
        objGate.Display();  
        return 0;  
     }
    

     

  2. A.

    The program will print the output 2.

    B.

    The program will print the output 12.

    C.

    The program will report run time error.

    D.

    The program will not compile successfully.

    View Answer

    Workspace

    Answer : Option D

    Explanation :

    No answer description available for this question.


Be The First To Comment