Home / C++ Programming / Objects and Classes :: Discussion

Discussion :: Objects and Classes

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

    #include #include 
     class Freshergate
     {   
          static int x;    
          public:   
          Freshergate() 
          {      
             if(x == 1)                 
                exit(0);    
          else         
             x++; 
        }    
        void Display()   
        {       
            cout" ";   
        } 
     };
     int Freshergate::x = 0; 
     int main() 
     {   
        Freshergate objgate1;        
        objgate1.Display();  
        Freshergate objgate2;      
        objgate2.Display();  
        return 0;  }
    
    

  2. A.

    The program will print the output 1 2.

    B.

    The program will print the output 0 1.

    C.

    The program will print the output 1 1.

    D.

    The program will print the output 1.

    E.

    The program will report compile time error.

    View Answer

    Workspace

    Answer : Option D

    Explanation :

    No answer description available for this question.


Be The First To Comment