Operator Overloading - placement practice test

Operator Overloading - placement practice test


1. Which of the following perfect set of operators can’t be overloaded in CPP ?

a. +=, ?, :: , >>
b. >>, <<, ?, *, sizeof()
c. :: , . , .* , ?:
d. :: , ->, * , new, delete
View Answer / Hide Answer

ANSWER: c. :: , . , .* , ?:




2. When overloading unary operators using Friend function, it requires_____ argument/s.

a. Zero
b. One
c. Two
d. None of these.
View Answer / Hide Answer

ANSWER: b. One




3. While overloading binary operators using member function, it requires ___ argument/s.

a. Zero
b. One
c. Two
d. Three
View Answer / Hide Answer

ANSWER: b. One




4. In case of operator overloading, operator function must be______

1. Static member functions
2. Non- static member functions
3. Friend Functions

a. Only 2
b. Only 1, 3
c. Only 2 , 3
d. All 1 , 2, 3
View Answer / Hide Answer

ANSWER: c. Only 2 , 3




5. In operator overloading, the overloaded operators must have at least _____ operand of user-defined type.

a. Zero
b. One
c. Two
d. None of these
View Answer / Hide Answer

ANSWER: b. One




6. An operator function is created using _____________ keyword.

a. iterator
b. allocator
c. constructor
d. operator
View Answer / Hide Answer

ANSWER: d. operator




7. Using friend operator function, following perfect set of operators may not be overloaded.

a. = , ( ) , [ ] , ->
b. <<, = = , [ ] , >>
c. ?, = , ( ) , ++
d. None of these
View Answer / Hide Answer

ANSWER: a. = , ( ) , [ ] , ->




8. In case of binary operator overloading with member function, which of following statement should be taken into consideration?

a. Right hand operand must be object
b. Left hand operand must be object
c. Both the operands must be objects
d. All of these should be considered
View Answer / Hide Answer

ANSWER: b. Left hand operand must be object



Post your comment

    Discussion

  • RE: Operator Overloading - placement practice test -matebie shitaye from jiima university (01/26/15)
  • thank you
  • RE: Operator Overloading - placement practice test -Meghna (08/22/14)
  • Thanuk you

You may like