MCQ On Class and Object in C++: Multiple Choice Questions and Answers on Class and Object in C++

MCQ on class and object in C++ with answers and explanations for placement tests and job interviews. This C++ MCQ on class and object is useful for the campus placement for all freshers including Engineering Students, MCA students, Computer and IT Engineers, etc.

Our C++ class and object quiz (C++ class and object multiple Choice Questions ) focuses on all areas of C++ class and object and its concept. We will regularly update the Quiz on the C++ class and object and most interesting thing is that questions come in a random sequence. So every time you will feel new questions.

You may have come across several C++ courses during your search for learning the C++ language. Our team of experts has carefully analyzed some C++ courses for you. You can check the courses, Trial of some courses is free.

 

Guideline of MCQ on class and object in C++:

This MCQ on class and object in C++ is intended for checking your knowledge of C++ class and object. It takes 30 minutes to pass the C++ quiz on class and object. If you don’t finish the C++ class and object quiz within the mentioned time, all the unanswered questions will count as wrong. Every unanswered question will count as wrong. Quiz on class and object in C++ has randomization features that give you a new question set at every attempt.

In this MCQ on class and object in C++, we have also implemented a feature that not allowed the user to see the next question or finish the quiz without attempting the current C++ class and object quiz.

0 votes, 0 avg

You have 30 minutes to take the MCQs on Class and Object in C++

Your time has been Over.


C++ MCQ On Class and Object

C++ MCQ

C++ MCQ On Class and Object

C++ MCQ On Class and Object: Multiple Choice Questions and Answers on C++ Class and Object

1 / 17

Assume that an integer and a pointer each takes 4 bytes. Also, assume that there is no alignment in objects. Predict the output following program.

#include<iostream>
using namespace std;
 
class Test
{
    static int x;
    int *ptr;
    int y;
};
 
int main()
{
    Test t;
    cout << sizeof(t) << " ";
    cout << sizeof(Test *);
}

 

2 / 17

Which of the following is true about the following program

#include <iostream>
class Test
{
public:
    int i;
    void get();
};
void Test::get()
{
    std::cout << "Enter the value of i: ";
    std::cin >> i;
}
Test t;  // Global object
int main()
{
    Test t;  // local object
    t.get();
    std::cout << "value of i in local t: "<<t.i<<'n';
    ::t.get(); 
    std::cout << "value of i in global t: "<<::t.i<<'n';
    return 0;
}

 

3 / 17

Predict the output of following C++ program

#include<iostream>
using namespace std;
  
class Empty {};
  
int main()
{
  cout << sizeof(Empty);
  return 0;
}

 

4 / 17

Which of the following is not correct for virtual function in C++ ?

5 / 17

When one object reference variable is assigned to another object reference variable then

6 / 17

Which of the following cannot be passed to a function in C++ ?

7 / 17

What is the difference between struct and class in C++?

8 / 17

Which of the following is a correct statement?

9 / 17

Which of the following is not a correct statement?

10 / 17

class Test {
int x;
};
int main()
{
Test t;
cout << t.x;
return 0;
}

 

11 / 17

Which of the following is not a member of class?

12 / 17

Which of the following is true?

13 / 17

It is possible to define a class within a class termed as nested class. There are _____ types of nested classes.

14 / 17

Which of the following, in C++, is inherited in a derived class from base class ?

15 / 17

A member function can always access the data in __________ , (in C++).

16 / 17

When a method in a subclass has the same name and type signatures as a method in the superclass, then the method in the subclass _____ the method in the superclass.

17 / 17

Which of the following is not correct (in C++) ?

  1.  Class templates and function templates are instantiated in the same way.
  2. Class templates differ from function templates in the way they are initiated.
  3. Class template is initiated by defining an object using the template argument.
  4. Class templates are generally used for storage classes.

Your score is

The average score is 0%

0%

Recommended Articles for you: