NEW
Font size
WorksheetsOOP-Q1
Total questions: 10
Worksheet time: 3mins
What does a class represent in OOP?
A specific instance of an object
A blueprint for creating objects
A method inside an object
A variable inside an object
Which keyword is used to define a class in Python?
`object`
`self`
`class`
`define`
Which of the following is an instance of the `Car` class?
Car("Toyota")
class Car: pass
def Car(): pass
"Car"
What is the purpose of the `__init__` method in Python?
It is a destructor for objects.
It initializes the attributes of a class.
It creates a new instance of a class.
It is used to create private variables.
Identify the correct syntax to access an attribute of an object.
dog1[name]
dog1::name
dog1.name
dog1->name
What will the following code output?
Which statement about inheritance in Python is correct?
A class can inherit from multiple parent classes.
Only one class can be inherited at a time.
Inheritance is not possible in Python.
Parent classes cannot have methods.
What will happen if you run this code?
An object is created without any issues.
The program will throw a TypeError.
The program will throw a NameError.
The program will throw an AttributeError.
What does the self keyword refer to?
The class itself
The instance of the class inside itself
A static method
The parent class
What is the output of the following code?
Error
This is a Shape
Circle
This is a Circle
