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

Which symbol denotes a private attribute in Python?

View

What is a public attribute in Python?

View

What does _ before a variable name indicate?

View

Can private variables be accessed directly outside the class?

View

Which of the following is the correct way to access a private variable?

View

What is the purpose of a getter method?

View

Which decorator converts a method into a getter?

View

What happens if you try to access a private variable without a getter?

View

What is the purpose of using @property in Python?

View

Which access modifier is missing in Python compared to other languages?

View

Which symbol denotes a private attribute in Python?

_
__
$$
!

What is a public attribute in Python?

An attribute accessible only inside the class
An attribute accessible from anywhere
An attribute with a single underscore
None of the above

What does _ before a variable name indicate?

Private attribute
Protected attribute
Public attribute
Static attribute

Can private variables be accessed directly outside the class?

Yes
No
Only in built-in classes
Only with inheritance

Which of the following is the correct way to access a private variable?

Using self._variable
Using self.__variable
Using object._ClassName__variable
Using object.__variable

What is the purpose of a getter method?

To delete attributes
To retrieve the value of a private attribute
To update attributes
To prevent method overriding

Which decorator converts a method into a getter?

@property
@getter
@staticmethod
@private

What happens if you try to access a private variable without a getter?

Raises an AttributeError
Works normally
Throws a SyntaxError
Ignores the attribute

What is the purpose of using @property in Python?

To protect attributes
To convert a method into a read-only property
To define abstract methods
To override parent methods

Which access modifier is missing in Python compared to other languages?

Private
Public
Protected
Explicitly defined protected modifier