Unit 1 Flashcards

1
Q

List the 5 Data Processing Functions

A

Sorting, Conversion, Analysis, Reporting, Aggregation

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

List the 4 traits of good data

A

Reliable - Same data gives same results
Economical - Is not expensive to collect
Flexible - Can be used in all relevant circumstances
Relevant - Fit for purpose

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

List the 4 parts of the event loop, in order

A

Event
Trigger
Event Handler
Event Loop

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

How does quick sort work?

A

1 - Choose a pivot element.
2 - Iterate through each element.
3 - Each element less than the pivot element is placed in one sub-list, and all elements greater than the pivot element are placed in another.
4 - Repeat steps 2/3 on each sublist, until all the sublists have a length of one.
5 - Merge all the sublists.

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

What are the pros and cons of quick sort?

A

Pros:

  • Since the list is split, no more storage is needed.
  • Fast with large lists

Cons:
- Worst case performance is similar to bubble/insertion

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

How does insertion sort work?

A

Iterate through each element, compare to element before it. If smaller, compare to next etc until you find the right place to put it.

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

What are the pros and cons of insertion sort?

A

Pros:

  • Simple to write
  • Sorts in-place so minimum memory requirements

Cons:
- Poor performance, performs badly with large datasets

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

How does bubble sort work?

A

Iterate through each element, if the next element is smaller, swap them. Keep iterating through the dataset until no changes are made.

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

What are the pros and cons of bubble sort?

A

Pros:

  • Simple to write
  • Easy to understand
  • Sorted in place so little memory overhead

Cons:
- Not very efficient, time to process increases exponentially as data set size increases

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

Properties of a tuple

A
  • Ordered
  • Indexable
  • Immutable
  • Static
  • Duplicate elements are allowed
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Properties of a set

A
  • Unordered
  • Immutable
  • Dynamic
  • Non-indexed
  • Duplicate elements are not allowed
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Properties of a dictionary

A
  • Unordered
  • Dynamic
  • Mutable
  • Duplicate keys not allowed
  • Fast to search
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What are the primitive data types?

A
  • Integer
  • Float/Real
  • String
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is a record?

A

Stores related data. Implemented in Python as a dictionary inside of a dictionary.

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

What is polymorphism?

A

When code has different forms for multiple different contexts (usually with different data types) and still works.

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

What is encapsulation?

A

When a variable can only be accessed from within an object, and not from outside of it.

17
Q

What is overloading?

A

When multiple functions are defined with the same name but are called depending on argument types.

18
Q

What does OOP stand for?

A

Object Oriented Programming

19
Q

What is a class?

A

The blueprint for an object

20
Q

What is a method?

A

The associated actions of an object

21
Q

What is an instance?

A

An individual object created from a class

22
Q

What is an object?

A

A collection of data and its associated actions (methods)

23
Q

What is an attribute?

A

The individual properties of an object

24
Q

What is a subroutine?

A

A sequence of code that performs a specific task. This sequence of code can be called from wherever it is required.

25
Q

What is a procedure?

A

A subroutine that does not return a result

26
Q

What is a function?

A

A subroutine that returns a result

27
Q

What is the difference between a parameter and an argument?

A

Parameters the inputs of a subroutine. They are defined along with the subroutine (inside the brackets).

Arguments are the values that are given to the subroutine when it is called.

E.g.
def myFunc(parameter1, parameter2):

myFunc(argument1, argument2)

28
Q

Why should you generally avoid the use of global variables?

A
  • They increase the complexity of the program
  • They can cause conflicts with names written elsewhere
  • They may be changed inadvertently