Algorithms Flashcards

1
Q

What is an algorithm?

A

An algorithm is 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

What is decomposition?

A

Breaking a complex problem into sub problems until each task is manageable, then solving each one individually

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

What is abstraction?

A

Removing unnecessary detail from a problem so you are left with important bits, simplifying the task

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

What is algorithmic thinking?

A

A logical way of getting from the problem to the solution. Acknowledging if certain bits of code can be reused

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

What must you always do in pseudocode?

A

Declare variables

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

What is efficiency in programming?

A

How much time is needed to a run a particular algorithm and how much space is needed

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

Which one is more efficient a bubble sort or a merge sort?

A

A merge sort

Splits and then merges instead of swapping each pair

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

Which is more efficient binary search or a linear search?

A

Binary search
Only when list is ordered
Keeps on cutting of half rather than checking each number

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

How would you address questions about abstraction?

A

1-definition
2-important detail
3-unnecessary detail

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

How do you address questions about decomposition?

A

1- definition

2- two questions you can think of to sub section

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

What is considered ‘time’ in programming?

A

How may number of times memory was accessed

The number of CPU cycles taken to execute the command

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

is a computer program an algorithm ?

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

Why use the correct data types?

A

As each data type is allocated a different amount of memory , using the correct data types makes the code more memory efficient , robust and predictable

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

What is program flow ?

A

The order in which statements are executed in a program

  • can be controlled used selection and iteration
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Write a pseudocode that creates a 6 digit username.
With the first 3 letters being from town first three letters
Then the second 2 digits being their current age
The last digit is the last letter of their surname

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

Why use meaningful identifiers ?

A
17
Q

What are arrays ?

A

A data structure where data values of the same type are stored and defined under one variable name.

18
Q

Why are subroutines good ?

A

🔵can be tested individually making it easier to debug .
🔵can be recalled many times within the program , rather than repeating sections of code (more efficient)
🔵can be stored as separate modules and reused in other programs

19
Q

What is a local variable

A

A variable that can only be used within the structure that they have been declared .
✅cannot and are not affected by anything outside a subroutine (same variable name can be used elsewhere )
✅✅