Python_Full_Stack_Interview_Questions_with_Answers
Python_Full_Stack_Interview_Questions_with_Answers
Q: Explain the difference between deep copy and shallow copy in Python.
A: A shallow copy creates a new object but inserts references to the original object's elements. A
deep copy creates a new object and recursively copies all objects within the original object.
A: Python uses automatic memory management, with a garbage collector to manage unused
A: Decorators are functions that modify the behavior of other functions or methods. They are used
A: The GIL is a mutex that protects access to Python objects, preventing multiple native threads
A: Built-in types include int, float, str, list, tuple, dict, set, and bool.
A: Exception handling is managed using try, except, finally blocks. Use raise to trigger exceptions.
A: Python is dynamically typed, interpreted, has a large standard library, and supports multiple
programming paradigms.
Q: What are classes and objects in Python?
A: Classes define blueprints for creating objects, which are instances of classes.
A: Inheritance allows a class (child) to inherit methods and properties from another class (parent).
A: List comprehension provides a concise way to create lists using syntax like [expression for item in
iterable].
A: Iterators are objects that allow traversal of a sequence, while generators are iterators defined with
yield.
A: @staticmethod doesn't access the class or instance. @classmethod accesses the class, and
definition.
A: Django uses MVT (Model-View-Template), where models handle data, views process requests,
A: Database migrations are managed using Django's makemigrations and migrate commands.
A: Middleware are hooks that process requests and responses globally before reaching views or
A: Django handles validation through Form and ModelForm classes, raising errors for invalid fields.
A: QuerySets are used to query and retrieve data from the database in Django models.
A: Use Django REST Framework to define serializers, views, and URL configurations.
A: GET retrieves data without side effects. POST submits data to the server, potentially causing
changes.
A: Use Django REST Framework's authentication classes like TokenAuthentication and permissions
like IsAuthenticated.
Q: Explain the role of serializers in Django REST framework.
A: Serializers convert complex data types like querysets into JSON and validate data for
deserialization.
A: The DOM is a tree structure representing the HTML document, allowing dynamic content
manipulation.
A: Use methods like getElementById, querySelector, and style property to change elements.
A: let and const have block scope, with const being immutable. var has function scope.
A: Promises represent asynchronous operations, resolved or rejected. Use .then() and .catch() for
handling results.
A: Monolithic has tightly integrated components, while microservices separate them into smaller,
independent services.
A: Use modern frameworks, CSS resets, and browser-specific prefixes. Test across browsers.