Justines Section Flashcards

1
Q

What is override?

A

Overrides a base class’s method with its own implementation. (Not needed but is good practice)

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

What is virtual keyword?

A

When a function is declared as virtual it indicates that it can be overridden by a derived class. (Is needed)

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

What is method overloading?

A

Creating multiple methods in a class with the same name but different signatures.

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

What is a struct?

A

Similar to a class but accessible to public access.

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

What is a ring buffer?

A

A memory buffer that acts like a loop.

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

What is a process?

A

A process is an executing program that an operating system uses to separate applications.

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

What is a Thread?

A

The basic unit of processor allocation and execution within a process.

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

What is used to merge threads together once they are finished?

A

.join()

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

What is a lambda function?

A

An anonymous function with no name containing short snippets of code that wont be reused.

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

What makes up a lambda function?

A
  • (parameters): Parameters of the function
  • –> return type
  • {} method
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is the effect of passing by reference?

A

Allows all threads to modify the parameter. Just use ref()

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

What is a race condition?

A

An unpredictable ordering of events where some orderings may cause undesired behaviour.

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

What is Atomicity?

A

property of an operation to be executed as a single, indivisible unit without interference from other concurrent operations.

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

What is a mutex?

A

A type of lock that locks a section of code till it completes then unlocks it.

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

What is deadlock?

A

The situation where a thread or threads rely on a mutually blocked resource that will never become available.

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

How does a lock guard work?

A

It locks a lock in its constructor and unlocks it in its destructor automatically unlocking when the lock guard goes out of scope.

17
Q

How does a condition variable differ from a mutex?

A

It can be shared across threads and used for one thread to notify other threads when something happens. A thread can also use this to wait until it is notified.

18
Q

What is a semaphore?

A

A variable that lets you manage a count of finite resources. The count is incremented by calls to release and decremented by calls to acquire.

19
Q

How can a deadlock be prevented?

A

1) By always locking mutexes in the same order
2) By using std::lock to automatically lock multiple mutexes
3)By avoiding circular wait conditions

20
Q

What is a spurious wakeup in C++ multithreading?

A

A situation when a thread wakes up randomly without being notified.

21
Q

What is function overloading?

A

The ability to define multiple functions with the same name but different parameter lists within the same scope.