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

1. Code should call member function printUniversal of the Time class. Time clock

ID: 3556379 • Letter: 1

Question

1. Code should call member function printUniversal of the Time class.

Time clock(11,22,43);

Time *clockPtr = &clock;

(*clockPtr)->printUniversal();

2. Code defines an abstract class named Base.

class Base

{

public:

void print() const;

};

3. The for loop should initialize all array values to -1.

int array{10};

for( int i = 0; i<9; i++)

array[i] = -1;

4. Assume a time class definition includes both of the following constructors.

Time(int h = 0, int m=0, int s=0);

Time();

Time(int);

5. Program should output the number 9,

int x = 4;

cout<<(x++ + 4);

Explanation / Answer

1. Code should call member function printUniversal of the Time class.
Time clock(11,22,43);
Time *clockPtr = &clock;
// CORRECT CODE AS FOLLOWS.
clockPtr->printUniversal();   // OR (*clockPtr).printUniversal();

2. Code defines an abstract class named Base.
class Base
{
public:
void print() const = 0; // now this is pure abstract class.
};

3. The for loop should initialize all array values to -1.
// CORRECT CODE AS FOLLOWS.
int array[10];
for( int i = 0; i<10; i++)
array[i] = -1;

4. Assume a time class definition includes both of the following constructors.
// FOLLOWING DECLARATION ENOUGH...
Time(int h = 0, int m=0, int s=0);
//Time();
//Time(int);

5. Program should output the number 9,
int x = 4;
cout<<(++x + 4); // now this line prinTS 9. // AS ++x MAKES VALUE OF X 5.