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 happens when you define two __init__() methods in a class?

View

What is the output of calling an object's class name using type(object)?

View

Can you create a class without an __init__() method?

View

What is the purpose of __str__() in a class?

View

Which special method is called when an object is deleted?

View

Can multiple objects of the same class hold different data?

View

What is the default access modifier in Python classes?

View

Which method makes an object callable like a function?

View

What is the use of dir() function on an object?

View

Can a class attribute be accessed without creating an object?

View

What happens when you define two __init__() methods in a class?

Both methods will run
Only the last __init__() method will be used
Python will raise a syntax error
The first __init__() method will override the second

What is the output of calling an object's class name using type(object)?

The object’s attributes
The class to which the object belongs
The method resolution order (MRO)
The memory address of the object

Can you create a class without an __init__() method?

No, it’s mandatory
Yes, but the object will be uninitialized
Yes, the object will still work without it
Only for abstract classes

What is the purpose of __str__() in a class?

To initialize the object
To define the string representation of the object
To convert data types
To hide private methods

Which special method is called when an object is deleted?

__del__()
__delete__()
__remove__()
__cleanup__()

Can multiple objects of the same class hold different data?

Yes, because each object has separate instance attributes
No, objects share the same memory
Only in subclasses
Only with private attributes

What is the default access modifier in Python classes?

Private
Protected
Public
Static

Which method makes an object callable like a function?

__call__()
__func__()
__exec__()
__init__()

What is the use of dir() function on an object?

To print the object's memory location
To list all attributes and methods of the object
To delete the object
To modify the class of the object

Can a class attribute be accessed without creating an object?

No
Yes, using the class name
Only with a decorator
Only in inheritance