Object Oriented Programming - Object Modelling

36:  
Which of the following is the best prototype to overload the « operator for a Number class?
A.
ostream & « (ostream & out, const Number &num)
B.
friend ostream & operator« (ostream & out, const Number &num);
C.
Number & operator« (ostream & out, const Number & num);
D.
friend ostream operator« (const. Number &num)
 
 

Option: B

Explanation :

Click on Discuss to view users comments.

Write your comments here:



37:  

If an = operator is used with classes, then

A.

must have overloaded

B.

may have overloaded

C.

must not have overloaded

D.

equal cannot be used with classes.

 
 

Option: B

Explanation :

Click on Discuss to view users comments.

Write your comments here:



38:  
If subscript operator has been correctly overloaded for a Number class to accept an integer value, and num is a member of the number class, which of the following statements is correct?
A.

[num]44

B.

num[44]

C.

num = [44]

D.

num 44

 
 

Option: C

Explanation :

Click on Discuss to view users comments.

Write your comments here:



39:  

Which of the following statements is true?

A.

Subscript operator may take only one argument.

B.
Parentheses operator may take only one argument
C.

Subscript operator may take

D.

None of these

 
 

Option: B

Explanation :

Click on Discuss to view users comments.

Write your comments here:



40:  

The » operator

A.

may be overloaded for input .

B.
must be overloaded if there will be input to classes
C.
must be overloaded if the « operator is overloaded.
D.
may be overloaded for input, but not for shifting bits.
 
 

Option: A

Explanation :

Click on Discuss to view users comments.

Write your comments here:



Related MCQ