Exam 11: Operator Overloading; String and Array Objects

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

Suppose the unary ! operator is an overloaded member function of class String. For a String object s, which function call is generated by the compiler when it finds the expression !s?

Free
(Multiple Choice)
4.7/5
(35)
Correct Answer:
Verified

A

Which of the following is false?

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

D

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

Free
(Multiple Choice)
4.7/5
(46)
Correct Answer:
Verified

C

A copy constructor:

(Multiple Choice)
4.8/5
(35)

Conversion constructors cannot:

(Multiple Choice)
5.0/5
(41)

Conversion constructors:

(Multiple Choice)
4.8/5
(44)

For operators overloaded as non-static member functions:

(Multiple Choice)
4.8/5
(30)

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
(43)

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

(Multiple Choice)
4.9/5
(39)

A copy constructor must receive its argument by reference because:

(Multiple Choice)
4.8/5
(34)

The correct function name for overloading the addition +) operator is:

(Multiple Choice)
4.8/5
(30)

Which of the following operators cannot be overloaded?

(Multiple Choice)
4.7/5
(31)

The prototypes of overloaded cast operator functions do not:

(Multiple Choice)
4.8/5
(35)

Which of the following operators can be overloaded as a global function?

(Multiple Choice)
4.9/5
(34)

An explicit constructor:

(Multiple Choice)
4.9/5
(41)

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

(Multiple Choice)
4.8/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.7/5
(34)

The conventional way to distinguish between the overloaded preincrement and postincrement operators ++) is:

(Multiple Choice)
4.8/5
(35)

Suppose you have a programmer-defined data type Data and want to overload the << operator to output your data type to the screen in the form cout << dataToPrint; and allow cascaded function calls. The first line of the function definition would be:

(Multiple Choice)
4.8/5
(39)

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)
5.0/5
(41)
Showing 1 - 20 of 32
close modal

Filters

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