Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Listed below are some desired effects. Indicate, by circling the appropriate cha

ID: 3916314 • Letter: L

Question

Listed below are some desired effects. Indicate, by circling the appropriate character(s), whether each can be accomplished with overloaded functions (O) and/or a function with default arguments (D) and/or a function template (T) or none of them (N).

[ O D T N ] CalcMass(density, volume) returns the mass of an object having a density of density and a volume of volume, whereas CalcMass(density) returns the mass of an object having a density of density and a unit volume (1.0 cubic feet, say). All quantities are of type double.

[ O D T N ] Repeat(10, "Rats!") displays the string argument 10 times, whereas Repeat("Dang it!") displays the string argument 3 times.

[ O D T N ] CalcAvg(3, 6) returns the int average of two int arguments, whereas CalcAvg(3.0, 6.0) returns the double average of two double arguments.

[ O D T N ] SmartAssign("Excellent") returns the character 'E' or a pointer to the string "Excellent" depending on whether the return value is assigned to a char variable or to a pointer to char variable.

Explanation / Answer

CalcMass(density, volume) returns the mass of an object having a density of densityand a volume of volume, whereas CalcMass(density) returns the mass of an object having a density of density and a unit volume (1.0 cubic feet, say). All quantities are of type double.
====> Answer : D , As VOLUME can be default with value 1 so it can be default

[ O D T N ] Repeat(10, "Rats!") displays the string argument 10 times, whereas Repeat("Dang it!")displays the string argument 3 times.
====> Answer : N, none of Them

[ O D T N ] CalcAvg(3, 6) returns the int average of two int arguments, whereas CalcAvg(3.0, 6.0)returns the double average of two double arguments.
====> Answer : T , as data type is changed hence it can be accomplished with Templates

[ O D T N ] SmartAssign("Excellent") returns the character 'E' or a pointer to the string "Excellent"depending on whether the return value is assigned to a char variable or to a pointer to charvariable.
====> Answer : O, Overloaded function with same name and different return Type




As answer is Done, PLEASE REVIEW and let me know.


PLEASE UPVOTE if helpful