Roadmap

Question of the Day, INSERT

The question of the day for January 24 shows an incorrect answer.

names ← [“Karel”, “Tracy”]

APPEND(names, “Monty”)

INSERT(names, LENGTH(names) - 1, “Fido”)

REMOVE(names, 3)

DISPLAY(names[2])

The append will add Monty to the end of the list.

[“Karel”, “Tracy”, “Monty”]

Insert will add “Fido” at position 2.

[“Karel”, “Fido”, “Tracy”, “Monty”]

Remove will delete Tracy.

[“Karel”, “Fido”, “Monty”]

Display will print Fido. The answer graded as correct is Tracy. This seems wrong.