Programming MCQs

Multiple Choice Questions On C++ Operator Overloading

Pinterest LinkedIn Tumblr
Here are the collections of multiple-choice questions on C++ operator overloading, which includes MCQ questions on C++ operators that can overload with providing special meaning to an operator along with the operators that can not be overloaded. It also includes different steps involved in the process of overloading, overloading unary and binary operators, the different rules for overloading operators along with different methods of type conversions in C++.

1) We can overload which of the following C++ operators.
A) Arithmetic operator (+, -, *, /)
B) Class Member Access Operators (., .*)
C) Size operator(sizeof)
D) Conditional operator(?:)

2) ……………… must be either non-static member function or friend functions.
A) member functions
B) Operator functions
C) non-static functions
D) friend functions

3) Operator overloading is also called …………….. polymorphism.
A) run time
B) initial time
C) compile time
D) completion time

4) We can overload almost all the C++ operators except the following.
i) Class member operator (.,.*)   ii) Assignment operator (=)
iii) Scope resolution operator (::) iv) Conditional operator (?:)
A) i, ii and iii only
B) ii, iii and iv only
C) i, iii and iv only
D) All i, ii, iii and iv

5) Which of the following is the correct order involves in the process of operator overloading.
i) Define the operator function to implement the required operations.
ii) Create a class that defines the data type that is to be used in the overloading operation.
iii) Declare the operator function op() in the public part of the class.
A) 1-i, 2-ii, 3-iii
B) 1-ii, 2-iii, 3-i
C) 1-ii, 2-i, 2-iii
D) 1-iii, 2-ii, 3-i

6) State whether the following statements are True or False for overloading operators.
i) Only existing operators can be overloaded.
ii) We can change the basic meaning of an operator
A) True, True
B) True, False
C) False, True
D) False, False

7) We cannot use friend functions to overload which of the following operators.
i) membership operator(.)    ii) Assignment operator(=)
iii) class member access operator(_>)  iv) conditional operator(?:)
A) i and ii only
B) ii and iii only
C) iii and iv only
D) i and iv only

8) …………… overloaded by means of a member function, take no explicit arguments and return no explicit values.
A) Unary operators
B) Binary operators
C) Arithmetic operators
D) Function operator

9) ……………. overloaded through a member function take one explicit argument and those which are overloaded through a friend function take two explicit arguments.
A) Unary operators
B) Binary operators
C) Arithmetic operators
D) Function operator

10) When using ………………., overloaded through a member function, the left-hand operand must be an object of the relevant class.
A) Unary operators
B) Binary operators
C) Arithmetic operators
D) Function operator

11) Operator overloading is done with the help of a special function called ……………, which describes the special task of an operator.
A) overloading function
B) special task function
C) detail function
D) operator function

12) The compiler does not support automatic type conversions for the ………….. data type.
A) basic
B) user-defined
C) class
D) automatic

13) The casting operator function should satisfy which of the following conditions.
i) It must be a class member    ii) It must not specify the return type
iii) It must not have any arguments
A) i and ii only
B) ii and iii only
C) i, iii only
D) All i, ii and iii

14) The conversion from a class to any other type or any other class should make use of a ………….. in the source class.
A) casting operator
B) constructor
C) not applicable
D) operator function

15) To perform the conversion from any other data type or class to a class type, a ………….. should be used in the destination class.
A) casting operator
B) constructor
C) not applicable
D) operator function

16) The general form of an overloaded casting operator function usually referred to as a ……………..
A) casting function
B) operator function
C) conversion function
D) overloaded function

17) Operator overloading provides a flexible option for the creation of new …………….. for most of the C++ operations.
A) class
B) function
C) object
D) definitions

18) In the case of …………….. function, arguments may be passed either by value or by reference.
A) private
B) friend
C) member
D) public

Answers

1) A) Arithmetic operator (+, -, *, /)
2) B) Operator functions
3) C) compile time
4) C) i, iii and iv only
5) B) 1-ii, 2-iii, 3-i
6) B) True, False
7) B) ii and iii only
8) A) Unary operators
9) B) Binary operators
10) B) Binary operators
11) D) operator function
12) B) user-defined
13) D) All i, ii and iii
14) A) casting operator
15) B) constructor
16) C) conversion function
17) D) definitions
18) B) friend

Read Next: Top 20 MCQ Questions On Inheritance In C++
Read More: C and C++ MCQ Questions

Please follow and like us:
RSS
Follow by Email
X (Twitter)
Visit Us
Follow Me
YouTube
YouTube
LinkedIn
linkedIn | Multiple Choice Questions On C++ Operator Overloading
Share

Author

Shuseel Baral is a web programmer and the founder of InfoTechSite has over 8 years of experience in software development, internet, SEO, blogging and marketing digital products and services is passionate about exceeding your expectations.

1 Comment

  1. sarfraz Ali

    thanks .
    please guide me to become a python developer
    please sir SHUSEEL BARAL SIR

RSS
Follow by Email
X (Twitter)
Visit Us
Follow Me
YouTube
YouTube
LinkedIn
Share