passdrill
School · Coding & Computers · Card 008/010 medium

A programmer writes 'score = 0' at the start of a game's code, then later writes 'score = score + 10' every time points are earned. What does this show about what a 'variable' is in programming?

  1. A variable is a fixed value that, once set in the code, can never be changed while the program runs
  2. A variable is a named container that stores a value which can be read and changed while the program runs, letting 'score' hold different numbers at different points in the game
  3. A variable is a comment left in the code to explain what a line does, which the computer ignores when running the program
  4. A variable is a fixed instruction telling the computer to display a value on the screen
Next card → Shuffle