Objects and Pointers Mcqs

Our collections of Multiple choice questions and answers focuses on study of Objects and Pointers 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 Pointers in OOP comprehensively.

1.
Passing object to a function _______________

Can be done only in one way

Can be done in more than one ways

Is not possible

Is not possible in OOP

2.
The object ________________

Can be passed by reference

Can be passed by value

Can be passed by reference or value

Can be passed with reference

4.
If object is passed by value, ________________

Copy constructor is used to copy the values into another object in the function

Copy constructor is used to copy the values into temporary object

Reference to the object is used to access the values of the object

Reference to the object is used to created new object in its place

5.
Pass by reference of an object to a function _______________

Affects the object in called function only

Affects the object in prototype only

Affects the object in caller function

Affects the object only if mentioned with & symbol with every call

6.
Copy constructor definition requires __________________

Object to be passed by value

Object not to be passed to it

Object to be passed by reference

Object to be passed with each data member value

8.
If an object is passed by value, _________________

Temporary object is used in the function

Local object in the function is used

Only the data member values are used

The values are accessible from the original object

9.
Can data members be passed to a function using the object?

Yes, it can be passed only inside class functions

Yes, only if the data members are public and are being passed to a function outside the class

No, can’t be passed outside the class

No, can’t be done

10.
What exactly is passed when an object is passed by reference?

The original object name

The original object class name

The exact address of the object in memory

The exact address of data members

11.
If the object is not to be passed to any function but the values of the object have to be used then:

The data members should be passed separately

The data members and member functions have to be passed separately

The values should be present in other variables

The object must be passed

12.
What will be the output if all necessary code is included (Header files and main function)?
void test (Object &y)
{
    y = "It is a string";
}
void main()
{
 Object x = null;
 test (x);
 System.out.println (x);
}

Run time error

Compile time error

Null

It is a string

13.
In which type is new memory location will be allocated?

Only in pass by reference

Only in pass by value

Both in pass by reference and value

Depends on the code

14.
In which of the following way(s) can the object be returned from a function?

Can only be returned by value

Can only be returned by reference

Can be returned either by value or reference

Can neither be returned by value nor by reference

15.
Whenever an object is returned by value ____________________

A temporary object is created

Temporary object is not created

Temporary object may or may not be created

New permanent object is created

0Shares
0
Scroll to Top