Test your OOP knowledge with a free interactive quiz — 50 questions with answers and explanations. No signup needed to play.
Question 1/5Score 0
`class Cat extends Animal` and `Animal[] animals = {new Cat(), new Dog()}; for (var a : animals) a.speak();` — which pillar lets each `speak()` produce a different sound?
Questions in this quiz
`class Cat extends Animal` and `Animal[] animals = {new Cat(), new Dog()}; for (var a : animals) a.speak();` — which pillar lets each `speak()` produce a different sound?
What are the four classical pillars of OOP?
What does `instanceof` (or its equivalent) tell you?
What is `super` used for in a subclass?
A `BankAccount` class exposes `balance` as a public mutable field, so any code can write `account.balance = -1_000_000`. Which OOP pillar is being broken?
Which best describes "encapsulation"?
What is method overriding?
What is the purpose of getters and setters?
Which best describes "inheritance"?
What is object-oriented programming (OOP)?
What does `this` (or `self` in Python) refer to inside an instance method?