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

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

An overloaded extraction or insertion operator should return ___________

(Short Answer)
4.8/5
(41)

The copy constructor for a class is called

(Multiple Choice)
4.8/5
(44)

The assignment operator must be a _________ of the class.

(Short Answer)
4.8/5
(32)

A friend function needs to be passed an object of the class. If the friend only needs to access the object, but not change its data members, then the object should be passed as _______________

(Short Answer)
4.9/5
(34)

Who can access private data in a class?

(Multiple Choice)
4.7/5
(33)

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

(Multiple Choice)
4.8/5
(46)

Which of the following would be an appropriate function declaration to add two rational numbers?

(Multiple Choice)
4.8/5
(30)

If obj1 and obj2 are both objects of a class that uses dynamic memory allocation, but the class does not have an assignment operator, what happens if you execute the following code? Obj1=obj2;

(Multiple Choice)
4.9/5
(42)

Which of the following are valid declarations for an assignment operator for a class named myClass?

(Multiple Choice)
4.8/5
(42)

The destructor for a class is called

(Multiple Choice)
4.8/5
(42)

Friend functions are members of the class.

(True/False)
4.8/5
(37)

The following is a properly declared overloaded insertion operator for myClass. ostream& operator <<ostream &out, const myClass &obj);

(True/False)
4.9/5
(48)

Operators must be friends of the class.

(True/False)
4.7/5
(34)

Friend functions may directly modify or access the private data members.

(True/False)
4.8/5
(31)

Write the function declaration for a copy constructor for a class named myClass

(Short Answer)
4.8/5
(33)

Which of the following operators can not be overloaded?

(Multiple Choice)
4.7/5
(29)

An operator that expects two parameters is called a ________ operator.

(Short Answer)
4.9/5
(34)

An operator that expects only one parameter is called a ________ operator

(Short Answer)
4.9/5
(37)

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

(Short Answer)
4.9/5
(41)

Given the following class, which is the correct function header for 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; };

(Multiple Choice)
4.9/5
(34)
Showing 21 - 40 of 56
close modal

Filters

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