Exam 11: Friends, Overloaded Operators, and Arrays in Classes

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

Since accessor functions in a class do not modify or mutate the data members of the object, the function should have the __________ modifier.

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

C

You cannot create new operators such as the quote).

Free
(True/False)
4.8/5
(38)
Correct Answer:
Verified

True

How many members data and functions) does the following class have? Class Rational { Public: Rational); Rationalint numer, int denom); Rationalint whole); Int getNumerator); Int getDenominator); Friend void displayostream& out, const Rational& value); Private: Int numerator; Int denominator; };

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

D

If c is a character variable that contains a digit, what does the following function return? Int digit_to_intchar c) { Return intc) - int'0')); }

(Multiple Choice)
4.8/5
(41)

What member functions do you need to allow the compiler to perform automatic type conversions from a type different than the class to the class?

(Multiple Choice)
4.8/5
(46)

Putting the keyword const after the function declaration guarantees __________________________

(Essay)
4.7/5
(35)

All operators can be overloaded.

(True/False)
4.8/5
(36)

If a given task being performed by a function involves one object, then that function should normally be a __________ function.

(Short Answer)
4.8/5
(39)

How many parameters are there in a unary operator implemented as a friend?

(Multiple Choice)
4.8/5
(32)

If we have a full selection of accessor and mutator functions, why would we have friend functions?

(Multiple Choice)
4.9/5
(43)

Why are the extraction and insertion operators always implemented as friends of the class rather than as members of the class?

(Multiple Choice)
5.0/5
(47)

Write the function declaration for an assignment operator for a class named myClass

(Essay)
4.8/5
(37)

In order to do automatic type conversion for your class, you would write _________

(Essay)
4.8/5
(30)

In an overloaded insertion or extraction operator, which object should be the first parameter, the stream or the object of the class?

(Multiple Choice)
4.8/5
(35)

Write the function declaration for a destructor for a class named myClass

(Short Answer)
4.8/5
(42)

Given the following function declaration, Friend void displayconst myClass& object); Which is the correct header for the definition of the function?

(Multiple Choice)
4.9/5
(35)

Which of the following statements are true?

(Multiple Choice)
4.9/5
(42)

If you have mutators and accessors, you should not have friend functions also

(True/False)
4.9/5
(34)

When overloading an operator, which of the following is true?

(Multiple Choice)
4.8/5
(38)

A _________ function is not a member of the class, but has access to the private members of the class.

(Short Answer)
4.7/5
(36)
Showing 1 - 20 of 56
close modal

Filters

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