21 real OOP questions from the PHP bank, as asked in Indian campus drives and tech interviews. Every question has a verified answer and an AI-tutor explanation on placd — free to start.
1. What is Abstract class?
Junior
A.a reference that resolves to the exact class in which a method is written at compile time, ignoring which subclass actually invoked it
B.a typed instance member, introduced in PHP 8.1, that may be assigned exactly once from within the declaring class scope and then cannot be changed
C.a class that cannot be instantiated on its own and may declare methods without bodies that subclasses are required to implement
D.a keyword such as public, protected, or private that controls whether a class member can be accessed from outside, only within the hierarchy, or only inside the declaring class
2. Which term means: "a class that cannot be instantiated on its own and may declare methods without bodies that subclasses are required to implement"?
A.Abstract class — the mechanism, accessed through the static keyword, that resolves a called class at runtime so a parent method can reference the actual subclass it was invoked on
B.Abstract class — a fully abstract contract listing public method signatures and constants that any implementing class must fulfil, with no implementation of its own
C.Abstract class — a class that cannot be instantiated on its own and may declare methods without bodies that subclasses are required to implement
D.Abstract class — a keyword such as public, protected, or private that controls whether a class member can be accessed from outside, only within the hierarchy, or only inside the declaring class
A.a keyword such as public, protected, or private that controls whether a class member can be accessed from outside, only within the hierarchy, or only inside the declaring class
B.a fully abstract contract listing public method signatures and constants that any implementing class must fulfil, with no implementation of its own
C.a reference that resolves to the exact class in which a method is written at compile time, ignoring which subclass actually invoked it
D.a typed instance member, introduced in PHP 8.1, that may be assigned exactly once from within the declaring class scope and then cannot be changed
5. Which term means: "a fully abstract contract listing public method signatures and constants that any implementing class must fulfil, with no implementation of its own"?
A.Interface — a fully abstract contract listing public method signatures and constants that any implementing class must fulfil, with no implementation of its own
B.Interface — a reference that resolves to the exact class in which a method is written at compile time, ignoring which subclass actually invoked it
C.Interface — a typed instance member, introduced in PHP 8.1, that may be assigned exactly once from within the declaring class scope and then cannot be changed
D.Interface — a reusable block of methods and properties that is composed into a class with the use keyword to share behaviour horizontally without inheritance
A.the mechanism, accessed through the static keyword, that resolves a called class at runtime so a parent method can reference the actual subclass it was invoked on
B.a fully abstract contract listing public method signatures and constants that any implementing class must fulfil, with no implementation of its own
C.a keyword such as public, protected, or private that controls whether a class member can be accessed from outside, only within the hierarchy, or only inside the declaring class
D.a reusable block of methods and properties that is composed into a class with the use keyword to share behaviour horizontally without inheritance
8. Which term means: "a reusable block of methods and properties that is composed into a class with the use keyword to share behaviour horizontally without inheritance"?
A.Trait — a keyword such as public, protected, or private that controls whether a class member can be accessed from outside, only within the hierarchy, or only inside the declaring class
B.Trait — a reusable block of methods and properties that is composed into a class with the use keyword to share behaviour horizontally without inheritance
C.Trait — the mechanism, accessed through the static keyword, that resolves a called class at runtime so a parent method can reference the actual subclass it was invoked on
D.Trait — a typed instance member, introduced in PHP 8.1, that may be assigned exactly once from within the declaring class scope and then cannot be changed
A.a class that cannot be instantiated on its own and may declare methods without bodies that subclasses are required to implement
B.a typed instance member, introduced in PHP 8.1, that may be assigned exactly once from within the declaring class scope and then cannot be changed
C.the mechanism, accessed through the static keyword, that resolves a called class at runtime so a parent method can reference the actual subclass it was invoked on
D.a keyword such as public, protected, or private that controls whether a class member can be accessed from outside, only within the hierarchy, or only inside the declaring class
11. Which term means: "a keyword such as public, protected, or private that controls whether a class member can be accessed from outside, only within the hierarchy, or only inside the declaring class"?
A.Visibility modifier — the mechanism, accessed through the static keyword, that resolves a called class at runtime so a parent method can reference the actual subclass it was invoked on
B.Visibility modifier — a class that cannot be instantiated on its own and may declare methods without bodies that subclasses are required to implement
C.Visibility modifier — a typed instance member, introduced in PHP 8.1, that may be assigned exactly once from within the declaring class scope and then cannot be changed
D.Visibility modifier — a keyword such as public, protected, or private that controls whether a class member can be accessed from outside, only within the hierarchy, or only inside the declaring class
A.the mechanism, accessed through the static keyword, that resolves a called class at runtime so a parent method can reference the actual subclass it was invoked on
B.a class that cannot be instantiated on its own and may declare methods without bodies that subclasses are required to implement
C.a fully abstract contract listing public method signatures and constants that any implementing class must fulfil, with no implementation of its own
D.a typed instance member, introduced in PHP 8.1, that may be assigned exactly once from within the declaring class scope and then cannot be changed
14. Which term means: "the mechanism, accessed through the static keyword, that resolves a called class at runtime so a parent method can reference the actual subclass it was invoked on"?
A.Late static binding — a fully abstract contract listing public method signatures and constants that any implementing class must fulfil, with no implementation of its own
B.Late static binding — a class that cannot be instantiated on its own and may declare methods without bodies that subclasses are required to implement
C.Late static binding — the mechanism, accessed through the static keyword, that resolves a called class at runtime so a parent method can reference the actual subclass it was invoked on
D.Late static binding — a reusable block of methods and properties that is composed into a class with the use keyword to share behaviour horizontally without inheritance
A.a reference that resolves to the exact class in which a method is written at compile time, ignoring which subclass actually invoked it
B.a typed instance member, introduced in PHP 8.1, that may be assigned exactly once from within the declaring class scope and then cannot be changed
C.a keyword such as public, protected, or private that controls whether a class member can be accessed from outside, only within the hierarchy, or only inside the declaring class
D.a class that cannot be instantiated on its own and may declare methods without bodies that subclasses are required to implement
17. Which term means: "a reference that resolves to the exact class in which a method is written at compile time, ignoring which subclass actually invoked it"?
A.self keyword — a reference that resolves to the exact class in which a method is written at compile time, ignoring which subclass actually invoked it
B.self keyword — a typed instance member, introduced in PHP 8.1, that may be assigned exactly once from within the declaring class scope and then cannot be changed
C.self keyword — a reusable block of methods and properties that is composed into a class with the use keyword to share behaviour horizontally without inheritance
D.self keyword — the mechanism, accessed through the static keyword, that resolves a called class at runtime so a parent method can reference the actual subclass it was invoked on
A.a reusable block of methods and properties that is composed into a class with the use keyword to share behaviour horizontally without inheritance
B.a keyword such as public, protected, or private that controls whether a class member can be accessed from outside, only within the hierarchy, or only inside the declaring class
C.the mechanism, accessed through the static keyword, that resolves a called class at runtime so a parent method can reference the actual subclass it was invoked on
D.a typed instance member, introduced in PHP 8.1, that may be assigned exactly once from within the declaring class scope and then cannot be changed
20. Which term means: "a typed instance member, introduced in PHP 8.1, that may be assigned exactly once from within the declaring class scope and then cannot be changed"?
A.Readonly property — a reusable block of methods and properties that is composed into a class with the use keyword to share behaviour horizontally without inheritance
B.Readonly property — a fully abstract contract listing public method signatures and constants that any implementing class must fulfil, with no implementation of its own
C.Readonly property — a reference that resolves to the exact class in which a method is written at compile time, ignoring which subclass actually invoked it
D.Readonly property — a typed instance member, introduced in PHP 8.1, that may be assigned exactly once from within the declaring class scope and then cannot be changed
Answers, AI explanations, and a scored voice mock interview
Sign up free to check your answers with explanations, ask the AI tutor anything on any question, and take one full AI mock interview — scored like a real panel.