Font size
WorksheetsPython Chap 2-4
Total questions: 42
Worksheet time: 29mins
What will print to the screen?
age = 5
print(type<age>)
<type 'float'>
<type 'int'>
<type 'bool'>
<type 'string'>
What will print to the screen?
age = 5
young = age < 20
print(type<young>)
<type 'float'>
<type 'int'>
<type 'bool'>
<type 'string'>
What will be the output of this program?
A
B
C
A
I need to work on my grade.
prints nothing. The program doesn't compile.
What will the result of this code be?
var = True and True
print(var)
True
False
var
none of these
What will the result of this code be?
var = True or True
print(var)
True
False
var
none of these
What will the result of this code be?
var = True and False
print(var)
True
False
var
none of these
What is the result of this code?
8
8
9
10
8
9
10
11
8
11
8
10
What is the result of this code?
Issue Driver's License
Almost eligible for Driver's License
No requirements met.
none of these
What is the output?
more than 7
more than 23
spam
7
If you want to test more than one condition (chained condition), what do you use after if statement?
elif
else
ifif
else if
Which symbol means "not equal to"?
==
<=
>=
!=
Data type that can only be true or false
int
string
boolean
float
Which character must be at the end of the line for if?
:
;
.
{
Which of the following is true about if-elif-else statements?
After using if, an elif can be added as an additional test
The bodies of multiple elif’s can run
You can use an elif without an if
Code in an else body runs if all the tests before it were True
What is the output of this code?
w=50
q="Cathy"
50
50
Cathy
No Output
G="Joyce"
G='Joyce'
print G
This code will display what?
Joyce
No Output
joyce
Given this code:
M=25
M="Charlotte"
print(M)
What is the output?
Charlotte
"Charlotte"
25
What will this print to the screen?
print(2*4)
2*4
8
4
error
What do we use variables for?
To store data
Print data
Produce functions
To get the users input what function do we use?
input
input<>
input()
INPUT()
What does int() represent?
internet
integer
intel
input
Choose what / performs.
multiply
add
subtract
divide
Why would I get a syntax error?
Line 1 doesn't make sense
Line 2 needs to be indented
No need for quotation marks on line 2
No such thing as an if statement
What would be printed to the screen for print(z)?
Orange
Banana
Cherry
Hello World!
What will be printed to the screen?
5
10
5 + 10
15
print("Hello" + str(2) + "world!")
Which statement prints 7 (Select 2 answers)
print 7
print("7"
print("7")
print(3 + 4)
Which of the following is a command to have a message appear on the screen?
write
msg
input
Which of the following is used in Python to give a value to a variable
:=
==
=
How do you create a variable with the numeric value 5?
Both are correct
x=5
x=int(5)
How do you insert COMMENTS in Python code?
/*This is a comment*/
#This is a comment
//This is a comment
Any of the Above
What can be used to store information and values so that it can be used later?
Graphic
Variable
Output
What will be the output?
name = 'Dave'
print (name)
name
Dave
error
What would print (10 + 16) produce?
10
16
24
26
What is a input?
To plug in something.
A function that allows us to ask the user to enter some data.
Data displayed on a screen.
A function
Why do we learn Python?
It's a really big snake
It's the name of a very funny comedy show
It's simple and easy to learn
It's so rare that no one else knows it
print("Hello world!")
Whata data type would you use to store the number of students in a classroom
boolean(true/ false)
float (decimal numbers)
integers(No decimal/ whole numbers)
string(words/ letters)
