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

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

Which of the following function declarations would be correct to overload the multiply operator for the Rational numbers class?

(Multiple Choice)
4.9/5
(37)

You may not change the precedence of operators by overloading them

(True/False)
4.8/5
(31)

Which of the following statements are true?

(Multiple Choice)
4.7/5
(37)

What happens when you define a class that used dynamic memory allocation and define a destructor but no copy constructor?

(Multiple Choice)
4.9/5
(38)

Functions that are constant member functions may call constant class accessor functions.

(True/False)
5.0/5
(36)

Both the copy constructor and the assignment operator should make ___________

(Short Answer)
4.8/5
(45)

Functions that are constant member functions may call the class mutator functions.

(True/False)
4.8/5
(31)

Which of the following are not correct?

(Multiple Choice)
4.9/5
(38)

What is wrong with the following overloaded extraction operator declaration? Istream& operator >>istream& in, const myClass &object);

(Multiple Choice)
4.9/5
(35)

Operators can be overloaded as

(Multiple Choice)
4.8/5
(31)

To overload functions with symbolic names like + - / <<), you must use the keyword _______ before the symbolic name.

(Multiple Choice)
4.8/5
(35)

Given the following class, what is syntactically wrong with the implementation of the display function? 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; }; Void displayostream& out, const Rational& value) { Out << value.getNumerator) << '/"<<value.getDenominator); }

(Multiple Choice)
4.9/5
(39)

Given the following class and array declaration, how would you print out the age of the 10th person in the array? Class personClass { Public: Void setAgeint newAge); Void setGender char newGender); Void setSalaryfloat newSalary); Int getAge); Char getGender); Float getSalary); Private: Int age; Char gender; Float salary; }; PersonClass people[100];

(Multiple Choice)
4.7/5
(41)

Putting the keyword const in front of a pass by reference parameter guarantees ___________________

(Essay)
4.9/5
(37)

When a dynamic array with a class for a base type is declared, which constructor is called?

(Multiple Choice)
4.8/5
(38)

Why should you generally pass an object of the class to a friend function as a reference parameter?

(Multiple Choice)
4.9/5
(44)
Showing 41 - 56 of 56
close modal

Filters

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