The partially completed pseudocode for an algorithm to calculate the estimated remaining battery percentage of a drone during a flight mission is shown below. It uses a subprogram.
Complete the pseudocode by supplying the correct terms, parameters, or statements for the blanks on Line 7, Line 8, Line 22, and Line 32.
5 SET status TO "System Ready"
6
7 _____ estimateRemainingBattery ( _____ )
8 BEGIN _____
9 SET status TO "Calculating drone battery metrics..."
10 # calculate total battery consumed
11 SET consumed TO inTime * inRate
12
13 # determine final battery percentage
14 SET finalBattery TO inStart - consumed
15
16 # print telemetry report
17 SEND status TO DISPLAY
18 SEND "Estimated Remaining Battery: " & finalBattery TO DISPLAY
19 SEND "Starting Level: " & inStart TO DISPLAY
20 SEND "Flight Duration: " & inTime TO DISPLAY
21 SEND "Discharge Rate: " & inRate TO DISPLAY
22 END _____
23
24 SEND status TO DISPLAY
25 # input starting level, flight time, and discharge rate
26 SEND "Enter starting battery percentage (e.g., 100.0):" TO DISPLAY
27 RECEIVE batteryPct FROM (REAL) KEYBOARD
28 SEND "Enter flight duration in minutes (e.g., 15.5):" TO DISPLAY
29 RECEIVE duration FROM (REAL) KEYBOARD
30 SEND "Enter average discharge rate per minute (e.g., 2.3):" TO DISPLAY
31 RECEIVE rate FROM (REAL) KEYBOARD
32 _____
29 exam-style questions on Edexcel GCSE Computer Science Subprograms, covering Built-in and user-devised subprograms, Functions versus procedures, and Global and local variables. Each one has a worked solution and a mark scheme showing where the marks go.