Exam 9: Understanding Friends and Overloading Operators

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

You can use the ____ as an alternate way to make assignments to an object.

Free
(Short Answer)
4.8/5
(33)
Correct Answer:
Answered by Examlex AI Copilot

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:
Verified

A

When you use the new operator, is the memory allocation always successful? Explain.

Free
(Essay)
4.9/5
(38)
Correct Answer:
Verified

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.,

The operator>>() function overloads the ____ operator.

(Multiple Choice)
4.7/5
(41)

The ____ operator has right-to-left associativity.

(Multiple Choice)
4.9/5
(32)

Distinguish between the terms overloading and polymorphism.

(Essay)
4.8/5
(40)
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:
Verified
Premises:
Responses:
it is not used within the function but exists only to provide a different function prototype
deallocated memory
(Matching)
4.9/5
(35)

Can operators be overloaded for the C++ built-in types? Explain.

(Essay)
4.7/5
(39)

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)

The ____ operator frees previously allocated memory.

(Multiple Choice)
4.8/5
(40)

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)

The operator function overloads the ____ operator.

(Multiple Choice)
4.7/5
(31)
Match each term with the correct statement below.
Premises:
a function's prototype
Responses:
pure polymorphism
forward declaration
deallocated memory
Correct Answer:
Verified
Premises:
Responses:
a function's prototype
pure polymorphism
(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:
Verified
Premises:
Responses:
use of functions that are distinguished by their number or types of arguments
pure polymorphism
(Matching)
4.8/5
(27)

The subscript operator, ____, is declared like any other function.

(Multiple Choice)
4.7/5
(34)

Can overloaded functions be friends? If so, how?

(Essay)
4.9/5
(37)

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
close modal

Filters

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