wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Python review 1

Total questions: 23

Worksheet time: 11mins

Name
Class
Date
1.

is integer a number

a)

true

b)

false

2.

chose which is a floating point

a)

14

b)

15.5

3.

chose a string

a)

"tim"

b)

"tim

c)

'tim'

d)

"tim

e)

tim

4.

What in the name of the variable in this Python code?

a)

name

b)

input

c)

print

d)

("What is your name")

5.

Which of these is not an arithmetic operator?

a)

+

b)

-

c)

*

d)

=

6.
What symbol is used in python to assign values to a variable?
a)
equals =
b)
plus + 
c)
forward slash /
d)
asterisk *
7.

What will be the output?

name = "Dave"

print (name)

a)

Dave

b)

'Dave'

c)

name

d)

(name)

8.
Which statement correctly assigns the string "Tanner" to the variable name?
a)
name  = print( "Tanner")
b)
input("Tanner")
c)
name = "Tanner"
d)
name = input("Tanner")
9.
What does the print function do in python?
a)
It's a variable.
b)
It can input data.
c)

It displays an output

d)
It loops the code.
10.
In the following code, "city" is an example of a what?
a)
List
b)
Loop
c)
Variable
d)
Array
11.

The punctuation requirements for printing a string in Python are:

a)

( ) , ! and " "

b)

( ) and !

c)

( ) and " "

d)

" " and !

12.

What can be used to store information and values so that it can be used later?

a)

Graphic

b)

Variable

c)

Print

d)

Output

13.

What would print (10 + 16) produce?

a)

10

b)

16

c)

24

d)

26

14.

What is a input?

a)

To plug in something.

b)

A function that allows us to ask the user to enter some data.

c)

Data displayed on a screen.

d)

A function

15.

name=input("What is your name? ")

print("Your name is " + name)

What will be displayed if the user types in "Bob"?

a)

Your name is name

b)

name

c)

Bob

d)

Your name is Bob

16.
What Python command lets the user enter an answer to a question?
a)
answer()
b)
open()
c)
print()
d)
input()
17.
What syntax can you use to insert a line break between strings so that they appear over multiple lines?
a)
/
b)
\n
c)
\l
d)
n
18.
What will the output be from the following code?
print(3*4+5)
a)
27
b)
17
c)
12
d)
SyntaxError
19.

Code for

Five is greater than two!

a)

if 5 > 2:

print("Five is greater than two!")

b)

if 5 = 2:

print("Five is greater than two!")

c)

if 5 > 2: Print("Five is greater than two!")

20.

Insert the missing part of the code below to output

_________________ "My name is ".

a)

Print

b)

PRINT

c)

print

21.

The output of the program

x = 4

x = "Sally"

print(x)

a)

four

b)

Saly

c)

Sally

22.

This operator checks to see if one value is the same as the other value

a)

==

b)

!=

c)

>

d)

<

23.

What is the output of the following code snippet?

   x = 5

   if x > 3:

       print("Greater than 3")

   else:

       print("Less than or equal to 3")

  

a)

Greater than 3

b)

Less than or equal to 3

c)

Invalid syntax

d)

No output