Home / C++ Programming / References :: Programs

C++ Programming :: References

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

      #include
      enum xyz
      {   
          a, b, c
      }; 
      int main()  
      {    
          int x = a, y = b, z = c;     
          int &p = x, &q = y, &r = z;    
          p = ++x;     
          q = ++y;    
          r = ++c;     
          coutreturn 0;
      }
    

  2. A.

    The program will print the output 1 2 3.

    B.

    The program will print the output 2 3 4.

    C.

    The program will print the output 0 1 2.

    D.

    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 main() 
     {    
          int arr[] = {1, 2 ,3, 4, 5};  
          int &zarr = arr;    
          for(int i = 0; i 4; i++)    
          {         
             arr[i] += arr[i];    
         }   
         for(i = 0; i 4; i++)     
             cout
        return 0; 
     }

  4. A.

    The program will print the output 1 2 3 4 5.

    B.

    The program will print the output 2 4 6 8 10.

    C.

    The program will print the output 1 1 1 1 1.

    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
      struct Gate 
      {   
          short n; 
      }; 
      int main() 
      {  
          Gate b;     
          Gate& rb = b;   
          b.n = 5;   
          cout " " " ";     
          rb.n = 8;  
          cout " " return 0;  
     }
    
    

  6. A.

    It will result in a compile time error.

    B.

    The program will print the output 5 5 5 8.

    C.

    The program will print the output 5 5 8 8.

    D.

    The program will print the output 5 5 5 5.

    View Answer

    Workspace

    Discuss Discuss in Forum


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

    #include  
     enum xyz  
     {   
        a, b, c 
     }; 
     int main()
     {    
         int x = a, y = b, z = c;   
         int &p = x, &q = y, &r = z;    
         p = z;     
         p = ++q;     
         q = ++p;    
         z = ++q + p++;    
         cout" " " " return 0; 
     }
    

     

  8. A.

    2 3 6

    B.

    4 4 7

    C.

    4 5 8

    D.

    3 4 6

    View Answer

    Workspace

    Discuss Discuss in Forum


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

     #include 
     int GateFunction(int m)
     {  
          m *= m;   
          return((10)*(m /= m)); 
     } 
     int main() 
     {   
          int c = 9, *d = &c, e;     
          int &z = e;   
          e = BixFunction(c-- % 3 ? ++*d :(*d *= *d));    
          z = z + e / 10;     
          cout" " return 0;
     }
    

  10. A.

    It will result in a compile time error.

    B.

    The program will print the output 64 9.

    C.

    The program will print the output 64 10.

    D.

    The program will print the output 64 11.

    View Answer

    Workspace

    Discuss Discuss in Forum


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

    #include 
     class Gate
     {   
          int x, y;  
          public:   
          Gate(int x, int y)     
          {         
              this->x = x;     
              this->y = y;     
          }
          void Display()    
         {         
             cout" " int main() 
      {
          int x = 50;  
          int &y = x ;   
          Bix b(y, x);     
          return 0;
      }
    

  12. A.

    The program will print the output 50 50.

    B.

    The program will print the two garbage values.

    C.

    It will result in a compile time error.

    D.

    The program will print nothing.

    View Answer

    Workspace

    Discuss Discuss in Forum


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

    
    
    
    #include 
     classFreshergate
     {     
          int x, y;  
          public:  
          void SetValue(int &xx, int &yy)     
          {     
               x =  xx++;       
               y =  yy;        
               cout" " int main()
     {    
         int x = 10;   
         int &y = x;   
         IndiaBix objBix;     
         objBix.SetValue(x , y);    
         return 0; 
     }
    

  14. A.

    The program will print the output 10 10.

    B.

    The program will print the output 10 11.

    C.

    The program will print the output 11 10.

    D.

    The program will print the output 11 11.

    E.

    It will result in a compile time error.

    View Answer

    Workspace

    Discuss Discuss in Forum


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

    #include
    class IndiaBix
    {
      int x, y;
      public:
      void SetValue(int &a, int &b)
      {
      a = 100;
      x = a;
      y = b;
      Display();
    }
    void Display()
    {
    cout" " } };
    int main()

    {
       int x = 10;
       IndiaBix objBix;
       objBix.SetValue(x, x); 

       return 0;

      }

  16. A.

    The program will print the output 100 10.

    B.

    The program will print the output 100 100.

    C.

    The program will print the output 100 garbage.

    D.

    The program will print two garbage values.

    E.

    It will result in a compile time error.

    View Answer

    Workspace

    Discuss Discuss in Forum


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

    #include 
     class freshegate 
     {    
          int x, y;   
          public:     
          void SetValue(int &xx, int &yy)   
          {        
               x =  xx ++;       
               y  =  yy;         
               Display();     
      }     
      void Display()   
      {      
          cout" " int main() 
     {     
         int x = 10;   
         int &y = x;     
         Freshergate objBix;   
         objgate.SetValue(x , y);     
         return 0; 
     }
    

  18. A.

    The program will print the output 10 10.

    B.

    The program will print the output 10 11.

    C.

    The program will print the output 11 11.

    D.

    The program will print the output 11 10.

    E.

    It will result in a compile time error.

    View Answer

    Workspace

    Discuss Discuss in Forum


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

     #include 
     class FresherGate 
     {   
        int x, y;   
        public: 
        FresherGate(int &xx, int &yy) 
        {       
            x = xx;   
            y = yy;    
            Display();  
        }  
        void Display()   
        {     
            cout" " int main() 
     {   
        int x1 = 10;   
        int &p = x1;  
        int y1 = 20;    
        int &q = y1;     
        FresherGate objBix(p, q);     
        return 0; 
     }
    

  20. A.

    It will result in a compile time error.

    B.

    The program will print the output 10 20.

    C.

    The program will print two garbage values.

    D.

    The program will print the address of variable x1 and y1.

    View Answer

    Workspace

    Discuss Discuss in Forum