Python Data Types and Variables Test
Learn about the many data kinds that may be stored in variables with this multiple-choice quiz on the subject. Learn more about assigning values to variables in Python with this interactive quiz.
The quiz contains
correct to pass the test.
- Read all the given answers and click over the correct answer.
Study Python Data Types and Variables for this test.
1. Determine the result of the following:
def func1(): x = 50 return x func1() print(x)
2. What follows from
False is printed if type() is a list
3. What does the following variable provide as an answer?
x = 75 def myfunc(): x = x + 1 print(x) myfunc() print(x)
For more, see Python Variables. Error
4. Inside a function, which of the following expressions should be used to set the value of the global variable ” x ” to 20?
x = 50 def fun1(): # your code to assign global x = 20 fun1() print(x) # it should print 20
x = 20 on a global scale
int x = global;
x = 20 on a worldwide scale.
The World x
x = 20
5. Get all the Strings that can be created in
str1 = 'str1'
str1 = "str1"
str1 = '''str'''
str1 = 'str1'
str1 = "str1""
str1 = '''str1''
This means that str1 Equals str (Jessa)
6. To make a string literal, choose the correct options.
For example, “Ault’Kelly str1 = “Ault’Kelly”
Ault Kelly’; str1 = “Ault”;
string1 = “Ault’Kelly”
7. Which data type best describes the
aTuple = (1, 'Jhon', 1+3j) print(type(aTuple[2:3]))
8. Which data type best describes
type(0xFF) number; print
9. What does this code produce in Python 3?
. (What format will the returned data be in)? Protip: Python’s range() function
10. I need to know the result of
True if print(type() is set)
11. Which data type best describes
type(10) float print
12. Determine the result of the following:
x = 50 def fun1(): x = 25 print(x) fun1() print(x)
13. What does the following code produce?
False True False True print(bool(0), bool(3.14159), bool(-3), bool(1.0+1j))
False False False True
Indeed Indeed False Indeed
True False True False