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
9 questions for “Type Hints”
Found in 1 field. Select a question to see its full answer.
Information Technology
9 questions in 2 technologies
#
Question
Technology
Topic
Level
1
How would you write a decorator that validates a function's arguments against its
type
hints
at RUNTIME, since Python doesn't enforce
type
hints
by default?
Python › Decorators
Python
Decorators
Advanced
2
How does autowiring work in a service container, and how does it use
type
hints
to automatically resolve a class's dependencies?
PHP › Dependency Injection & Service Containers
PHP
Dependency Injection & Service Containers
Intermediate
3
How does typing.NamedTuple differ from collections.namedtuple in terms of syntax and
type
annotation support?
Python › Dataclasses & NamedTuples
Python
Dataclasses & NamedTuples
Intermediate
4
How does functools.singledispatch let you implement function overloading based on an argument's
TYPE
?
Python › Decorators
Python
Decorators
Advanced
5
How would you implement a
type
-validating descriptor that enforces a specific
type
constraint, reusable across multiple attributes and classes?
Python › Descriptors & Properties
Python
Descriptors & Properties
Advanced
6
How do you correctly
type
-hint a function using *args and **kwargs with modern typing, like ParamSpec for preserving a wrapped function's exact signature?
Python › Functions & Scope
Python
Functions & Scope
Advanced
7
How do you preserve a decorated function's original SIGNATURE (parameter names, defaults) for introspection tools, beyond what functools.wraps alone provides?
Python › Decorators
Python
Decorators
Advanced
8
How do keyword-only arguments (using a bare '*' in the parameter list) force certain parameters to be passed by name only?
Python › Functions & Scope
Python
Functions & Scope
Advanced
9
How do positional-only parameters (using a bare '/' in the parameter list, Python 3.8+) restrict how certain parameters can be passed?
Python › Functions & Scope
Python
Functions & Scope
Advanced