Ace Your C++ Skills 2025 – Rock the ‘Thinking in C++’ Challenge!

Disable ads (and more) with a premium pass for a one time $4.99 payment

Question: 1 / 575

What must binary operators return when their effect is to produce a new value?

A new modified object by reference

A constant object by value

Binary operators are functions that perform operations on two operands (inputs) and return a value. When these operators are used to produce a new value, they must return a value that represents the result of the operation. This means that options A, C, and D are incorrect.

Option A states that the operator must return a new modified object by reference. However, this is incorrect because binary operators only return a value, not a reference to an object.

Option C states that the operator must return void, which means the function will not return any value. This is incorrect because, in this context, the binary operator must return a value.

Option D states that the operator must return a non-const reference to the modified object. However, this is incorrect because, as mentioned before, binary operators only return a value and not a reference to an object.

Therefore, option B is the correct answer as

Get further explanation with Examzify DeepDiveBeta

Void

A non-const reference to the modified object

Next

Report this question

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy