Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Python Basics for Grade 5

Total questions: 10

Worksheet time: 5mins

Name
Class
Date
1.

What is the purpose of the input function in Python?

a)

To execute a function and return a value.

b)

To store data in a variable.

c)

To display output to the user.

d)

To take input from the user and return it as a string.

2.

How do you calculate the sum of three numbers in Python?

a)

sum = num1 * num2 * num3

b)

sum = num1 + num2 - num3

c)

sum = num1 / num2 / num3

d)

sum = num1 + num2 + num3

3.

What operator is used for addition in Python?

a)

*

b)

+

c)

/

d)

-

4.

How do you print output to the console in Python?

a)

Display output with the output() function.

b)

Use the print() function.

c)

Print to the console using console.log()

d)

Use the echo() function.

5.

What is the formula to calculate the average of three numbers?

a)

(a - b - c) / 3

b)

(a + b + c) / 2

c)

(a + b + c) / 3

d)

(a + b + c) * 3

6.

How do you store a number in a variable in Python?

a)

my_number := 5

b)

let my_number = 5

c)

number my_number = 5

d)

my_number = 5

7.

What data type is used to store decimal numbers in Python?

a)

string

b)

boolean

c)

float or decimal.Decimal

d)

integer

8.

How can you convert a string input to an integer in Python?

a)

Use eval(string) to evaluate the string as an expression.

b)

Apply float(string) to convert a string to a float.

c)

Use str(int) to convert an integer to a string.

d)

Use int(string) to convert a string to an integer.

9.

What is the output of print(10 + 5) in Python?

a)

5

b)

105

c)

10

d)

15

10.

How do you write a comment in Python?

a)

Use '#' to write a comment in Python.

b)

Use '/*' to start a comment in Python.

c)

Use '//' to write a comment in Python.

d)

Use '/* comment */' for comments in Python.