Operator Overloading - C++ (MCQ) questions and answers

1)   While overloading binary operators using member function, it requires ___ argument/s.
- Published on 19 Oct 15

a. Zero
b. One
c. Two
d. Three
Answer  Explanation 

ANSWER: One

Explanation:
No explanation is available for this question!


2)   In case of operator overloading, operator function must be ______ .

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

- Published on 19 Jul 15

a. Only 2
b. Only 1, 3
c. Only 2 , 3
d. All 1 , 2, 3
Answer  Explanation 

ANSWER: Only 2 , 3

Explanation:
No explanation is available for this question!


3)   Scope resolution operator is used______ .
- Published on 19 Jul 15

a. to resolve the scope of global variables only
b. to resolve the scope of functions of the classes only
c. to resolve scope of global variables as well as functions of the classes
d. None of these
Answer  Explanation 

ANSWER: to resolve scope of global variables as well as functions of the classes

Explanation:
No explanation is available for this question!


4)   ___________ header file is used for manipulators.
- Published on 19 Jul 15

a. < iomanipulator.h>
b. < stdiomanip.h>
c. < stdmanip.h>
d. < iomanip.h>
Answer  Explanation 

ANSWER: < iomanip.h>

Explanation:
No explanation is available for this question!


5)   Which of the following is not a casting operator in CPP?
- Published on 19 Jul 15

a. explicit_cast
b. static_cast
c. dynamic_cast
d. reinterpret_cast
Answer  Explanation 

ANSWER: explicit_cast

Explanation:
No explanation is available for this question!


6)   Which of the following manipulator is used for the representing octal equivalent of a given decimal number?
- Published on 19 Jul 15

a. oct
b. setbase(8)
c. tobase(8)
d. both a and b
e. all a, b, c
Answer  Explanation 

ANSWER: both a and b

Explanation:
No explanation is available for this question!


7)   An operator function is created using _____________ keyword.
- Published on 17 Jul 15

a. iterator
b. allocator
c. constructor
d. operator
Answer  Explanation 

ANSWER: operator

Explanation:
No explanation is available for this question!


8)   Using friend operator function, following perfect set of operators may not be overloaded.
- Published on 17 Jul 15

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

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

Explanation:
No explanation is available for this question!


9)   When overloading unary operators using Friend function,it requires_____ argument/s.
- Published on 17 Jul 15

a. Zero
b. One
c. Two
d. None of these.
Answer  Explanation 

ANSWER: One

Explanation:
No explanation is available for this question!


10)   In case of binary operator overloading with member function, which of following statement should be taken into consideration?
- Published on 17 Jul 15

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.
Answer  Explanation 

ANSWER: Left hand operand must be object.

Explanation:
No explanation is available for this question!


1 2