Objects and Classes Mcqs

Our collections of Multiple choice questions and answers focuses on study of Objects and Classes in OOP. These questions are chosen from a collection of most authoritative and best reference books on OOP. Our aim is to prepare an individual for competitive exams like NTS, Web Developer | IOS Developer | Game Developer | Software House interviews and jobs, University and College entrance exams and various tests and job interviews. One should practice our Mcqs to assimilate Objects and Classes of OOP comprehensively.

If an object is passed by value, ____________________

A new copy of object is created implicitly

The object itself is used

Address of the object is passed

A new object is created with new random values

Pass by address passes the address of object _________ and pass by reference passes the address of the object _________

Explicitly, explicitly

Implicitly, implicitly

Explicitly, Implicitly

Implicitly, explicitly

If an object is passed by reference, the changes made in the function ___________

Are reflected to the main object of caller function too

Are reflected only in local scope of the called function

Are reflected to the copy of the object that is made during pass

Are reflected to caller function object and called function object also

Constructor function is not called when an object is passed to a function, will its destructor be called when its copy is destroyed?

Yes, depending on code

Yes, must be called

No, since no constructor was called

No, since same object gets used

When an object is returned by a function, a _______________ is automatically created to hold the return value.

Temporary object

Virtual object

New object

Data member

Is the destruction of temporary object safe (while returning object)?

Yes, the resources get free to use

Yes, other objects can use the memory space

No, unexpected side effects may occur

No, always gives rise to exceptions

How to overcome the problem arising due to destruction of temporary object?

Overloading insertion operator

Overriding functions can be used

Overloading parenthesis or returning object

Overloading assignment operator and defining copy constructor

What will be the output of the following code?
Class A
 int i; 
 public : A(int n)
  i=n; cout<<”inside constructor ”;
  cout<<”destroying  ”<<i;
 void seti(int n)
 int geti()
  return I;
void t(A ob)
 cout<<”something ”;
int main()
 A a(1);
 cout<<”this is i in main ”;

Inside constructor something destroying 2this is i in main destroying 1

Inside constructor something this is i in main destroying 1

Inside constructor something destroying 2this is i in main

Something destroying 2this is i in main destroying 1

It is necessary to return the object if it was passed by reference to a function.

Yes, since the object must be same in caller function

Yes, since the caller function needs to reflect the changes

No, the changes are made automatically

No, the changes are made explicitly

If an object is passed by address, will be constructor be called?

Yes, to allocate the memory

Yes, to initialize the members

No, values are copied

No, temporary object is created

Is it possible that an object of is passed to a function, and the function also have an object of same name?

No, Duplicate declaration is not allowed

No, 2 objects will be created

Yes, Scopes are different

Yes, life span is different

What is reference to an object?

It is address of an object

It is address of where the variables and methods of object are stored

It is pointer having address of an object

It is address of only variables and not the methods of an object

Scroll to Top