Photo AI

The algorithm in Figure 4 is a sorting algorithm - AQA - GCSE Computer Science - Question 7 - 2021 - Paper 1

Question icon

Question 7

The-algorithm-in-Figure-4-is-a-sorting-algorithm-AQA-GCSE Computer Science-Question 7-2021-Paper 1.png

The algorithm in Figure 4 is a sorting algorithm. Array indexing starts at 0. Line numbers are included but are not part of the algorithm. Figure 4 arr <- {4, 1,... show full transcript

Worked Solution & Example Answer:The algorithm in Figure 4 is a sorting algorithm - AQA - GCSE Computer Science - Question 7 - 2021 - Paper 1

Step 1

State the data type of the variable swapsMade in the algorithm shown in Figure 4.

96%

114 rated

Answer

The data type of the variable swapsMade in the algorithm is Boolean (or bool). This indicates that swapsMade can hold one of two possible values: true or false.

Step 2

Explain why this is a better choice than using the identifier s.

99%

104 rated

Answer

Using the identifier swapsMade is preferable to s because it clearly describes the purpose of the variable. The name provides a meaningful context that makes the algorithm easier to understand and maintain. In contrast, s is vague and does not convey the variable's role, making the code harder to read and follow.

Step 3

Shade one lozenge to show which of the following contains the false statement about the algorithm in Figure 4.

96%

101 rated

Answer

B The algorithm uses indefinite iteration.

Step 4

Complete the trace table for the algorithm shown in Figure 4. Some values have already been entered.

98%

120 rated

Answer

arrswapsMadeit
[0]104
4 1 6false
true
1 4 6false
true

Step 5

Complete the trace table for the algorithm shown in Figure 4. Some values have already been entered.

97%

117 rated

Answer

arrswapsMadeit
[0]104
4 1 6false
true
1 4 6false
true

Join the GCSE students using SimpleStudy...

97% of Students

Report Improved Results

98% of Students

Recommend to friends

100,000+

Students Supported

1 Million+

Questions answered

Other GCSE Computer Science topics to explore

;