WorksheetsClass 8_2025_CLASS,INPUTOUTPUT
Total questions: 10
Worksheet time: 13mins
What is a variable in Python?
A reserved word in Python
It is a name given to a value.
A function that takes one or more arguments and returns a value
A module in Python
Which of the following is a valid variable name in Python?
1var
var-1
var_1
var 1
The data type of the variable "x" in the code x = “False”
String
Integer
Float
Boolean
Which of the following is not a valid data type in Python?
Integer
Float
Character
Boolean
What is the output of the following code?
x = 5
y = "10"
print(x + y)
15
510
TypeError: unsupported operand type(s) for +: 'int' and 'str'
None of the above
Common built-in data types in Python include __________, __________,
__________, and __________.
(a)
A string is a sequence of (a) enclosed in quotation marks.
The (a) function can be used to convert a value to a string.
(a) means joining strings together end-to-end to create a new
string.
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()
What are the initial coordinates of the drill before calling the drill_right()
method?
What is the purpose of the self.x = self.x + 2 line in the drill_right()
method? Why is it required?
