wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Grade 7

Total questions: 21

Worksheet time: 12mins

Name
Class
Date
1.

Is Python case sensitive when dealing with identifiers?

a)

Yess

b)

No

2.

Which of the following is an invalid variable?

a)

my_string_1

b)

1st_string

c)

foo

d)

_

3.

Which is the correct operator for power(xy)?

a)

X^y

b)

X**y

c)

X^^y

4.

Which one of these is floor division?

a)

/

b)

//

c)

%

5.

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

a)

7

b)

1

c)

0

d)

4

6.

Mathematical operations can be performed on a string.

a)

True

b)

False

7.

What is the output of this expression, 3*1**3?

a)

27

b)

9

c)

3

d)

1

8.

Which one of the following has the same precedence level?

a)

Addition and Subtraction

b)

Multiplication, Division and Addition

c)

Addition and Multiplication

9.

The expression Int(x) implies that the variable x is converted to integer.

a)

True

b)

False

10.

Insert the missing part of the code below to output "Hello World".

(a)   ("HELLO WORLD")

11.

Comments in Python are written with a special character, which one?

(a)  

12.

Create a variable named carname and assign the value Volvo to it.

(a)  

13.

Create a variable named x and assign the value 50 to it.

(a)  

14.

Display the sum of 5 + 10, using two variables: x and y.

4 lines
15.

Remove the illegal characters in the variable name:

2my-first_name = "John"

a)

my-first_name = "John"

b)

myfirst_name = "John"

c)

myfirstname = "John"

16.

The following code example would print the data type of x, what data type would that be?

x = 5

print(type(x))

(a)  

17.

The following code example would print the data type of x, what data type would that be?

x = "Hello World"

print(type(x))

(a)  

18.

The following code example would print the data type of x, what data type would that be?

x = 20.5

print(type(x))

(a)  

19.

Which of the following symbols is used in a while loop to test if one value is equal to another?

a)

=

b)

<=

c)

==

20.

Correct file extension for python files?

a)

.py

b)

.pyt

c)

.pt

d)

.pyth

21.

Which operators are used to compare 2 values whether it is equal?

a)

==

b)

=

c)

>

d)

<>