Question: QUESTION 3 clockType -hr: int -min: int -sec: int +setTime(int, int, int): void +getTime(int&, int&, int&) const: void +printTime() const: void +incrementSeconds(): int +incrementMinutes(): int

QUESTION 3

clockType
-hr: int -min: int -sec: int
+setTime(int, int, int): void +getTime(int&, int&, int&) const: void +printTime() const: void +incrementSeconds(): int +incrementMinutes(): int +incrementHours(): int +equalTime(const clockType&) const: bool

Consider the UML class diagram shown in the accompanying figure. Which of the following is the name of the class?

a.

clock

b.

clockType

c.

Type

d.

+clockType

1 points

QUESTION 4

class secretType { public: static int count; static int z; secretType(); secretType(int a); void print(); static void incrementY(); private: int x; static int y; }; secretType::secretType() { x = 1; } secretType::secretType(int a) { x = a; } void secretType::print() { cout << "x = " << x << ", y = " << y << "z = " << z << ", count = " << count << endl; } static void secretType::incrementY() { y++; }

Consider the accompanying class and member functions definitions. How many constructors are present in the class definition?

a.

none

b.

one

c.

two

d.

three

1 points

QUESTION 5

A class object can be ____. That is, it is created each time the control reaches its declaration, and destroyed when the control exits the surrounding block.

a.

static

b.

local

c.

public

d.

automatic

1 points

QUESTION 6

Which of the following class definitions is correct in C++?

a.

class studentType { public: void setData(string, double, int); private: string name; };

b.

class studentType { public void setData(string, double, int); private string name;

};

c.

studentType class { public: void setData(string, double, int); private: string name;

};

d.

class studentType { public: void setData(string, double, int); void print() const; private: string name; double gpa;

}

1 points

QUESTION 7

class rectangleType { public: void setLengthWidth(double x, double y); //Postcondition: length = x; width = y; void print() const; //Output length and width; double area(); //Calculate and return the area of the rectangle; double perimeter(); //Calculate and return the parameter; rectangleType(); //Postcondition: length = 0; width = 0; rectangleType(double x, double y); //Postcondition: length = x; width = y; private:

double length; double width; };

Consider the accompanying class definition, and the object declaration: rectangleType bigRect(14,10); Which of the following statements is correct?

a.

bigRect.length = 2.0;

b.

bigRect.setLengthWidth();

c.

bigRect.length = bigRect.width;

d.

bigRect.setLengthWidth(3.0, 2.0);

1 points

QUESTION 8

How many destructors can a class have?

a.

no explicit destructors

b.

one

c.

two

d.

any number

1 points

QUESTION 9

A class object can be ____. That is, it can be created once, when the control reaches its declaration, and destroyed when the program terminates.

a.

static

b.

local

c.

automatic

d.

public

1 points

QUESTION 10

clockType
-hr: int -min: int -sec: int
+setTime(int, int, int): void +getTime(int&, int&, int&) const: void +printTime() const: void +incrementSeconds(): int +incrementMinutes(): int +incrementHours(): int +equalTime(const clockType&) const: bool

Consider the UML class diagram shown in the accompanying figure. According to the UML class diagram, how many private members are in the class?

a.

none

b.

zero

c.

two

d.

three

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!