Instructions

  • 1. Your final score will reflect your grasp of the concepts—approach each question with precision.
  • 2. Thoroughly review each solution before proceeding to ensure full understanding.
  • 3. Final results will be available after submission to provide insights into areas for further improvement.
  • 4. Maintain academic integrity—plagiarism undermines learning and professional growth.
  • 5. Once submitted, responses are final, so ensure you’re confident in your answers.
  • 6. These challenges are designed to test practical knowledge; apply your skills as you would in real-world scenarios.

All Problems

Question

Action

What keyword is used to define a class in Python?

View

Which of the following is correct about classes in Python?

View

How do you create an object of a class Student?

View

What method is used to initialize class attributes?

View

Which of the following is an example of a class attribute?

View

What is the correct syntax to access an attribute name of an object student1?

View

How many arguments does __init__() require?

View

What will happen if no constructor is defined in a class?

View

How do you declare an attribute to be private?

View

What happens if we omit self in a method definition?

View

What keyword is used to define a class in Python?

className
define
class
object

Which of the following is correct about classes in Python?

A class can have multiple constructors
A class is an instance of an object
A class is a blueprint for creating objects
Classes are not necessary in Python

How do you create an object of a class Student?

obj = class Student()
obj = Student()
obj = Student(object)
obj.Student()

What method is used to initialize class attributes?

init{}
init()
start()
initialize()

Which of the following is an example of a class attribute?

def __init__(self): self.name = ""
age = 25
def display(self): pass
obj = Student()

What is the correct syntax to access an attribute name of an object student1?

student1
student1.name()
student1[name]
student1.name

How many arguments does __init__() require?

0
1
At least 2 including self
3

What will happen if no constructor is defined in a class?

The program throws an error
Python will use a default constructor
Objects cannot be created
The class will not be executed

How do you declare an attribute to be private?

self.__name
self._name
name_private
private self.name

What happens if we omit self in a method definition?

It will raise an error when called
It will be treated as a class method
The method becomes static
The program will run with a warning