Skip to content

Course home

Subprograms

Subprograms

EasyMedium
123456789101112131415161718192021222324252627282930
Question 14

Read the following subprogram written in pseudocode:

function processTemperatures(readings)
    total = 0
    count = 0
    for temp in readings
        if temp > 0 then
            total = total + temp
            count = count + 1
        endif
    endfor

    if count > 0 then
        result = total / count
        return result
    else
        return -1
    endif
endfunction

Describe the purpose of the processTemperatures subprogram.

[2]
Markscheme

Subprograms Questions

  1. IGCSE
  2. /Computer Science
  3. /Subprograms

33 exam-style questions on Edexcel IGCSE Computer Science Subprograms. Each one has a worked solution and a mark scheme showing where the marks go.

Question bank