Object Oriented Programming - Object Modelling

21:  

You overload an operator by naming it a

A.

variable

B.

built-in type

C.

function

D.

class

 
 

Option: C

Explanation :

Click on Discuss to view users comments.

Write your comments here:



22:  
Assuming you have properly overloaded the ! operator for a Number class, and that a and b are two members of the Number class, which expression is legal?
A.

!a

B.

b!

C.

a!b

D.

All of these

 
 

Option: A

Explanation :

Click on Discuss to view users comments.

Write your comments here:



23:  
To perform multiple arithmetic operations in a single statement, overloaded operator functions should return
A.

void

B.

a copy of the values passed to them

C.

an object of the class type

D.

address of the function

 
 

Option: C

Explanation :

Click on Discuss to view users comments.

Write your comments here:



24:  
Which of the following is the best function prototype for an overloaded ........... for a Number class?
A.

Number operator-(const Number & num)

B.

Number & operator-(int num)

C.

int Number (operator-())

D.

void operator-(Number & num)

 
 

Option: A

Explanation :

Click on Discuss to view users comments.

Write your comments here:



25:  
The programming language feature that allows the same operation to be carried out differently depending on the object is
A.

polymorphism

B.

inheritance

C.

allocation

D.

mangling

 
 

Option: A

Explanation :

Click on Discuss to view users comments.

Write your comments here: