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
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)
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)
What is wrong with the following overloaded extraction operator declaration?
Istream& operator >>istream& in, const myClass &object);
(Multiple Choice)
4.9/5
(35)
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
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)