Introduction to Programming MCQs with Answers
Practice important Introduction to Programming MCQs with answers and explanations.
Multiple Choice Questions
Q511: What does operator overloading allow?
- A: Same operator for multiple implementations
- B: New operators to be created
- C: Changing operator precedence
- D: Changing operator associativity
View Answer
A
Q512: Why is operator overloading useful?
- A: To make code more readable
- B: To increase the number of available operators
- C: To decrease execution time
- D: To change the arity of operators
View Answer
A
Q513: Which of the following operators is automatically overloaded for primitive types in C++?
- A: +
- B: ::
- C: sizeof
- D: ?
View Answer
A
Q514: What type of operators can be overloaded?
- A: Unary and Binary
- B: Only Unary
- C: Only Binary
- D: None
View Answer
A
Q515: Which operator cannot be overloaded?
- A: sizeof
- B: +
- C: -
- D: /
View Answer
A
Q516: Which of the following is an example of a unary operator?
- A: ++
- B: +
- C: -
- D: /
View Answer
A
Q517: Can operator overloading change the precedence of operators?
- A: No
- B: Yes
- C: Only for binary operators
- D: Only for unary operators
View Answer
A
Q518: What must be true about the arity of overloaded operators?
- A: It cannot be changed
- B: It can be increased
- C: It can be decreased
- D: It must be the same as in built-in types
View Answer
A
Q519: In the context of operator overloading, what does the 'friend' keyword do?
- A: Allows a non-member function to access private members
- B: Creates a new operator
- C: Overloads operators for primitive types
- D: Changes operator precedence
View Answer
A
Q520: What is the benefit of using member operator functions?
- A: The left operand drives the operation
- B: The right operand drives the operation
- C: Both operands are equal
- D: None
View Answer
A