Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Class 8_2025_CLASS,INPUTOUTPUT

Total questions: 10

Worksheet time: 13mins

Name
Class
Date
1.

What is a variable in Python?

a)

A reserved word in Python

b)

It is a name given to a value.

c)

A function that takes one or more arguments and returns a value

d)

A module in Python

2.

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

a)

1var

b)

var-1

c)

var_1

d)

var 1

3.

The data type of the variable "x" in the code x = “False”

a)

String

b)

Integer

c)

Float

d)

Boolean

4.

Which of the following is not a valid data type in Python?

a)

Integer

b)

Float

c)

Character

d)

Boolean

5.

What is the output of the following code?

x = 5

y = "10"

print(x + y)

a)

15

b)

510

c)

TypeError: unsupported operand type(s) for +: 'int' and 'str'

d)

None of the above

6.

Common built-in data types in Python include __________, __________,

__________, and __________.

(a)  

7.

A string is a sequence of (a)   enclosed in quotation marks.

8.

The (a)   function can be used to convert a value to a string.

9.

(a)   means joining strings together end-to-end to create a new

string.

10-11.

In the picture given below, a building is the main obstacle preventing a monkey from

reaching the banana. To solve this problem, an object of the Drill class is created to

invoke an instance method that drills through the brick to move the obstacle.

Answer the following questions based on the given problem and the code provided:

class Drill:

def_ init_(self):

self.x = 9

self.y = 13

def drill_right(self):

self.x = self.x + 2

drill_1 = Drill()

drill_1.drill_right()

10.

What are the initial coordinates of the drill before calling the drill_right()

method?

4 lines
11.

What is the purpose of the self.x = self.x + 2 line in the drill_right()

method? Why is it required?

4 lines