Home / C++ Programming / References :: Programs

C++ Programming :: References

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

     #include
      int i, j;  class Freshergate
      {
         public:    
         Freshergate(int x = 0, int y = 0)   
         {        
              i = x;         
              j = x;      
              Display();    
             }     
             void Display()    
             {      
                cout" ";     
                } 
            };
    
       int main() 
       {     
         Freshergate objBix(10, 20);    
          int &s = i;  
          int &z = j;      
          i++;  
          cout" "
          return 0;
      }
    

  2. A.

    The program will print the output 0 11 21.

    B.

    The program will print the output 10 11 11.

    C.

    The program will print the output 10 11 21.

    D.

    The program will print the output 10 11 12.

    E.

    It will result in a compile time error.

    View Answer

    Workspace

    Discuss Discuss in Forum


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

    
      #include
       int x, y; 
       class BixTest 
       {   
           public:    
           BixTest(int xx = 0, int yy = 0)     
           {       
                x = xx;      
                y = yy;       
                Display();      
            }      
            void Display()    
            {        
              cout" " " ";     
                } 
             }; 
    
             int main() 
             {  
             BixTest objBT(10, 20);    
             int „ž = x;     
             int &ry = y;     
             ry = x;     
             rxr= y;     
             coutreturn 0; 
         }
    

  4. A.

    The program will print the output 0 0 10.

    B.

    The program will print the output 10 20 10.

    C.

    The program will print the output 10 20 9.

    D.

    It will result in a compile time error.

    View Answer

    Workspace

    Discuss Discuss in Forum


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

    
      #include
      class FresherGate
      {    
          int a, b, c;  
          public:    
          void SetValue(int x, int y ,int z)  
          {       
              a = x;     
              b = y;    
              c = z;   
          }    
          void Display()   
          {      
              cout" " " "  int main()
       {
          FresherGate objBix;  
          int x  = 2;    
          int &y = x;     
          y = 5;     
          objGate.SetValue(x, ++y, x + y);    
          objGate.Display(); 
          return 0; 
       }
    

  6. A.

    The program will print the output 5 6 10.

    B.

    The program will print the output 6 6 10.

    C.

    The program will print the output 6 6 12.

    D.

    It will result in a compile time error.

    View Answer

    Workspace

    Discuss Discuss in Forum


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

      #include
       class FresherGate
       {     
            int x, y;     
            public:   
            FresherGate(int xx = 0, int yy = 0)  
            {       
                x = xx;    
                y = yy;   
            } 
            void Display() 
            {       
                cout" " operator +(IndiaBix z)   
            {       
                FresherGate objTemp;      
                objTemp.x = x + z.x;     
                objTemp.y = y + z.y;      
                return objTemp;    
            } 
       }; 
       int main() 
       {   
           FresherGate objGate1(90, 80);  
           FresherGate objGate2(10, 20);   
           FresherGate objSum;      
           FresherGate &objRef = objSum;    
           objRef = objGate1 + objGate2;    
           objRef.Display();      
           return 0;  
      }  
    

  8. A.

    It will result in a runtime error.

    B.

    It will result in a compile time error.

    C.

    The program will print the output 9 4.

    D.

    The program will print the output 100 100.

    View Answer

    Workspace

    Discuss Discuss in Forum