Data structures

EasyMedium
1234567891011121314151617181920212223
Question 21
Easy

Refer to the following pseudocode algorithm:

RECORD Game
    title : String
    genre : String
    releaseYear : Integer
    isMultiplayer : Boolean
ENDRECORD

minecraft ← Game('Minecraft', 'Sandbox', 2011, True)
portal ← Game('Portal', 'Puzzle', 2009, False)
terraria ← Game('Terraria', 'Sandbox', 2011, True)
gameLibrary ← [minecraft, portal, terraria]
latestYear ← 0
position ← 0

FOR i ← 0 TO 2
    IF gameLibrary[i].releaseYear > latestYear THEN
        latestYear ← gameLibrary[i].releaseYear
        position ← i
    ENDIF
ENDFOR

OUTPUT gameLibrary[position].title, ' is the newest game'

Which assignment statement changes the release year of the game Portal to 2007?

portal.releaseYear ← 2007

gameLibrary[0].releaseYear ← 2007

Game(releaseYear) ← 2007

portal(releaseYear) ← 2007

Data structures Questions

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