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

Discussion :: Objects and Classes

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

      #include
      #include
      class FresherGate
      {  
         char str[50];  
         char tmp[50];   
         public:    
         FresherGate(char *s)     
         {       
            strcpy(str, s);     
         }     
         int GateFunction()    
         {        
            int i = 0, j = 0;      
            while(*(str + i))       
            {          
                if(*  (str + i++) == ' ')                 
                   *(tmp + j++) = *(str + i);         
              }   
               *(tmp + j) = 0;    
               return strlen(tmp);  
              } 
         };
         int main() 
         {    
           char txt[] = "Welcome to FresherGate.com!";     
           FresherGate objGate(txt);   
           coutreturn 0; 
        }
    

  2. A.

    1

    B.

    2

    C.

    24

    D.

    25

    View Answer

    Workspace

    Answer : Option B

    Explanation :

    No answer description available for this question.


Be The First To Comment