Data structures

EasyMedium
1234567891011121314151617181920212223
Question 14
Easy

Refer to the following algorithm which uses a RECORD data structure to store details about endangered species in a wildlife reserve.

RECORD Species
    commonName : String
    population : Integer
    conservationStatus : String
    isProtected : Boolean
ENDRECORD

blueWhale ← Species('Blue Whale', 15000, 'Endangered', True)
snowLeopard ← Species('Snow Leopard', 4500, 'Vulnerable', True)
tasmanianDevil ← Species('Tasmanian Devil', 12000, 'Endangered', False)
wildlifeReserve ← [blueWhale, snowLeopard, tasmanianDevil]
minPopulation ← 999999
position ← 0

FOR i ← 0 TO 2
    IF wildlifeReserve[i].population < minPopulation THEN
        minPopulation ← wildlifeReserve[i].population
        position ← i
    ENDIF
ENDFOR

OUTPUT wildlifeReserve[position].commonName, ' has the lowest population count.'

Write a pseudo-code statement that updates the tasmanianDevil record to show that the species is currently protected.

[1]

Data structures Questions

  1. GCSE
  2. /Computer Science
  3. /Data structures