W3
Teacher
Explore
Browse by field
Artificial Intelligence
Accounting & Finance
Information Technology
Show all fields
Interview Q&A
All Interview Questions
Beginner
Intermediate
Advanced
Practice
MCQs
Quizzes
Mock Interviews
About
Light
Dark
Auto
Sign in
Get Started
Search interview questions
Search
98 questions for “OOP & Classes”
Found in 1 field. Select a question to see its full answer.
Matching topics
Java
Interfaces & Abstract
Classes
10
Java
Inner
Classes
& Anonymous
Classes
9
PHP
Interfaces & Abstract
Classes
6
C#
Interfaces & Abstract
Classes
5
PHP
OOP
4
Python
Data
classes
& NamedTuples
1
Information Technology
98 questions in 6 technologies
#
Question
Technology
Topic
Level
1
How would you use an abstract class to implement the Template Method pattern, defining a fixed algorithm skeleton with some steps left abstract for sub
classes
to fill in?
Java › Interfaces & Abstract Classes
Java
Interfaces & Abstract
Classes
Intermediate
2
Can 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 Classes
Java
Interfaces & Abstract
Classes
Intermediate
3
How 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 Classes
Java
Inner
Classes
& Anonymous
Classes
Advanced
4
How 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 Classes
Java
Inner
Classes
& Anonymous
Classes
Advanced
5
How 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 Classes
Java
Inner
Classes
& Anonymous
Classes
Advanced
6
What is an interface in PHP, and what purpose does it serve in defining a contract for
classes
to follow?
PHP › Interfaces & Abstract Classes
PHP
Interfaces & Abstract
Classes
Beginner
7
How 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 Classes
PHP
Interfaces & Abstract
Classes
Intermediate
8
How 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 Classes
PHP
Interfaces & Abstract
Classes
Intermediate
9
How does the 'sealed' modifier interact with abstract
classes
and interface method overrides to control further extensibility?
C# › Interfaces & Abstract Classes
C#
Interfaces & Abstract
Classes
Advanced
10
How would you implement inheritance between data
classes
, and what field-ordering rule must be respected across the hierarchy?
Python › Dataclasses & NamedTuples
Python
Data
classes
& NamedTuples
Advanced
Show all 98 questions in Information Technology