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

c++ programming questions, most points to most complete! Question 37.37. Given t

ID: 3771783 • Letter: C

Question

c++ programming questions, most points to most complete!

Question 37.37. Given the following class, what would be the best declaration for a mutator function that allows the user of the class to change the age?

class Wine
{
public:
Wine();
int getAge();
float getCost();

private:
int age;
float cost;
} (Points : 2)
int getAge(int newAge);
Wine();
void setAge();
void setAge(int newAge);

Question 38.38. In a class, all members are ____________ by default (Points : 2)
public
private
global
all of the above

Question 39.39. A derived class has access to (Points : 2)
the private functions and variables of its ancestor classes
the public functions and variables of its ancestor classes
only the functions and variables defined in its class

Question 40.40. Which of the following assigns to p1 the pointer to the address of value? (Points : 2)
*p1=&value;
p1=value;
p1=&value;
&p1 = *value;

Question 41.41. What is the output of the following code fragment?

float *p1;
p1 = new float(3);
cout << *p1; (Points : 2)
unknown, the address p1 points to is not initialized
unknown, the code is illegal, p1 points to a dynamic array
3.0
0.0

Question 42.42. Given that a typedef for IntPtr defines a pointer to an integer, what would be the correct declaration for a function that expects a reference to an integer pointer? (Points : 2)
void f1 (IntPtr& ptr);
void f1 (IntPtr&* ptr);
void f1 (IntPtr*& ptr);
All of the above

Question 43.43. Which of the following statements correctly returns the memory from the dynamic array pointer to by p1 to the freestore? (Points : 2)
delete p1[];
delete *p1;
delete [] p1;
delete p1;

Explanation / Answer

37.37 void setAge(int newAge);

38.38 private

39.39 the public functions and variables of its ancestor classes

40.40 p1=&value;

41.41 3.0

42.42 void f1 (IntPtr& ptr);

43.43 delete [] p1;

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Chat Now And Get Quote