All quizzes
Free quiz · 50 questions in the bank

OOP quiz

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
  1. `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?
  2. What are the four classical pillars of OOP?
  3. What does `instanceof` (or its equivalent) tell you?
  4. What is `super` used for in a subclass?
  5. 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?
  6. Which best describes "encapsulation"?
  7. What is method overriding?
  8. What is the purpose of getters and setters?
  9. Which best describes "inheritance"?
  10. What is object-oriented programming (OOP)?
  11. What does `this` (or `self` in Python) refer to inside an instance method?
  12. What is method overloading?
Gaps to close?
Read the curated OOP notes — core concepts, patterns, interview prep.
OOP notes

More quizzes

.NET.NET MAUIAbsintheAccessibilityActixActix Web