Methods (OOP) (OCR A-Level Computer Science): Quizzes

📚Quizzes
Methods (OOP)
Sign up to keep practising.Create a free account to play more quizzes and track your progress.

Practise the questions

12 questions from this quiz

Show

What are methods in Object-Oriented Programming?

Functions within a class

Where can public methods be accessed from?

Outside the class

What is the primary purpose of public methods?

Serve as primary interface

How are private methods marked in Python?

Leading underscore

Can private methods be accessed directly from outside the class?

No, they cannot

What key benefit do public methods provide regarding data access?

Encapsulation

What type of tasks do private methods perform?

Auxiliary or supportive

What security benefit do private methods provide?

Keep details hidden

What happens if you access a private method from outside the class?

Raises an error

How should private methods be named to signal restricted access?

Single underscore start

Which method is private: deposit() or _log_transaction()?

_log_transaction()

What should you use to interact with objects instead of modifying attributes directly?

Public methods

Join 100,000+ A-Level students studying Quizzes with us.

Select your subjects, and get access to A+ resources today.