logo

CuriousTab

CuriousTab

Discussion


Home C++ Programming Functions See What Others Are Saying!
  • Question
  • What will be the output of the following program?
    #include<iostream.h>
    long CuriousTabFunction(int x, int y = 5, float z = 5)
    {
        return(++x * ++y + (int)++z);
    }
    int main()
    {
        cout<< CuriousTabFunction(20, 10); 
        return 0;
    }


  • Options
  • A. 237
  • B. 242
  • C. 240
  • D. 35
  • E. The program will report error on compilation.

  • Correct Answer
  • 237 


  • More questions

    • 1. A reference is declared using the _____ symbol.

    • Options
    • A. &&
    • B. &
    • C. ||
    • D. !
    • Discuss
    • 2. Which of the following statement is correct about the program given below?
      #include<iostream.h> 
      class CuriousTab
      {
          int x; 
          float y; 
          public:
          void CuriousTabFunction(int = 0, float = 0.00f, char = 'A');
          void CuriousTabFunction(float, int = 10.00, char = 'Z');
          void CuriousTabFunction(char, char, char);
      };
      int main()
      {
          CuriousTab objCuriousTab;
          objCuriousTab.CuriousTabFunction(10 * 1.0, int(56.0)); 
          return 0;
      }
      void CuriousTab::CuriousTabFunction(int xx, float yy, char zz)
      {
          x = xx + int(yy);
          cout<< "x = " << x << endl;
      }
      void CuriousTab::CuriousTabFunction(float xx, int yy, char zz)
      {
          x = zz + zz;
          y = xx + yy;
          cout<< " x = " << x << endl;
      }
      void CuriousTab::CuriousTabFunction(char xx, char yy, char zz)
      {
          x = xx + yy + zz; 
          y = float(xx * 2); 
          cout<< " x = " << x << endl;
      }

    • Options
    • A. The program will print the output x = 65.
    • B. The program will print the output x = 66.
    • C. The program will print the output x = 130.
    • D. The program will print the output x = 180.
    • E. The program will not compile successfully.
    • Discuss
    • 3. Which of the following statement is correct about the program given below?
      #include<iostream.h> 
      class CuriousTab
      {
          int x, y; 
          public:
              CuriousTab()
              {
                  x = 0;
                  y = 0; 
              }
              CuriousTab(int xx, int yy)
              {
                  x = xx;
                  y = yy; 
              }
              CuriousTab(CuriousTab *objB)
              {
                  x = objB->x;
                  y = objB->y; 
              }
              void Display()
              {
                  cout<< x << " " << y;
              }
      };
      int main()
      {
          CuriousTab objCuriousTab( new CuriousTab(20, 40) );
          objCuriousTab.Display();
          return 0; 
      }

    • Options
    • A. The program will print the output 0 0 .
    • B. The program will print the output 20 40 .
    • C. The program will print the output Garbage Garbage .
    • D. The program will report compile time error.
    • Discuss
    • 4. Which of the following statement is correct about the program given below?
      #include<iostream.h> 
      class Tab
      {
          int x, y; 
          public:
          Tab(int x, int y)
          {
              this->x = x;
              this->y = y;
          }
          void Display()
          {
              cout<< x << " " << y;
          }
      };
      int main()
      {
          int x = 50;
          int &y = x ;
          Tab b(y, x);
          return 0; 
      }

    • Options
    • 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.
    • Discuss
    • 5. Which of the following never requires any arguments?

    • Options
    • A. Member function
    • B. Friend function
    • C. Default constructor
    • D. const function
    • Discuss
    • 6. Which of the following statements is correct?

      1. An array of references is acceptable.
      2. We can also create a reference to a reference.

    • Options
    • A. Only 1 is correct.
    • B. Only 2 is correct.
    • C. Both 1 and 2 are correct.
    • D. Both 1 and 2 are incorrect.
    • Discuss
    • 7. Which of the following correctly describes overloading of functions?

    • Options
    • A. Virtual polymorphism
    • B. Transient polymorphism
    • C. Ad-hoc polymorphism
    • D. Pseudo polymorphism
    • Discuss
    • 8. Which of the following are available only in the class hierarchy chain?

    • Options
    • A. Public data members
    • B. Private data members
    • C. Protected data members
    • D. Member functions
    • Discuss
    • 9. To ensure that every object in the array receives a destructor call, always delete memory allocated as an array with operator __________ .

    • Options
    • A. destructor
    • B. delete
    • C. delete[]
    • D. kill[]
    • E. free[]
    • Discuss
    • 10. Which one of the following options is correct?

    • Options
    • A. Friend function can access public data members of the class.
    • B. Friend function can access protected data members of the class.
    • C. Friend function can access private data members of the class.
    • D. All of the above.
    • Discuss


    Comments

    There are no comments.

Enter a new Comment