wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Homework 3- Python

Total questions: 10

Worksheet time: 5mins

Name
Class
Date
1.

What is the data type of the value `42` in Python?

a)

String

b)

Integer

c)

Float

d)

Boolean

2.

Which of the following is a valid variable name in Python?

a)

1st_variable

b)

firstVariable

c)

first-variable

d)

first variable

3.

What is the output of the following code snippet? ```python print(type("Hello")) ```

a)

``

b)

``

c)

``

d)

``

4.

Which of the following is a built-in function in Python?

a)

`calculate()`

b)

`print()`

c)

`add()`

d)

`total()`

5.

What data type would 2.7 be defined?

a)

Integer

b)

Float

c)

String

d)

Boolean

6.

Which of the following is a correct way to import a module in Python?

a)

`import math`

b)

`include math`

c)

`require math`

d)

`use math`

7.

What is the result of the following expression in Python: `5 + 3 * 2`?

a)

16

b)

11

c)

13

d)

10

8.

Which of the following is used to create a comment in Python?

a)

`// This is a comment`

b)

`# This is a comment`

c)

`/* This is a comment */`

d)

``

9.

Which of the following is used to define a block of code in Python?

a)

Curly braces `{}`

b)

Square brackets `[]`

c)

Indentation

d)

Parentheses `()`

10.

Which of the following functions is used to get the length of a list in Python?

a)

size()

b)

length()

c)

len()

d)

count()