wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Python

Total questions: 13

Worksheet time: 7mins

Name
Class
Date
1.

What do we use variables for?

a)

To store data

b)

Print data

c)

Produce functions

2.

Evaluate

5 * 3 ** 2 + 3

a)

33

b)

48

c)

Error

3.

What would be printed to the screen?


x, y, z = "Orange", "Banana", "Cherry"

print(z)

a)

Orange

b)

Banana

c)

Cherry

d)

Orange, Banana, Cherry

4.

What will be printed to the screen?


x = 5

y = "John"

print (x + y)

a)

5 + John

b)

Syntax error - you cannot add str and int together

c)

John

d)

JohnJohnJohnJohnJohn

5.

In the following code, what value will be assigned to the variable "cat"?


mouse, cat, dog = "small", "medium", "large"

a)

small, medium, large

b)

small

c)

medium

d)

large

e)

Nothing, that operation will throw an error

6.

In python the ' boolean' data type can be defined as...?

a)

holds alphanumerical data

b)

holds whole numbers

c)

holds a number with a decimal point

d)

holds either true or false

7.

print(9>2 and 6<=6)

a)

TRUE

b)

FALSE

8.
Which of the following is the best definition of a VARIABLE?
a)
A variable is container of data
b)
A variable is piece of data
c)
A variable is a number
d)
A variable is a piece of text
9.
Python is...
a)
A low level programming language
b)
A visual programming language
c)
A high level programming language
10.

When a program RUNS but does not do what you expect, it means that your program contains...?

a)

A logic error

b)

A syntax error

11.

When a program does not run, it will be because of....

a)

A logic error

b)

A syntax error

12.

What are the different data types in Python?

a)

Monday, Tuesday, Wednesday

b)

Apple, banana, orange

c)

The different data types in Python include integer, float, string, boolean, list, tuple, dictionary, etc.

d)

Red, blue, green

13.

What is the difference between int and float data types in Python?

a)

int is used for decimal numbers while float is used for whole numbers

b)

int and float are the same data type in Python

c)

The main difference between int and float data types in Python is that int is used for integer values (whole numbers) while float is used for decimal or floating-point numbers.

d)

int is used for strings while float is used for numbers