Exam 10: Operator Overloading; String and Array Objects

arrow
  • Select Tags
search iconSearch Question
flashcardsStudy Flashcards
  • Select Tags

Y and z are user-defined objects and the += operator is an overloaded member function. The operator is overloaded such that y += z adds z and y, then stores the result in y. Which of the following expressions is always equivalent to y += z?

Free
(Multiple Choice)
4.8/5
(32)
Correct Answer:
Verified

B

Which of the following is not a disadvantage of default memberwise copy with objects containing pointers?

Free
(Multiple Choice)
4.9/5
(33)
Correct Answer:
Verified

D

Because the postfix increment operator returns objects by value and the prefix increment operator returns objects by reference:

Free
(Multiple Choice)
4.8/5
(27)
Correct Answer:
Verified

D

For operators overloaded as non-static member functions:

(Multiple Choice)
4.7/5
(28)

Which of the following is false?

(Multiple Choice)
4.8/5
(33)

Which of the following lines would be the prototype for an overloaded cast operator function that converts an object of user-defined type Time into a double?

(Multiple Choice)
4.9/5
(28)

To prevent class objects from being copied or assigned, you can:

(Multiple Choice)
4.8/5
(32)

There exists a data type Date with member function Increment that increments the current Date object by one. The ++ operator is being overloaded to postincrement an object of type Date. Select the correct implementation:

(Multiple Choice)
4.9/5
(29)

An overloaded + operator takes a class object and a double as operands. For it to be commutative (i.e., a + b and b + a both work):

(Multiple Choice)
4.8/5
(33)

An explicit constructor:

(Multiple Choice)
4.9/5
(33)

A copy constructor must receive its argument by reference because:

(Multiple Choice)
4.7/5
(39)

Which of the following operators cannot be overloaded?

(Multiple Choice)
4.8/5
(38)

To prevent class objects from being copied:

(Multiple Choice)
4.9/5
(31)

Which statement is false?

(Multiple Choice)
4.9/5
(37)

Conversion constructors:

(Multiple Choice)
4.9/5
(36)

A copy constructor:

(Multiple Choice)
4.9/5
(34)

Which of the following is false?

(Multiple Choice)
4.8/5
(30)

Which of the following statements about a unique_ptr object is true?

(Multiple Choice)
4.9/5
(39)

Assume that the function call operator() is overloaded for data type String in the usual sense of selecting a substring from a larger string. For a String object string1 with the character string "ABCDEFGHI", what string does string1(4, 2) return?

(Multiple Choice)
4.9/5
(36)

Which of the following is false about the new operator and the object for which it allocates memory?

(Multiple Choice)
4.8/5
(37)
Showing 1 - 20 of 34
close modal

Filters

  • Essay(0)
  • Multiple Choice(0)
  • Short Answer(0)
  • True False(0)
  • Matching(0)