Note AcademyNote Academy

Computer Science · Oct / Nov 2024 · Paper 21 · Question 9

0478

As printed in the paper

The question as text

An algorithm has been written in pseudocode to check if a temperature is in a given range. The temperature values used in the algorithm are correct. € ˆ„«„‡ €‘ ˜¼«¼ ½«²¾¬­¾ ¾¿¹¾° ¹¾ÀÁ¾°¬¹Â°¾ ½ €’ Ž«¼ ¾ÀÁ €“ — ¾ÀÁ¾°¬¹Â°¾ à ššš €‹ ›„Ž €• — ¾ÀÁ¾°¬¹Â°¾ Ä ’™¸€ €– ›„Ž €™ ˜¼«¼ ½¾ÀÁ¾°¬¹Â°¾ ¹¯¯ ÅÆÇŽ €š „Žƒ— € — ¾ÀÁ¾°¬¹Â°¾ È ’‹¸€  ›„Ž ‘ ˜¼«¼ ½¾ÀÁ¾°¬¹Â°¾ ¹¯¯ ²¯®½ ’ „Žƒ— “ — ¾ÀÁ¾°¬¹Â°¾ Äà ’‹¸€ ˜ˆ ¾ÀÁ¾°¬¹Â°¾ Èà ’™¸€ ‹ ›„Ž • ˜¼«¼ ½¾ÀÁ¾°¬¹Â°¾ ¿¯°À¬²½ – „Žƒ— ™ „Žƒ— š ɛ†„ ¾ÀÁ¾°¬¹Â°¾ à ššš

Read automatically from the paper; the printed page above is exact.

Show the answer and mark scheme
  • 9(a)[4]

    One mark for each error identified and correction:

    Line 03 Temp should be Temperature
    Line 04 = should be <>
    Line 14 OR should be AND
    Line 19 WHILE should be UNTIL

    01 REPEAT

    02 OUTPUT "Please enter temperature "

    03 INPUT Temperature

    04 IF Temperature <> 999

    05 THEN

    06 IF Temperature > 38.0

    07 THEN

    08 OUTPUT "Temperature too high"

    09 ENDIF

    10 IF Temperature < 35.0

    11 THEN

    12 OUTPUT "Temperature too low"

    13 ENDIF

    14 IF Temperature >= 35.0 AND Temperature <= 38.0

    15 THEN

    16 OUTPUT "Temperature normal"

    17 ENDIF

    18 ENDIF

    19 UNTIL Temperature = 999

  • 9(b)[2]

    One mark for each point

    greater than or equal to 35
    and less than or equal to 38
  • 9(c)[2]

    One mark for each correct column max two

    Temperature

    OUTPUT

    (Please enter temperature)

    34.22

    Temperature too low

    (Please enter temperature)

    36.1

    Temperature normal

    (Please enter temperature)

    37.4

    Temperature normal

    (Please enter temperature)

    38.0

    Temperature normal

    (Please enter temperature)

    999

Make a free account to save your answers and see your weak topics and ask the AI why a wrong answer is wrong.