Ch. 13 Introduction to Classes Flashcards

1
Q

The two common programming methods in practice today are _______ and _______.

A

Procedural programming, Object oriented programming

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

________ programming is centered around functions or procedures.

A

procedural

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

_________ programming is centered around objects.

A

Object oriented

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

_______ is an objects ability to contain and manipulate its own data.

A

encapsulation

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

In C++ the _______ is the construct used to create objects.

A

class

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

A class is very similar to a(n) ________.

A

structure

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

A(n) ________ is a key word inside a class declaration that establishes a member’s accessibility.

A

access specifier

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

The default access specification of class members is ________.

A

private

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

The default access specification of a struct in C++ is ________.

A

public

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Defining a class object is often called the _________ of a class.

A

instantiation

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Members of a class object may be accessed through a pointer to the object by using the ______ operator.

A

pointer

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

If you were writing the declaration of a class named Canine, what would you name the file it was stored in?

A

Canine.h

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

If you were writing the external definitions of the Canine class’s member functions, you would save them in a file named ______.

A

Canine.cpp

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

When a member functions body is written inside a class declaration, the function is ________.

A

inline

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

A ________ is automatically called when an object is created.

A

constructor

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

A _______ is a member function with the same name as the class.

A

constructor

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

________ are useful for performing initialization or setup routines in a class object.

A

constructors

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

Constructors cannot have a ________ type.

A

return

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

A _______ constructor is one that requires no arguments.

A

default

20
Q

A(n) ________ is a member function that is automatically called when an object is destroyed.

A

destructor

21
Q

A destructor has the same name as the class, but is preceded by a(n) ________ character.

A

tilde ~

22
Q

Like constructors, destructors cannot have a _________ type.

A

return

23
Q

A constructor whose arguments all have default values is a(n) ______ constructor.

A

default

24
Q

A class may have more than one constructor, as long as each has a different _______.

A

Parameter list

25
Q

A class may only have one default _________ and one ________.

A

Constructor, Destructor

26
Q

A(n) ______ may be used to pass arguments to the consructors of elements in an objects array.

A

initialization list

27
Q

Private members must be declared before public members T/F.

A

false

28
Q

Class members are private by default. t/f

A

true

29
Q

Members of a struct are private by default. t/f

A

false

30
Q

Classes and structures in C++ are very similar. t/f

A

true

31
Q

All private members of a class must be declared together. t/f

A

false

32
Q

All public members of a class must be declared together. t/f

A

false

33
Q

It is legal to define a pointer to a class object. t/f

A

true

34
Q

You can use the new operator to dynamically allocate an instance of a class. t/f

A

true

35
Q

A private member function may be called from a statement outside the class, as long as the statement is in the same program as the class declaration. t/f

A

false

36
Q

Constructors do not have to have the same name as the class. t/f

A

false

37
Q

Constructors may not have a return type. t/f

A

true

38
Q

Constructors cannot take arguments. t/f

A

false

39
Q

Destructors cannot take arguments. t/f

A

true

40
Q

Constructors may have default arguments. t/f

A

true

41
Q

Member functions may be overloaded. t/f

A

true

42
Q

Constructors may not be overloaded. t/f

A

false

43
Q

A class may not have a constructor with no parameter list, and a constructor whose arguments all have default values.

A

true

44
Q

A class may only have one destructor. t/f

A

true

45
Q

When an array of objects is defined, the constructor is only called for the first element. t/f

A

false

46
Q

To find the classes needed for an object-oriented application, you identify all the verbs in a description of the problem domain. t/f

A

false

47
Q

A class’s responsibilities are the things the class is responsible for knowing, and the actions the class must perform. t/f

A

true