Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Python Mod 2 Sec 4

Total questions: 15

Worksheet time: 10mins

Name
Class
Date
1.

A variable in Python is:

a)

a fixed value that cannot be changed

b)

a container for storing data values

c)

a type of loop

d)

a function

2.

Which of the following is a legal identifier for a variable in Python?

a)

1variable

b)

_variable

c)

variable-1

d)

variable@

3.

Fill in the blank: Python is a ______-typed language, which means you don't need to declare variables in it.

a)

dynamically

b)

statically

c)

strongly

d)

weakly

4.

What is the output of the following code? var = 2 print(var)

a)

2

b)

var

c)

print(var)

d)

Error

5.

How can you combine text and variables in Python?

a)

By using the '+' operator

b)

By using the ',' operator

c)

By using the '%' operator

d)

By using the 'format()' method

6.

What is the variable in the code shown

a)

variable

b)

Name

c)

print

d)

name

7.

What will be the output of the following code? ```python x = 10 y = 5 print(x - y) ```

a)

`5`

b)

`15`

c)

`10`

d)

`Error`

8.

What will be the output of the following code? ```python x = 10 y = 5 print(x + y) ```

a)

`15`

b)

`10`

c)

`5`

d)

`Error`

9.

What will be the output of the following code?

x = 10

y = 5

print(x - y)

a)

5

b)

15

c)

10

d)

Error

10.

What is the output of the following Python code?

x = 5

y = 10

print(x * y)

a)

50

b)

15

c)

5

d)

10

11.

What will be the output of the following code?

x = 10

y = 5

print(x - y)

a)

5

b)

15

c)

10

d)

Error

12.

What is the output of the following code? ```python x = 5 y = 10 print(x * y) ```

a)

`50`

b)

`15`

c)

`5`

d)

`10`

13.

In Python, a variable needs to

a)

start with letter not number

b)

be stated before "print"

c)

have % symbols on either side

d)

Variable????? We don't need variables!!!!

14.

What is the output of the following code?

x = 5

y = 10

print(x * y)

a)

50

b)

15

c)

5

d)

10

15.

What is the variable in the code shown

a)

variable

b)

Name

c)

print

d)

name