NANDHOO
.
Learning Paths
Dashboard
Sign In
Home
Dashboard
FastAPI Framework Engineering
Path Parameters & Type Hinting
Quiz
Chapter Quiz: Path Parameters & Type Hinting
Mastery Assessment: Path Parameters
Complete this assessment with 100% score to master this chapter.
01
What happens if a user submits a string to a path parameter hinted as `int`?
The application crashes.
FastAPI automatically returns a 422 Unprocessable Entity error with a descriptive JSON body.
The string is converted to 0.
It works normally.
02
How can you restrict a path parameter to a specific set of predefined values?
Use a regex pattern in the path string.
Use a Python `Enum` class as the type hint for the parameter.
Manual check inside the function with `if/else`.
It's not possible in FastAPI.
03
What class allows you to add extra metadata and validation (like `gt` or `le`) to a path parameter?
Query
Body
Path
Header
Submit Answers
Back to Lesson
Next Chapter