Data structures

EasyMedium
1234567891011121314151617181920212223
Question 19
Easy

An algorithm, written using pseudo-code, utilizes a RECORD data structure to store information about video games.

RECORD Game
    title : String
    genre : String
    rating : Real
    isReleased : Boolean
ENDRECORD

portal ← Game('Portal', 'Puzzle', 9.5, True)
minecraft ← Game('Minecraft', 'Sandbox', 9.0, True)
hades ← Game('Hades', 'Roguelike', 9.0, True)
gameLibrary ← [portal, minecraft, hades]
maxRating ← 0.0
position ← 0

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

OUTPUT gameLibrary[position].title, ' has the highest rating'

Which assignment statement changes the rating of the game Minecraft to 9.5?

minecraft.rating ← 9.5

gameLibrary[0].rating ← 9.5

Game(rating) ← 9.5

minecraft(rating) ← 9.5

Data structures Questions

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