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

Discussion :: Functions - C++

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

       #include
       class TestDrive 
       {    
            int x;    
            public:     
            TestDrive(int xx)    
            {   
               x = xx;  
            }    
            int DriveIt(void); 
      }; 
      int TestDrive::DriveIt(void)
      {    
          static int value = 0;   
          int m;    
          m = x % 2;     
          x = x / 2; 
          if((x / 2)) DriveIt();    
          value = value + m * 10;    
          return value; 
         } 
         int main() 
         {     
            TestDrive TD(1234);  
            cout10     
            return 0; 
        }
    

  2. A.

    300

    B.

    200

    C.

    Garbage value

    D.

    400

    View Answer

    Workspace

    Answer : Option D

    Explanation :

    No answer description available for this question.


Be The First To Comment