What does this code print? print("Hello, World!")
A) Hello, World!
B) Error
C) hello, world!
D) "Hello, World!"
A) Hello, World!
Which line correctly stores a number in a variable?
A) 5 = score
B) score = 5
C) var score 5
D) score: 5
B) score = 5
What does this code print?
x=10
if x > 5:
print("Big")
A) Big
B) x > 5
C) Error
D) Nothing
A) Big
How many times does this loop print?
for i in range(3):
print("Go!")
A) 3
B) 4
C) 2
D) 1
A) 3
Which keyword is used to create a function?
A) define
B) function
C) def
D) funct
C) def
What does this code print?
x=5
print(x+3)
A) x + 3
B) Error
C) 53
D) 8
D) 8
What is the value of the score after this code?
score = 10
score = score + 5
A) 105
B) 10
C) 5
D) 15
D) 15
What does this code print?
age = 8
if age > 10:
print("Old")
else:
print("Young")
A) Old
B) Young
C) Nothing
D) age
B) Young
What does this code print?
total = 0
for i in ange(1, 4):
total = total + i
print(total)
A) 6
B) 123
C) 4
D) 3
A) 6
What does this code print?
def greet():
print("Hello!")
greet
A) Nothing
B) def greet
C) greet()
D) Hello!
D) Hello!
What does this code print? print("Score:",10)
A) 10
B) Score: 10
C) "Score:" 10
D) Score:10
B) Score: 10
What data type is name?
name = "Python"
A) integer
B) float
C) boolean
D) string
D) string
Which symbol means 'is equal to' in Python?
A) =>
B) !=
C) ==
D) =
C) ==
What kind of loop runs while a condition is True?
A) repeat loop
B) for loop
C) if loop
D) while loop
D) while loop
What does this function return?
def add(a, b):
return a + b
print(add(3, 4))
A) 4
B) a+b
C) 3
D) 7
D) 7
What does this code print?
name = "Leo"
print("Hi", name)
A) Hi name
B) name
C) Hi Leo
D) Hi 'Leo'
C) Hi Leo
What does this code print?
x=10
y=3
print(x-y)
A) x-y
B) 103
C) 13
D) 7
D) 7
What does this code print?
n = 7
if n % 2 == 0:
print("Even")
else:
print("Odd")
A) Error
B) 7
C) Odd
D) Even
C) Odd
What does range(2, 6) produce?
A) [2,3,4,5,6]
B) [2,4,6]
C) [2,3,4,5]
D) [1,2,3,4,5,6]
C) [2,3,4,5]
What is wrong with this function call?
def say_hi():
print("Hi!")
Say_Hi()
A) Nothing wrong
B) Missing Colon
C) Missing print
D) Wrong name- Python is case sensitive
D) Wrong name- Python is case sensitive
What does this code print?
a=3
b=4
print(a*b)
A) 34
B) 7
C) ab
D) 12
D) 12
What is the value of total at the end?
total = 0
total = total + 4
total = total + 6
A) 4
B) 10
C) 46
D) 6
B) 10
What does this code print?
score = 90
if score >= 90:
print("A")
elif score >= 80:
print("B")
else:
print("C")
A) C
B) 90
C) B
D) A
D) A
What does this code print?
words = ["cat","dog","fish"]
for w in words:
print(w)
A) cat dog fish
B) words
C) cat dog fish (one line)
D) Error
A) cat dog fish
What does this code print?
def double(n):
return n * 2
print(double(double(3)))
A) 12
B) 6
C) 3
D) 9
A) 12