Photo AI

Figure 10 shows part of an algorithm that has been written in pseudo-code - AQA - GCSE Computer Science - Question 11 - 2023 - Paper 1

Question icon

Question 11

Figure-10-shows-part-of-an-algorithm-that-has-been-written-in-pseudo-code-AQA-GCSE Computer Science-Question 11-2023-Paper 1.png

Figure 10 shows part of an algorithm that has been written in pseudo-code. There is an error in the algorithm. The algorithm should: - get the start year and end y... show full transcript

Worked Solution & Example Answer:Figure 10 shows part of an algorithm that has been written in pseudo-code - AQA - GCSE Computer Science - Question 11 - 2023 - Paper 1

Step 1

Normal

96%

114 rated

Answer

Test Data:

  • startYear: 1995
  • endYear: 2010

ValidChoice Result: False

Difference Calculation: The start year is valid, and the end year is also valid. The difference is calculated as follows:

difference=endYearstartYear=20101995=15difference = endYear - startYear = 2010 - 1995 = 15

Therefore, the validChoice is False indicating that the input is still being processed.

Step 2

Erroneous

99%

104 rated

Answer

Test Data:

  • startYear: 2015
  • endYear: 2000

ValidChoice Result: False

Difference Calculation: The start year (2015) is not before the end year (2000), therefore, according to the algorithm, it prompts the user with an error. The validChoice remains False, with a difference calculation resulting in:

difference=endYearstartYear=20002015=15difference = endYear - startYear = 2000 - 2015 = -15

Since there was an error, we consider the difference as -1.

Step 3

Boundary

96%

101 rated

Answer

Test Data:

  • startYear: 2000
  • endYear: 2023

ValidChoice Result: True

Difference Calculation: The start year is set to 2000, which is acceptable (as the algorithm checks if the start year is before 2000 without issue). Thus, there is no error, and the validChoice is True. The difference is calculated as follows:

difference=endYearstartYear=20232000=23difference = endYear - startYear = 2023 - 2000 = 23

This indicates that the value obtained is 23.

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

;