Menu

Variables

Card 1 of 19 0 got it 0 still learning
Question
TapClick or press space to see the answer
Answer
All 19 cards in this set
Which term describes a named location in memory that holds a value which can change while the program is running?
Variable
What is meant by a temporary variable?
A variable used to hold one value briefly while two other values are swapped
Which term describes the process of giving a value to a variable using the = symbol?
Assignment
Which term describes a variable whose value is increased by adding each new amount to the value that it already holds?
Running total
Which term describes a variable name such as totalCost, where the words are joined and each word after the first begins with a capital letter?
CamelCase
Which term describes a word such as if or while that Python keeps for its own use and that cannot be used as a variable name?
Keyword
Which characters may be used in a Python variable name?
Letters, digits and underscores
A program runs the line total = total + price, but total has never been given a value. What is the problem?
Total has no value, so the program stops with an error
The variable score holds the value 10. What is displayed by print('score')?
The word score
What does this program print?
4
What does this program print?
10 then 6
What does this program print?
3 then 7
Which of these is NOT a valid variable name in Python?
Total cost
In the line area = 3.142 * radius * radius, which names are the variables?
Both area and radius
A programmer needs a variable to store the score of the current player. Which name is best?
PlayerScore
A variable called score holds the value 10. The program then runs the line score = 25. What happens to the value 10?
It is replaced by 25 and lost
A programmer writes the line 2ndScore = 10 in a program, but the line causes an error. Why?
A variable name cannot start with a digit
A program counts how many items it has processed, using a variable called count. Which line increases count by one and stores the new value?
Count = count + 1
A program stores the length of a rectangle in length and its width in width. Which line calculates the area and stores it in the variable area?
area = length * width