Photo AI

The algorithm in Figure 2 has been developed to automate the quantity of dog biscuits to put in a dog bowl at certain times of the day - AQA - GCSE Computer Science - Question 3 - 2021 - Paper 1

Question icon

Question 3

The-algorithm-in-Figure-2-has-been-developed-to-automate-the-quantity-of-dog-biscuits-to-put-in-a-dog-bowl-at-certain-times-of-the-day-AQA-GCSE Computer Science-Question 3-2021-Paper 1.png

The algorithm in Figure 2 has been developed to automate the quantity of dog biscuits to put in a dog bowl at certain times of the day. - Line numbers are included ... show full transcript

Worked Solution & Example Answer:The algorithm in Figure 2 has been developed to automate the quantity of dog biscuits to put in a dog bowl at certain times of the day - AQA - GCSE Computer Science - Question 3 - 2021 - Paper 1

Step 1

Shade one lozenge which shows the line number where selection is first used in the algorithm shown in Figure 2.

96%

114 rated

Answer

The line where selection is first used is Line 2, as this is where the first IF condition appears.

Step 2

Shade one lozenge which shows the line number where iteration is first used in the algorithm shown in Figure 2.

99%

104 rated

Answer

The line where iteration is first used is Line 11, as it is where the FOR loop starts.

Step 3

Shade one lozenge which shows how many times the subroutine DISPENSE_BISCUIT would be called if the user input is 'breakfast' in Figure 2.

96%

101 rated

Answer

The subroutine DISPENSE_BISCUIT would be called 1 time because when the input is 'breakfast', q is set to 1.

Step 4

Shade one lozenge which shows the data type of the variable time in the algorithm shown in Figure 2.

98%

120 rated

Answer

The data type of the variable time is String, as it stores text inputs like 'breakfast', 'lunch', or 'dinner'.

Step 5

State how many times the subroutine DISPENSE_BISCUIT will be called with the parameter 'chewies' if the user input is 'lunch' in Figure 2.

97%

117 rated

Answer

The subroutine DISPENSE_BISCUIT will be called 2 times with the parameter 'chewies' if the user input is 'lunch' since 'lunch' sets q to 4.

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

;