logo

CuriousTab

CuriousTab

Discussion


Home C++ Programming References See What Others Are Saying!
  • Question
  • Which of the following statement is correct about the program given below?
    #include<iostream.h> 
    class CuriousTab
    {
        int a, b, c; 
        public:
        void SetValue(int x, int y ,int z)
        {
            a = x;
            b = y;
            c = z;
        } 
        void Display()
        {
            cout<< a << " " << b << " " << c;
        } 
    }; 
    int main()
    {
        CuriousTab objCuriousTab;
        int x  = 2;
        int &y = x;
        y = 5;
        objCuriousTab.SetValue(x, ++y, x + y);
        objCuriousTab.Display();
        return 0; 
    }


  • Options
  • 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.

  • Correct Answer
  • The program will print the output 6 6 10. 


  • More questions

    • 1. What will be the output of the following program?
      #include<iostream.h> 
      int main()
      {
          float Amount;
          float Calculate(float P = 5.0, int N = 2, float R = 2.0);
          Amount = Calculate(); 
          cout<< Amount << endl; 
          return 0;
      }
      
      float Calculate(float P, int N, float R)
      {
          int Year = 1;
          float Sum = 1 ;
          Sum = Sum * (1 + P * ++N * R);
          Year =  (int)(Year + Sum);
          return Year; 
      }

    • Options
    • A. 21
    • B. 22
    • C. 31
    • D. 32
    • E. None of these
    • Discuss
    • 2. Which of the following is an abstract data type?

    • Options
    • A. int
    • B. double
    • C. string
    • D. Class
    • Discuss
    • 3. Can a class have virtual destructor?

    • Options
    • A. Yes
    • B. No
    • Discuss
    • 4. Which of the following statement is correct?

    • Options
    • A. A referenced has to be de-referenced to access a value.
    • B. A referenced does not need to be de-referenced to access a value.
    • C. A referenced has to be double de-referenced to access a value.
    • D. Whether a reference should be de-referenced or not depends on the type of the reference.
    • Discuss
    • 5. Which of the following cannot be declared as virtual?

    • Options
    • A. Constructor
    • B. Destructor
    • C. Data Members
    • D. Both A and C
    • Discuss
    • 6. What will be the output of the following program?
      #include<iostream.h> 
      class CuriousTab
      {
          int x; 
          public:
          CuriousTab(int xx, float yy)
          {
              cout<< char(yy);
          } 
      }; 
      int main()
      {
          CuriousTab *p = new CuriousTab(35, 99.50f);
          return 0; 
      }

    • Options
    • A. 99
    • B. ASCII value of 99
    • C. Garbage value
    • D. 99.50
    • Discuss
    • 7. What will be the output of the following program?
      #include<iostream.h> 
      class CuriousTabTeam
      {
          int x, y; 
          public:
          CuriousTabTeam(int xx)
          {
              x = ++xx;
          }
          void Display()
          {
              cout<< --x << " ";
          }
      };
      int main()
      {
          CuriousTabTeam objBT(45);
          objBT.Display();
          int *p = (int*)&objBT;
          *p = 23;
          objBT.Display();
          return 0; 
      }

    • Options
    • A. 45 22
    • B. 46 22
    • C. 45 23
    • D. 46 23
    • Discuss
    • 8. A class's __________ is called when an object is destroyed.

    • Options
    • A. constructor
    • B. destructor
    • C. assignment function
    • D. copy constructor
    • Discuss
    • 9. A constructor that accepts __________ parameters is called the default constructor.

    • Options
    • A. one
    • B. two
    • C. no
    • D. three
    • Discuss
    • 10. Which one of the following is correct about the statements given below?

      1. All function calls are resolved at compile-time in Procedure Oriented Programming.
      2. All function calls are resolved at compile-time in OOPS.

    • Options
    • A. Only II is correct.
    • B. Both I and II are correct.
    • C. Only I is correct.
    • D. Both I and II are incorrect.
    • Discuss


    Comments

    There are no comments.

Enter a new Comment