Topic 2.1 - Algorithms Flashcards

(40 cards)

1
Q

What is an algorithum?

A

A sequence of steps that can be followed to complete a task.

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

Define algorithmic thinking.

A

Is a method for solving complex problems using three principles.

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

What are the three principles of computational thinking?

A

Abstraction, Decomposition, Algorithmic thinking

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

Define abstraction and why is it useful.

A

Abstraction is the process of simplifying a problem by ignoring irrelevant data and focusing only on the most important details.

Abstraction helps simplify complex problems. When programming abstraction makes it easier to understand, maintain and reuse code.

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

What are examples of abstraction?

A

Sort and randint.

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

Define decomposition.

A

Breaking down complex problems into smaller more manageable subproblems that are easier to solve

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

Define algorithmic thinking.

A

This is the process of designing a step by step plan or set of instructions to solve a problem.

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

What are the three ways to write algorithum?

A

Pseudocode, flowchart and program code.

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

What is pseudocode?

A

Pseudocode is a way of writing informal instructions in a code like format.

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

What is a flowchart?

A

A visual way of representing the steps in a algorithm using specific shapes.

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

What is program code?

A

Programmers use high level programming languages like python and java to write code that is translated into a format the CPU can understand and execute.

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

Define input?

A

The data entered into a system. This can be manually entered by a human for example typing on a keyboard or automatic.

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

Define processes.

A

The actions taken by computer, often using input data.

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

Define output.

A

Information provided to the user after processing.

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

What is a linear search?

A

Compares each item one by one until target is found.
No need for the list to be in order.

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

What is binary search?

A

Compares middle term to the target. Discards half of the list the target can’t be in.
Finds the next middle term and repeats until the target is found.

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

What is advantage and disadvantage of binary search?

A

More time efficient than linear search.
But needs to be ordered before hand.

18
Q

What is bubble sort?

A

In one pass, go through each pair swapping if needed.
Repeats passes until a pass happens with no swaps.

19
Q

What is merge sort?

A

In merge sort divides the list continuously by two Until each list has 1 item.
Then combines two lists at a time, keeping items in order.

20
Q

What is insertion sort?

A

Starts with 1 item in the ‘sorted part’ and moves item one by one from the unsorted part to the sorted part.

21
Q

What are the 5 data types and describe them.

A

Integer (int) - A whole number
Real or float - A number with a fractional part.
Boolean - True or false
Character - A Letter number or symbol.
String - A group of characters. if it has “” around it.

22
Q

What are the arithmetic opperations?

A
  • = Multiplication
    ^ = Exponentiation (to the power of)
    / = Division
    DIV = Division but cuts of decimals.
    MOD = Gives you remainder when dividing.
23
Q

What are the comparison fundamentals?

A

Equal to - ==
Not equal to - !=
Greater than - ?
Greater than or equal to - >=

24
Q

What are the basics of boolean?

A

NOT = Flips the value
AND = Both sides needed
OR = Only one side needed

25
What are the string handling methods?
Concatenation: Joining two or more strings together with a +. Length: Finding how many characters are in a string use len. Indexing: Accessing a specific character by its position. Slicing: Extracting part of a string. Changing case: Making all letters uppercase or lowercase. Finding substrings: Checking if one string is inside another or finding its position.
26
What are the two types of testing.
Iterative - testing modules throughout development any issues found will be fixed and the module restarts. Terminal - Testing of the whole program at the end of development.
27
What are the two types of errors?
Syntax error - Not following the rules of the language. Code won't run. Logic error - Code does not run as you intend. Code runs but result is unexpected.
28
What is validation?
Is enforcing a rule around user input.
29
What is authentication?
Checks the identity of a user.
30
How should you test robustness of a program?
Normal - Typical user input Boundary - On the edge of being allowed Invalid/Erroneous - Completly wrong.
31
What is the difference between invalid and erroneous?
Invalid = Correct data type Invalid = Incorrect data type
32
What is the symbol for NOT gate and the truth table for it?
33
What is the symbol for AND gate and the truth table for it?
33
What is the symbol for OR gate and the truth table for it?
34
Define high level language and the pros and cons.
Like written English More readable Portable - can run on many CPU's Slower to execute.
35
Define low level language and the pros and cons.
Assembly code - Uses bits of english not much Machine code - Uses binary Easier to optimise Does not need to be translated Specific to particular CPU and hard to write
36
What is a translater?
Converts one language to another.
37
What does a compiler do?
High level to --> machine code Produces an executable so you can run it. No source code is needed afterwards Fast to execute Errors only shown at the end.
38
What does a interpreter do?
High level to machine code. Translates an instruction then executes it. Source code needed to run. Errors discovered straight away. Slower to execute.
39
What is IDE for?
Provides an editor Providing error diagnostic tools Having a run-time environment Using translator so it can run