Correct Answer : FORM CLASS
Explanation : FastAPI has a Form class to process the data received as a request by submitting an HTML form.
@app.get(‘/users’) def get_users(): pass
@app.post(‘/users’) def create_user(user: dict): pass
@app.middleware() def my_middleware(request, response): pass
@app.exception_handler(ValueError) def handle_value_error(request, exc): pass
Correct Answer : @app.middleware() def my_middleware(request, response): pass
Explaination : Is a valid FastAPI middleware, which intercepts requests and responses in the application and can modify them or perform additional operations.
Correct Answer : All of the above
Explanation : Following are the advantages of dependency injection :* Reuse shared functionality* Share database connections* Authentication and security requirements
Correct Answer : Dependency injection
Explanation : Dependency injection is the process through which an item obtains other objects on which it depends.