Call
whatsapp
9447387064 | 9847003556
0471-2335855 | 8089080088 | 0471-2334855
9447387064 | 9847003556
0471-2335855 | 8089080088 | 0471-2334855
Cisco Training in Trivandrum, Trinity Technologies

No.1 Training Institute in Kerala

C++ - QUESTIONS : PART 35

State True or False.
i) While overloading operators new operator can be overloaded.
ii) The binary operator such as +, -, * and must explicitly return a value.

True, True
 True, False
False, True
False, False
SHOW ANSWER

We can overload which of the following C++ operators.

Arithmetic operator (+, -, *, /)
Class Member Access Operators (., .*)
 Size operator(sizeof)
Conditional operator(?:)
SHOW ANSWER

Operator overloading is also called …………….. polymorphism.

run time
 initial time
compile time
completion time
SHOW ANSWER

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 (?:)

i, ii and iii only
 ii, iii and iv only
i, iii and iv only
All i, ii, iii and iv
SHOW ANSWER

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. 

1-i, 2-ii, 3-iii
 1-ii, 2-iii, 3-i
1-ii, 2-i, 2-iii
1-iii, 2-ii, 3-i
SHOW ANSWER

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

True, True
True, False
False, True
False, False
SHOW ANSWER

 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(?:)

i and ii only
ii and iii only
iii and iv only
 i and iv only
SHOW ANSWER

…………… overloaded by means of a member function, take no explicit arguments and return no explicit values.

Unary operators
Binary operators
Arithmetic operators
Function operator
SHOW ANSWER

……………. overloaded through a member function take one explicit argument and those which are overloaded through a friend function take two explicit arguments.

Unary operators
 Binary operators
Arithmetic operators
Function operator
SHOW ANSWER

When using ………………., overloaded through a member function, the left hand operand must be an object of the relevant class. 

Unary operators
 Binary operators
Arithmetic operators
Function operator
SHOW ANSWER

Operator overloading is done with the help of a special function called ……………, which describes the special task of an operator. 

overloading function
 special task function
detail function
operator function
SHOW ANSWER

The casting operator function should satisfy which of the following conditions. 
i) It must be a class member    ii) It must not specify return type
iii) It must not have any arguments

i and ii only
ii and iii only
i, iii only
All i, ii and iii
SHOW ANSWER

How can we restrict dynamic allocation of objects of a class using new?

By overloading new operator
By making an empty private new operator.
By making an empty private new and new[] operators
By overloading new operator and new[] operators
SHOW ANSWER

Which of the following operators cannot be overloaded


 . (Member Access or Dot operator)

?: (Ternary or Conditional Operator )

 :: (Scope Resolution Operator)

* (Pointer-to-member Operator )
All of the above
SHOW ANSWER

Which of the following operators are overloaded by default by the compiler in every user defined classes even if user has not written?
1) Comparison Operator ( == )
2) Assignment Operator ( = )

Both 1 and 2
Only 1
 Only 2
None of the two
SHOW ANSWER

Which of the following operators should be preferred to overload as a global function rather than a member method?

Postfix ++
Comparison Operator
Insertion Operator <<
Prefix++
SHOW ANSWER

How does C++ compiler differs between overloaded postfix and prefix operators?

C++ doesn’t allow both operators to be overlaoded in a class
A postfix ++ has a dummy parameter
A prefix ++ has a dummy parameter
By making prefix ++ as a global function and postfix as a member function.
SHOW ANSWER

Which of the following operator functions cannot be global, i.e., must be a member function.

new
delete
Converstion Operator
All of the above
SHOW ANSWER
BACK | NEXT
TRINITY SOFTWARE SOLUTIONS,IInd floor, Radheyam Towers, Gandhari Amman Kovil Road, Pulimood, Trivandrum - 1
0471-2334855 | 2335855 | 9447387064 | 9847003556 info@trinitytechnology.in