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

1. (TCO 2) Suppose that you have the following UML class diagram of a class. Whi

ID: 3661144 • Letter: 1

Question

1.(TCO 2) Suppose that you have the following UML class diagram of a class.

Which of the following is the name of the class?(Points : 4) clock
clockType
Type
ClockType

2.(TCO 2) A ____ sign in front of a member name on the UML diagram indicates that this member is a public member.(Points : 4) +
-
#
$

3.(TCO 2) Which statement correctly describes the default access attributes of both classes and structures?(Points : 4) Structures are private by default and classes are private by default.
Structures are public by default and classes are public by default.
Structures are public by default and classes are private by default.
Structures have no default access attribute and classes are private by default.

4.(TCO 3) Which of the following may not be used as a class data member?(Points : 4) struct
class
namespace
arrays

5.(TCO 3) Which of the following statements is an accurate example of composition?(Points : 4) A car has an engine.
A car is an automobile.
A car is an object.
A car has a class.

6.(TCO 3) Which statement is correct regarding an object of a class which is declared as a data member of a different class?(Points : 4) It must be declared as private.
It must be declared as protected.
It must be declared as public.
It may be declared as private, protected, or public.

7.(TCO 4) OOP implements ____.(Points : 4) UML
IPE
EIP
OOD

8.(TCO 4) If class AClass is derived from class BClass, which one of the following statements correctly states the destructor call sequence when an object of class AClass goes out of scope?(Points : 4) BClass destructor first, AClass destructor second
AClass destructor first, BClass destructor second
BClass destructor only, the AClass destructor is not called if AClass derived private from BClass
AClass destructor only, the BClass destructor is not called if BClass derived private from AClass

9.(TCO 4) Which one of the following statements is a correct example of inheritance?(Points : 4) An automobile has an engine.
An automobile is a Mustang.
A Mustang is an automobile.
An engine is part of an automobile.

10.(TCO 5) If p is a pointer, which statement uses the pointer, then increments it?(Points : 4) *++p
*p++
*p--
*--p

11.(TCO 5) In the following code, if the address of foo is bff00fa10 hex and the address of foo2 is bff00a14 hex, what would the output be if the line cout << foo2 << endl; were added after the last line?

int foo;
int *foo2;
foo2 = &foo;
foo = 1234;
cout << *foo2 << end1;
(Points : 4) 1234
0xbff00a10
0xbff00a14
0xbff01424

12.(TCO 5) Which of the following statements correctly allocates space to store 15 real numbers?(Points : 4) double *dptr = new double[15];
double dptr = new double[15];
double *dptr = new double[14];
real *iptr = new real[14];

13.(TCO 5) Given the following structure definition, which of the following statements dynamically allocates an instance of this structure?

struct Data
{
int ival;
double dval;
char cval;
};
(Points : 4) struct myData;
Data *myData = new Data;
struct *Data = new myData;
Data pointer = new Data;

Explanation / Answer

d a c d a d b c d b a d a