Exam 9: Understanding Friends and Overloading Operators
Exam 1: An Overview of Object-Oriented Programming and C++55 Questions
Exam 2: Evaluating C Expressions51 Questions
Exam 3: Making Decisions50 Questions
Exam 4: Performing Loops51 Questions
Exam 5: Understanding Arrays, Strings and Pointers55 Questions
Exam 6: Using C++ Functions51 Questions
Exam 7: Using Classes56 Questions
Exam 8: Class Features and Design Issues53 Questions
Exam 9: Understanding Friends and Overloading Operators52 Questions
Exam 10: Understanding Inheritance53 Questions
Exam 11: Using Templates54 Questions
Exam 12: Handling Exceptions51 Questions
Exam 13: Advanced Input and Output55 Questions
Exam 14: Advanced Topics53 Questions
Select questions type
You can use the ____ as an alternate way to make assignments to an object.
Free
(Short Answer)
4.8/5
(33)
Correct Answer:
You can use the `constructor` as an alternate way to make assignments to an object. Constructors are special methods in a class that are called when a new instance of the class is created. They are typically used to initialize the properties of the new object with values passed as arguments to the constructor.
The operator++() function overloads the ____ operator.
Free
(Multiple Choice)
4.9/5
(34)
Correct Answer:
A
When you use the new operator, is the memory allocation always successful? Explain.
Free
(Essay)
4.9/5
(38)
Correct Answer:
When you allocate memory using the new operator, it is still possible that not enough new memory is available; perhaps other elements in your application have already used up the computer's resources.,
Match each term with the correct statement below.
Premises:
it is not used within the function but exists only to provide a different function prototype
Responses:
deallocated memory
stacking
parametric overloading
Correct Answer:
Premises:
Responses:
(Matching)
4.9/5
(35)
Write a destructor for the following class:
class Classroom
{
private:
string *student;
int numStudents;
int gradeLevel;
public:
Classroom();
~Classroom();
void display();
};
Classroom::Classroom()
{
int x;
cout > gradeLevel;
cout > numStudents;
student = new string[numStudents];
for(x = 0; x > student[x];
}
}
(Essay)
4.9/5
(53)
When you overload the operator[]() function for a class, the parameter is required to be an integer.
(True/False)
4.9/5
(34)
Which of the following operators has a different precedence than the others?
(Multiple Choice)
4.8/5
(38)
To use the applyTransaction() function as a friend to both the Customer and the Transaction class, you must use the following syntax: ____.
(Multiple Choice)
4.9/5
(35)
Match each term with the correct statement below.
Premises:
a function's prototype
Responses:
pure polymorphism
forward declaration
deallocated memory
Correct Answer:
Premises:
Responses:
(Matching)
4.9/5
(40)
Match each term with the correct statement below.
Premises:
use of functions that are distinguished by their number or types of arguments
Responses:
pure polymorphism
deallocated memory
associativity
Correct Answer:
Premises:
Responses:
(Matching)
4.8/5
(27)
The subscript operator, ____, is declared like any other function.
(Multiple Choice)
4.7/5
(34)
The name of the function that overloads the + symbol is the ____ function.
(Multiple Choice)
4.9/5
(41)
The * operator might mean multiplication or be used to ____________________ a pointer.
(Short Answer)
4.9/5
(41)
Showing 1 - 20 of 52
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)