C7 Flashcards

(50 cards)

1
Q

What is the difference between a class and an instance of the class?

A

A class is a blueprint; an instance is a concrete object created from that blueprint.

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

What is the default access specification of class members?

A

private

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

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

A

procedural; object-oriented

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
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
5
Q

_________ programming is centered around objects.

A

object-oriented

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

_________ is an object’s 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
7
Q

In C++, the _________ is the construct primarily used to create objects.

A

class

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
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
9
Q

A(n) _________ is a keyword 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
10
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
11
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
12
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
13
Q

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

A

arrow (->)

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

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

A

BankAccount.h

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

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

A

BankAccount.cpp

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

When a member function’s 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
17
Q

A(n) _________ 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
18
Q

A(n) _________ 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
19
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
20
Q

Constructors cannot have a(n) _________ type.

A

return

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

A(n) _________ constructor is one that requires no arguments.

22
Q

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

23
Q

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

24
Q

Like constructors, destructors cannot have a(n) _________ type.

25
A constructor whose arguments all have default values is a(n) _________ constructor.
default
26
A class may have more than one constructor, as long as each has a different _________.
parameter list
27
A class may only have one default _________ and one _________.
constructor; destructor
28
A(n) _________ may be used to pass arguments to the constructors of elements in an object array.
constructor
29
Private members must be declared before public members.
False
30
Class members are private by default.
True
31
Members of a struct are private by default.
False
32
Classes and structures in C++ are very similar.
True
33
All private members of a class must be declared together.
False
34
All public members of a class must be declared together.
False
35
It is legal to define a pointer to a class object.
True
36
You can use the new operator to dynamically allocate an instance of a class.
True
37
A private member function may be called from a statement outside the class, if it is in the same program.
False
38
Constructors do not have to have the same name as the class.
False
39
Constructors may not have a return type.
True
40
Constructors cannot take arguments.
False
41
Destructors cannot take arguments.
True
42
Destructors may return a value.
False
43
Constructors may have default arguments.
True
44
Member functions may be overloaded.
True
45
Constructors may not be overloaded.
False
46
A class may not have a constructor with no parameter list and a constructor whose arguments all have default values.
True
47
A class may only have one destructor.
True
48
When an array of objects is defined, the constructor is only called for the first element.
False
49
To find the classes needed for an object-oriented application, you identify all of the verbs in the problem description.
False
50
A class’s responsibilities are the things the class must know and actions it must perform.
True