NEW
Font size
S
M
L
XL
WorksheetsChapter 2 Python
Total questions: 13
Worksheet time: 26mins
Name
Class
Date
1.
Which of the following is NOT a Python data type?
a)
int
b)
float
c)
str
d)
box
2.
What is the proper way to compute 7 to the power of 2 (or 7 squared)?
a)
7^2
b)
7*2
c)
7**2
d)
7pwr2
3.
To create a comment on Python, which of the following symbols must be used?
a)
>>>
b)
#/
c)
!
d)
#
4.
What is a floating-point number?
a)
A number with decimal parts
b)
A whole number
c)
A negative number
d)
A number in scientific notation.
5.
Python follows order of operations (sometimes referred to as PEMDAS).
a)
TRUE
b)
FALSE
6.
name = "Suzie"
What is the data type for the value stored into name?
What is the data type for the value stored into name?
a)
Str
b)
Int
c)
Name
d)
Spec
7.
month = 4.0
What is the data type for the value stored into month?
What is the data type for the value stored into month?
a)
Int
b)
Float
c)
Str
d)
Complex
8.
date = 'April 4'
What is the data type for the value stored date?
What is the data type for the value stored date?
a)
Str
b)
Int
c)
Str and Int
d)
Float
9.
gpa = raw_input('What is your High School GPA?')
What is the data type for the value stored into gpa?
What is the data type for the value stored into gpa?
a)
Int
b)
Float
c)
Str
d)
Cannot be determined
10.
Simply typing 24/5 into Python interpreter will return what value?
a)
4
b)
4.8
c)
5
d)
error
11.
Which of the following is a proper variable name?
a)
1234username
b)
$name
c)
revenue_jan
d)
@-!
12.
hours = raw_input('How many hours did you work this week?')
Moe types 20. This information is stored as a string. What is the correct code to convert to a floating-point number?
Moe types 20. This information is stored as a string. What is the correct code to convert to a floating-point number?
a)
hours = float(hours)
b)
hours = float-hours
c)
hours = int(hours)
d)
convert(hours): float
13.
When typing a string into a variable, you must use single, double, or triple quotes. An example is shown:
name = "Carrie is cool"
Should you also use quotes to store a number into a variable, as shown below?
age = "20"
name = "Carrie is cool"
Should you also use quotes to store a number into a variable, as shown below?
age = "20"
a)
Yes
b)
No
Reset
