0% found this document useful (0 votes)
2 views2 pages

Python FastAPI Interview Questions

The document contains a series of interview questions and answers related to Python and FastAPI. Key topics include Python data types, object-oriented programming concepts, and FastAPI features such as data validation and endpoint creation. It serves as a resource for preparing for technical interviews in these areas.

Uploaded by

arunak143a
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views2 pages

Python FastAPI Interview Questions

The document contains a series of interview questions and answers related to Python and FastAPI. Key topics include Python data types, object-oriented programming concepts, and FastAPI features such as data validation and endpoint creation. It serves as a resource for preparing for technical interviews in these areas.

Uploaded by

arunak143a
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Python & FastAPI Interview Questions with

Answers

Python Interview Questions


Q: What is Python?
A: Python is a high-level, interpreted, object-oriented programming language known for its
simplicity and readability.

Q: What are Python data types?


A: Common data types include int, float, str, list, tuple, set, dict, and bool.

Q: Difference between list and tuple?


A: Lists are mutable while tuples are immutable.

Q: What is a decorator?
A: A decorator is a function that modifies the behavior of another function without changing its
code.

Q: What is a generator?
A: A generator yields values one at a time using the yield keyword, saving memory.

Q: What is OOP?
A: Object-Oriented Programming uses classes and objects to organize code.

Q: Explain inheritance.
A: Inheritance allows a class to acquire properties and methods from another class.

Q: What is polymorphism?
A: Polymorphism allows the same method name to behave differently for different objects.

Q: What is exception handling?


A: Handling runtime errors using try, except, finally, and raise.

Q: What is GIL?
A: Global Interpreter Lock allows only one thread to execute Python bytecode at a time.
FastAPI Interview Questions
Q: What is FastAPI?
A: FastAPI is a modern Python web framework for building APIs with high performance.

Q: Why use FastAPI?


A: It is fast, supports type hints, automatic validation, and auto-generated documentation.

Q: What are path parameters?


A: Variables embedded in the URL path, such as /users/{id}.

Q: What are query parameters?


A: Parameters passed in the URL after a question mark.

Q: How does FastAPI validate data?


A: Using Pydantic models and Python type hints.

Q: What is Pydantic?
A: A library used for data validation and serialization.

Q: How to create a GET endpoint?


A: Use @[Link]('/path') decorator.

Q: How to create a POST endpoint?


A: Use @[Link]('/path') decorator.

Q: What documentation does FastAPI provide?


A: Swagger UI and ReDoc are generated automatically.

Q: How can FastAPI connect to databases?


A: Using SQLAlchemy, SQLModel, or async database libraries.

You might also like