Symfony 7 – PHP – Object Oriented Programming

20 multiple-choice questions about Object-Oriented Programming in PHP up to version 8.2, covering classes, inheritance, interfaces, traits, and advanced OOP features.


Question 1: What is encapsulation in OOP?

Question 2: Which visibility level allows access only inside the same class?

Question 3: What does the static keyword mean for class methods?

Question 4: How is inheritance implemented in PHP?

Question 5: What is polymorphism in OOP?

Question 6: What are abstract classes used for in PHP?

Question 7: What is the purpose of interfaces in PHP?

Question 8: How do traits differ from interfaces?

Question 9: What happens if a class uses two traits with the same method name?

Question 10: What is late static binding used for?

Question 11: What does the final keyword do for a class or method?

Question 12: What are magic methods in PHP?

Question 13: What does the __construct method do?

Question 14: How can you prevent a class from being instantiated directly?

Question 15: What does the __clone method do in PHP?

Question 16: What is an interface segregation principle example?

Question 17: Which PHP feature supports dependency injection most directly?

Question 18: What is the purpose of the __autoload or spl_autoload_register functions?

Question 19: How do typed properties improve OOP in PHP?

Question 20: What does composition mean in OOP?