98 questions for “OOP & Classes”

Found in 1 field. Select a question to see its full answer.

Information Technology

98 questions in 6 technologies

#QuestionTechnologyTopicLevel
1How would you use an abstract class to implement the Template Method pattern, defining a fixed algorithm skeleton with some steps left abstract for subclasses to fill in? Java › Interfaces & Abstract ClassesJavaInterfaces & Abstract ClassesIntermediate
2Can an interface extend multiple other interfaces simultaneously, and how does this differ from a class's single-inheritance restriction for abstract/concrete classes? Java › Interfaces & Abstract ClassesJavaInterfaces & Abstract ClassesIntermediate
3How do local classes (defined within a method body) and anonymous classes differ in their capabilities and use cases, particularly regarding capturing local variables and reusability? Java › Inner Classes & Anonymous ClassesJavaInner Classes & Anonymous ClassesAdvanced
4How does the compiler implement inner classes at the bytecode level, and what synthetic elements (like a hidden outer-class reference field and synthetic accessor methods) does it generate to make this work? Java › Inner Classes & Anonymous ClassesJavaInner Classes & Anonymous ClassesAdvanced
5How would you use an anonymous class to create a one-off subclass with a customized implementation, distinct from anonymous classes implementing an interface, and what specific syntax quirk applies? Java › Inner Classes & Anonymous ClassesJavaInner Classes & Anonymous ClassesAdvanced
6What is an interface in PHP, and what purpose does it serve in defining a contract for classes to follow? PHP › Interfaces & Abstract ClassesPHPInterfaces & Abstract ClassesBeginner
7How do you decide whether to use an interface or an abstract class when designing a set of related classes that share common behavior? PHP › Interfaces & Abstract ClassesPHPInterfaces & Abstract ClassesIntermediate
8How does PHP's type system use interfaces to enable polymorphism, allowing different concrete classes to be used interchangeably wherever the interface type is expected? PHP › Interfaces & Abstract ClassesPHPInterfaces & Abstract ClassesIntermediate
9How does the 'sealed' modifier interact with abstract classes and interface method overrides to control further extensibility? C# › Interfaces & Abstract ClassesC#Interfaces & Abstract ClassesAdvanced
10How would you implement inheritance between dataclasses, and what field-ordering rule must be respected across the hierarchy? Python › Dataclasses & NamedTuplesPythonDataclasses & NamedTuplesAdvanced