paper 1 exam q Flashcards

(7 cards)

1
Q

Explain one advantage to a structured approach to programming (2 marks)

A

Structured programs are easier to understand (1) as the program is split into smaller sections

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

Explain how a merge sort algorithm works (4 marks)

A

A list is divided into sub-lists at the midpoint until each sub-list is of length 1 (1)
the algorithm compares individual elements as pairs (1)
then the individual items are then merged back together into sub-lists (1)
until one list is produced in the right order (1)

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

State 3 advantages of using subroutines (3 marks)

A

subroutines can be developed independently (1)

Subroutines make it easier to discover errors in code (1)

subroutines make program code easier to understand (1)

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

State why having a clear identifier name is better than a letter (2 marks)

A

It describes the purpose of the variable (1)

This makes the algorithm easier to understand (1)

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

State why binary search is considered a better algorithm than linear search.

A

It is more efficient // requires fewer steps/comparisons (on average);

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

Describe how the linear search algorithm works.

A

Start at the beginning (of the array/list);
compare each element/item until the value being searched for is found;
or the end of the array/list is reached;

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