NEW
Font size
S
M
L
XL
WorksheetsComputer program introduction quiz
Total questions: 13
Worksheet time: 7mins
Name
Class
Date
1.
If I set a variable football and I want it to equal Green Bay Packers how would it be written in code?
a)
football = Green Bay Packers
b)
football = ¨Green Bay Packers¨
c)
Green Bay Packers = football
d)
¨Green Bay Packers¨ = football
2.
What is missing/wrong from this code
def baseball()
team = ¨Indians¨
return team
print(baseball())
def baseball()
team = ¨Indians¨
return team
print(baseball())
a)
colon
b)
semicolon
c)
Needs indented
d)
missing ()
3.
What is missing/wrong with the code:
def clothes(): pants = ¨blue jeans¨
return pants
print(clothes())
def clothes(): pants = ¨blue jeans¨
return pants
print(clothes())
a)
colon
b)
Needs indented/spaced
c)
semicolon
d)
missing ()
4.
What is missing/wrong from the code:
def food():
recipes = 100
return recipes
print food()
def food():
recipes = 100
return recipes
print food()
a)
colon
b)
semicolon
c)
Needs indented
d)
missing ()
5.
If I wanted to add two numbers together in the code how would I write them?
a)
addition = ¨35 + 45¨
b)
¨35 + 45¨ = addition
c)
addition = 35 + 45
d)
35 + 45 = addition
6.
If I wanted to write 7 ^ 3 in code how would I write that?
a)
exponent = 7^3
b)
exponent = 7 * 3
c)
exponent = 7 ** 3
d)
exponent = 7 *** 3
7.
If I wanted to write the code of how to subtract two numbers; how would I write that in code?
a)
subtraction = 7000 - 3567
b)
subtraction = ¨7000 - 3567¨
c)
7000 - 3567 = subtraction
d)
¨7000 - 3567¨ = subtraction
8.
If I wanted to change the stored data in the variable without changing the variable.
food = steak
print(food)
food = chicken
print(food)
food = steak
print(food)
food = chicken
print(food)
a)
Yes
b)
No
9.
If I wanted to change the stored data in the variable without changing the variable.
food = ¨steak¨
print(food)
food = ¨chicken¨
print(food)
food = ¨steak¨
print(food)
food = ¨chicken¨
print(food)
a)
Yes
b)
No
10.
If I wanted to change the variable football that equals the Cleveland Browns and I want to change it to the Green Bay Packers how would I do this? Without including the print statements.
a)
football = Cleveland Browns
football = Green Bay Packers
football = Green Bay Packers
b)
football = ¨Cleveland Browns¨
football = ¨Green Bay Packers¨
football = ¨Green Bay Packers¨
c)
football = Green Bay Packers
football = Cleveland Browns
football = Cleveland Browns
d)
football = ¨Green Bay Packers¨
football = ¨Cleveland Browns¨
football = ¨Cleveland Browns¨
11.
If I wanted to write the modulo of two numbers that equal 2 which one would give me that?
a)
modulo = 18 % 4
b)
modulo = ¨18 % 4¨
c)
modulo = 4 % 18
d)
modulo = ¨4 % 18¨
12.
If I want to set the variable dog to german shephard how would I write that?
a)
dog = german shephard
b)
dog = German Shephard
c)
dog = ¨german shepard¨
d)
dog = ¨German Shephard¨
13.
If I wanted to write 9 ^ 6 in code how would I write that?
a)
exponent = 9 ^ 6
b)
exponent = 9 *** 6
c)
exponent = 9 * 6
d)
exponent = 9 ** 6
Reset
