Object-Oriented Programming Flashcards
6 cards from real PCAP practice questions. Tap to flip, then mark Knew It or Still Learning — missed cards come back until you master them.
Read the first 6 Object-Oriented Programming flashcards as text
Which keyword is used to define a class in Python?
Answer: class
The `class` keyword is used to define a class in Python.
What is the purpose of the `__init__` method in a Python class?
Answer: To initialize a new instance
`__init__` is the constructor method called automatically when a new object is created.
How do you create an instance of a class named `Car`?
Answer: Car()
You instantiate a class by calling it like a function: `Car()`.
What does the `self` parameter represent in a Python class method?
Answer: The current instance
`self` refers to the current object instance on which the method is being called.
Which method is called when an object is deleted or garbage collected?
Answer: __del__
`__del__` is the destructor method called when an object is about to be destroyed.
What is encapsulation in object-oriented programming?
Answer: Bundling data and methods within a class
Encapsulation bundles data (attributes) and behavior (methods) together inside a class.
How this page was made: written with AI tools and published by Nathan Beja, founder of Practice Test Geeks, who is responsible for its content. Exam facts are checked against the official sources listed below. Not reviewed by a subject-matter expert. Editorial policy
Sources & references
Exam facts on this page (fees, format, dates, passing scores) are checked against these official sources; the date is our last check. Editorial policy
- pythoninstitute.org — Eligibility, fees, exam format, passing score, retake fee, retake policy, score release, time limit, score validity, exam information · verified Oct 2026
- home.pearsonvue.com — Test delivery · verified Oct 2026