Exam 2 Terms Flashcards

1
Q

Dynamic Memory Allocation

A

Memory that is allocated during runtime. The memory is allocated on a heap data structure, and relies on pointers to access the information

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

Dynamic Memory Allocation (Usage)

A

Sometimes we don’t know the size of memory that we need, sometimes memory usage is limited

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

Dynamic Memory Allocation (Syntax)

A

New - allocated a new memory pointer
Delete - frees the desired allocated memory

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

Pointer memory allocation

A

Allocating memory using a pointer. (Done using the keyword “new”)

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

Ad Hoc polymorphism

A

Defining multiple functions with the same name, but changing their context (parameters). AKA - function overloading and operator overloading

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

General polymorphism

A

The ability for an object or a function to behave differently

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

Function output

A

the returned value after a function has been executed

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

Function overloading

A

multiple functions that have the same key signature (name) but have at least ONE different parameter, and the return value can be different

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

Operator overloading

A

Giving custom behavior to already defined operators. These only work with objects of a specified class

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

Friend functions

A

Have access to private and protected members of a class

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

Friend functions (drawbacks)

A

It breaks encapsulation, and data hiding, these are key pillars of OOP

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

What will you do if the list is empty and you want to add an item?

A

Using the object passed in, or by creating a new one, the firstPtr is set to the object, and the nextPtr and lastPtr are still pointing to the nullptr

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

What will you do if you want to add at the end of the list?

A

The object currently at the end of the list’s nextPtr is now pointing to the new object, and the new object is pointing to nullPtr

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

What will you do if you want to add at the first of the list?

A

The object we’re sending in nextPtr is set to point at the first object, and then we set the firstPtr to point to the new object we sent in

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

What will you do if you want to add before a given index?

A

Iterate across the list until you reach the desired index, then go back an object to insert the new object

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