3140 EXAM Flashcards

1
Q

In OOP, what is a proper noun?

A

An Object

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

In OOP, what are common nouns?

A

Classes

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

What can make a common noun represent an object?

A

Determiner (MY laptop)

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

In OOP, what is an adjective?

A

Attribute value (implying type)

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

In OOP, what does a plural noun suggest?

A

A collection of objects

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

In OOP, what three things could represent a collection of objects?

A
  1. A Container class
  2. A Table in a database
  3. Multiplicity relationship
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

In OOP, what are verbs?

A

Operations

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

In OOP, what is signified by “is a”

A

Inheritance

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

In OOP, what is signified by “Has a…Shares a”

A

Aggregation

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

As you move down a class hierarchy, the objects become _____ specialized?

A

More

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

How does a class specify which classes it inherits from?

A

base specification list

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

If the base class access specifier is omitted, what is the default?

A

Private

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

How many base classes can a derived class specifically initialize?

A

Only it’s direct base class

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

What 2 keywords can be used with virtual functions in a derived class?

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

What is a vtable?

A

Virtual Function Table

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

How do you make a class abstract?

A

Virtual function = 0

17
Q

If a derived class does not override a virtual function from an abstract base class, what happens?

A

The derived class becomes abstract as well

18
Q

What is the best practice when making a base class with regards to destructors?

A

Make a virtual destructor

19
Q

Why should you create a virtual destructor for a base class?

A

Executing delete on a pointer to a base that points to a derived object has undefined behaviour

20
Q

How does a class inherit from multiple classes that inherit from the same base class?

A

The classes need to be virtual

21
Q

How do you get the class of an object a pointer is pointing to? (class ClassName)

A

typeid(*ptr).name()

22
Q

How do you test if a pointer to an object is part of a specific heirarchy?

A

dynamic_cast< HEIRARCHY* >(ptr.get())

23
Q

What does this return:
dynamic_pointer_cast< HEIRARCHY >(ptr)

A

A shared pointer to whatever class in the hierarchy you pass it