SSD - 1. Programming Paradigms Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

What is a class?

A

A class is a blueprint that sets out what data the object can use (its instance variables) and what it can do (its methods)

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

What are instance variables?

A

These are the variables that the object can use once created

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

What are methods?

A

Methods are the instructions that tell the object what it can do and how it can change the data in instance variables. Methods are defined in the class that was used to create the object. Methods can be function methods (always return one value) or procedure methods (may or may not return a value).

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

What is an object?

A

An object is an instance of a class and it inherits the methods and instance variables of that class

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

What is instantiation?

A

Instantiation is the process of creating an object from a class

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

What is inheritance?

A

This is when a new object receives the instance variables and methods that were defined in the class

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

What is encapsulation?

A

Encapsulation is the idea that objects are closed systems and their instance variables and methods cannot be modified from the outside

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

What are messages?

A

Messages are how objects tell other objects to perform a task such as run. They are also used to pass data between objects

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

What is concurrent programming?

A

Concurrent programming is allowing various processes to share access to the processors at the same time

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

What is a thread?

A

A thread is a task or a process that needs access to resources (a sequence of instructions)

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

What can streams sometimes do (negative)?

A

Streams can sometimes communicate and interfere with each other

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

What can streams do?

A

Streams of threads can run concurrently, maximising the use of processors. A stream is a set of threads that need to run at the same time.

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

What are the advantages of threads?

A
  1. Tasks can run while users are interacting with applications
  2. Tasks that take a long time to run will not delay tasks that only need a short time to run
  3. complex programs can make better use of multiple resources in new multi-core processor architectures
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What problems are there with multi-threaded programs?

A
  1. Deadlock - Two threads competing for processor time, each waiting for the other to finish. Both in a waiting state.
  2. Race condition - Two threads may need access or alter the same variable. A system needs to lock threads from accessing the same variable
  3. Resource starvation - A thread accesses resources, locking out lower priority threads. Lower priority threads do not get access. Thread scheduling needs to ensure that all threads get access to necessary resources
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is concurrency control?

A

Concurrency control is a system that coordinates the interactions between threads so that they are all correctly scheduled and resources are shared among operations based on the priority assigned to a thread

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