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 is the correct way to create an instance of a class?

View

What is the special method used to initialize an object's attributes?

View

Which keyword is used to create a class?

View

What will type(obj) return if obj is an instance of class Car?

View

Which of the following statements about Python objects is correct?

View

How do you define an attribute within a class?

View

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

View

What happens if a class has no __init__() method?

View

Which built-in method returns the string representation of an object?

View

What will happen if self is not used in a class method?

View

What is the correct way to create an instance of a class?

obj = ClassName
obj = ClassName()
ClassName obj = new()
obj(ClassName)

What is the special method used to initialize an object's attributes?

__start__
__main__
__init__
__new__

Which keyword is used to create a class?

function
method
class
object

What will type(obj) return if obj is an instance of class Car?

object
Car
<class 'Car'>
typeError

Which of the following statements about Python objects is correct?

Objects must be defined inside another class
An object is a collection of methods only
Objects contain attributes and methods
An object must be assigned to an array

How do you define an attribute within a class?

def attr(self):
self.attr = value
return attr
object(attr)

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

name
_name
__name
@name

What happens if a class has no __init__() method?

The object cannot be created
The class inherits __init__() from the object class
It will raise a syntax error
The interpreter skips the class definition

Which built-in method returns the string representation of an object?

__str__
__repr__
__toString__
__name__

What will happen if self is not used in a class method?

The method will only work for static variables
It will raise a TypeError
The method becomes static by default
The interpreter will ignore the class