Lesson 2 Activity: Data Types and Variables Quiz

Uh oh... it's time for a quiz. But don't worry, this isn't a classroom or anything! You won't be graded. This is just to see if you're paying attention. Good luck and have fun!


1. What is a variable and what is a data type?



2. If I write
print(21 % 5)
what will the computer print?



3. What does the following code print?

x = 7
print("This number is ", x)



4. What does the following code print?

x = 9
y = 10
a = x + y
print(a)



5. If I write
x = 1.0
, does it become a decimal or a whole number?



You didn't think we'd leave you without an idea of the right answers, did you? Well take a look at them below.


1. What is a variable and what is a data type?

Answer: A variable stores information, and a data type is a category of information.



2. If I write
print(21 % 5)
what will the computer print?

Answer: 1



3. What does the following code print?

x = 7
print("This number is ", x)


Answer: This number is 7



4. What does the following code print?

x = 9
y = 10
a = x + y
print(a)


Answer: 19



5. If I write
x = 1.0
, does it become a decimal or a whole number?

Answer: Decimal