Python Variables Quiz for 8th Grade
Python Variables Quiz for 8th Grade
7. What is the correct way to create a variable named 'age' with a value of 13?
a. 13 = age
b. age == 13
c. variable age = 13
d. age = 13
11. What happens if you try to use a variable before assigning a value to it?
a. It automatically gets assigned a value of 0
b. Python assigns it a random value
c. You get a NameError
d. The program crashes
12. How can you check the data type of a variable in Python?
a. checktype(variable)
b. variable.type()
c. type(variable)
d. datatype(variable)
14. Which of these is a valid way to create multiple variables with the same value?
a. x, y, z == 1, 1, 1
b. x = y = z = 1
c. x = 1 & y = 1 & z = 1
d. (x, y, z) <- (1, 1, 1)