Exam 11: Friends, Overloaded Operators, and Arrays in Classes
Exam 1: Introduction to Computer and C++ Programming56 Questions
Exam 2: C++ Basics57 Questions
Exam 3: More Flow of Control45 Questions
Exam 4: Procedural Abstraction and Functions That Return a Value53 Questions
Exam 5: Functions for All Sub Tasks54 Questions
Exam 6: Io Streams As an Introduction to Objects and Classes52 Questions
Exam 7: Arrays48 Questions
Exam 8: Strings and Vectors69 Questions
Exam 9: Pointers and Dynamic Arrays39 Questions
Exam 10: Defining Classes61 Questions
Exam 11: Friends, Overloaded Operators, and Arrays in Classes56 Questions
Exam 12: Separate Compilation and Namespaces41 Questions
Exam 13: Pointers and Linked Lists64 Questions
Exam 14: Recursion48 Questions
Exam 15: Inheritance53 Questions
Exam 16: Exception Handling47 Questions
Exam 17: Templates35 Questions
Exam 18: Standard Template Library59 Questions
Select questions type
An overloaded extraction or insertion operator should return ___________
(Short Answer)
4.8/5
(41)
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)
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 following is a properly declared overloaded insertion operator for myClass.
ostream& operator <<ostream &out, const myClass &obj);
(True/False)
4.9/5
(48)
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)
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
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)