wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Python Revisoin

Total questions: 23

Worksheet time: 12mins

Name
Class
Date
1.

What is the output?

a)

Alison

b)

name

c)

6

d)

number

2.

Which of the following is NOT a valid conditional statement in Python?

a)

elif

b)

then

c)

if

d)

else

3.

Which character is used to start a Python comment?

a)

#

b)

&

c)

!

d)

/

4.

I need a program that will keep letting me add a monthly payment for 12 months.

a)

FOR Loop

b)

WHILE Loop

c)

if-statement

5.

What is the output?

a)

A

B

b)

A

C

c)

A

d)

C

6.

What would amount equal in this piece of code:

 

amount = 2 + 5 * 2

a)

12

b)

9

c)

14

d)

5

7.

When we want to test multiple conditions we use elif statement.

a)

True

b)

False

8.

There can be an else statement without an if statement.

a)

True

b)

False

9.

Which is the correct way to store an input as a variable in Python?

a)

answer("what is your name?")

b)

answer = input("what is your name?")

c)

input = "answer"(what is your name?)

d)

input=(what is your name?)

10.

Which value is a String?

a)

64

b)

"cat"

c)

True

d)

0.5

11.

What type of data is the following?: X = "195.67"

a)

Float

b)

String

c)

Boolean

d)

integer

12.

print("Python " * 3); will print out what

a)

Python 3 Python 3 Python 3

b)

PythonPythonPython

c)

Python Python Python

d)

Python*3 Python*3 Python*3

13.

To check if a person's age is more than 18 or no, what data type will you use?

a)

String

b)

Integer

c)

float

d)

boolean

14.

What is the output of the code?

a)

"String"

b)

18

c)

"No string"

d)

age

15.

Code executed based on a condition being true is:

a)

Sequence          

b)

Selection

c)

Variable

d)

Iteration                    

16.

What is the output from this program?

a)

condition

b)

True

c)

Program has a syntax error

d)

3 > 2

17.

Which syntax would you use to create a name variable?

a)

name=input()

b)

input=name

c)

name=input{}

d)

name=INPUT

18.

What will the output be from the following code? print("3+4")

a)

7

b)

3+4

c)

34

d)

“3+4”

19.

What will the output be from the following code? print(3*4+5)

a)

27

b)

17

c)

12

d)

syntax error

20.

What does the following code do? myAge = int (myAge)

a)

Converts the variable myAge to a string

b)

Converts the variable myAge to a integer

c)

Converts the variable myAge from a integer to a string

21.

What is the Python built-in function to converts a number to a string?

a)

str()

b)

int()

c)

parseInt()

d)

convert

22.

Which of these is correctly coded?

a)

num = int(input()

b)

num = int(input('Please enter a number: ')

c)

num = int(input('Please enter your age: '))

d)

num = input('Enter a number value )

23.

What is the answer to the expression , 22%3?

a)

5

b)

7

c)

0

d)

1