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
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:
C
You cannot create new operators such as the quote).
Free
(True/False)
4.8/5
(38)
Correct Answer:
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:
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)
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)
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
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)