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 AnswerANSWER: 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 Answer3. While overloading binary operators using member function, it requires ___ argument/s.
a. Zero
b. One
c. Two
d. Three
View Answer / Hide Answer4. 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 Answer5. 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 Answer6. An operator function is created using _____________ keyword.
a. iterator
b. allocator
c. constructor
d. operator
View Answer / Hide Answer7. Using friend operator function, following perfect set of operators may not be overloaded.
a. = , ( ) , [ ] , ->
b. <<, = = , [ ] , >>
c. ?, = , ( ) , ++
d. None of these
View Answer / Hide AnswerANSWER: 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 AnswerANSWER: b. Left hand operand must be object