- What is PEP 8 and why is it important?
- What is a docstring in Python?
- How many spaces should be used for indentation in Python according to PEP8, and why is consistent indentation important?
- What are the differences between ruff and black in terms of functionality and usage?
- Explain the purpose of type annotations in Python and provide an example function with type annotations.
- What is debugging, and why is it an essential skill for programmers?
- Explain the purpose of using the print function for debugging. Provide an example scenario where this method is useful.
- Describe how the Python Debugger (PDB) can be used for debugging. What are its advantages over using print statements?
- What strategies can be used to debug loops and functions in Python?
- What is the impact of long-running functions on the performance of a program?
- What is the difference between regular division (/) and integer division (//) in Python? Provide an example of each.
- Explain the use of the modulus operator (%) in Python. How can it be used to determine if a number is even or odd?
- How does Python handle large integers, and what are the potential limitations when working with very large numbers?
- What does NaN stand for, and in what scenarios might it be used in Python? How can you check for NaN values in a list?
- What is the significance of handling zero division in Python, and how can you prevent a ZeroDivisionError in your code?
- Describe the use of the random module in Python. What are some common functions provided by this module, and how are they used?
- What are escape characters in Python strings, and how are they used? Provide examples of \n, \t, \r, ", and '.
- Explain the use of the strip, lstrip, and rstrip methods in Python. How do they differ, and when would you use each one?
- Describe the purpose of the count method in strings. How does it work, and what is a practical example of its usage?
- How does the join method work in Python, and what are some common use cases? Provide an example.
- What is string slicing in Python, and how can it be used to extract substrings? Provide an example using both positive and negative indices.
- Explain the replace method in strings. How can it be used to replace multiple occurrences of a substring? Provide an example.
- What are default values for function arguments in Python, and how are they used?
- Explain the purpose and usage of *args and **kwargs in Python functions. How do they differ?
- How do you define a function with type annotations in Python? Provide an example and explain its benefits.
- Describe how you can use *args and **kwargs to create a function that can handle a variable number of positional and keyword arguments. Provide an example.
- What are the break and continue statements used for in Python loops? Provide an example of each.
- Explain the concept of an infinite loop. In what scenarios might you use an infinite loop, and how can you ensure it terminates correctly?
- Describe how nested loops work in Python. What are some potential performance concerns with using nested loops, and how can you mitigate them?
- Describe how nested loops work in Python. What are some potential performance concerns with using nested loops, and how can you mitigate them?
- How does Python automatically convert different data types to boolean values? Provide examples with numbers, strings, lists, and dictionaries.
- Explain how to convert a string to an integer and a float in Python. What happens if the string cannot be converted to a number?
- What does Python do when comparing different data types, such as integers and floats, or integers and booleans? Provide examples.
- How does Python handle comparisons between lists and sets? Provide examples showing when lists or sets are considered equal or not.
- Describe the use of the bool() function in Python. How can it be used to determine the truthiness of various data types?
- What is the difference between the reverse method and slicing with [::-1] when reversing a list? Provide an example of each.
- Explain the purpose and usage of the sort method in lists. How can you sort a list in descending order?
- Describe the difference between the copy method and directly assigning one list to another variable. Why is using copy important?
- What does the pop method do in a list? How does it differ when an index is provided versus when it is not?
- How can you combine two lists in Python using both the + operator and the extend method? What is the key difference between these two approaches?
- What are the functions min, max, sum, all, and any used for in the context of lists? Provide a brief explanation for each.
- How can we create a tuple?
- What are the data types and what is the difference between list and tuple, when to use them?
- What is a dictionary in Python, and what distinguishes it from other data structures?
- Explain the difference between accessing a value in a dictionary using square brackets [] and the get method. Why might you choose one over the other?
- Describe how you can update and delete elements in a dictionary.
- What are the keys, values, and items methods in a dictionary? How do they differ, and when would you use each one?
- What is a set in Python, and what distinguishes it from other data structures?
- How do you create a set in Python, and what are the limitations on the elements that can be added to a set?
- What is the purpose of the intersection() method in Python sets, and how does it differ from the union() method?
- How do you clone a repository from GitHub?
- What is a pull request and what is it used for?
- How do you create Pull Requests on GitHub?
- What are mutable and immutable data types in Python?
- How does mutability affect the performance of a program?
- Give examples of mutable and immutable types in Python.
- Why is it important to understand mutability when using dictionaries or sets?
- What does the term id mean in Python, how is it used, and why is it important?
- How is the Singleton pattern applied to Python, and what are examples of Singleton objects in Python?
- What is the difference between is and ==?
- How do dict comprehension, list comprehension and set comprehension work?
- What are the benefits of using list comprehensions over traditional loops?
- Can you give an example of a nested list comprehension?
- What is faster in Python, list comprehension or creating a list using a regular loop?
- What is the scope of variables in a function?
- What are local variables and global variables in Python?
- Explain the difference between local and nonlocal variables in Python.
- What is unpacking in Python, and how is it used in assignment?
- Explain the concept of packing values in Python and provide examples.
- What is the purpose of using the * operator in packing and unpacking?
- What is closure in Python?
- What is a decorator in Python, and how does it function?
- Is it possible to use several decorators for one function?
- Is it possible to create a decorator from a class?
- What is a closure, and how is it related to decorators?
- How do you define a decorator that accepts parameters?
- What is the purpose of using the functools.wraps decorator within a decorator function?
- Discuss the potential issue with the order of decorators when applied to a function.
- What is a class in Python?
- How do you create an object in Python?
- Explain the role of the init() method in a class.
- What is the purpose of the self parameter in Python class methods?
- How do you define methods in a class?
- Explain the concept that "everything is an object" in Python, and provide examples.
- Provide an example of a class with methods that perform calculations based on its attributes.
- Describe a scenario where you might need to use multiple classes in a Python program.
- What is a @classmethod in Python, and how is it different from a regular method?
- What is a @staticmethod in Python classes, and when would you use it?
- Explain the differences between@classmethod and @staticmethod in Python classes.
- What are instance attributes in Python classes, and how do they differ from class attributes?
- What is the purpose of the del method?
- What are magic methods in Python classes, and why are they called "magic"?
- Provide an example of using the str magic method to define a string representation for a custom class in Python.
- Що таке slots в Python?
- What is an iterator in Python?
- What is a generator, and how does it differ from an iterator or regular function?
- How do you create a generator function?
- How can you create an iterator from an iterable using the iter() functions?
- Explain the purpose of the next() functions when working with iterators.
- Can you use the next() and iter() methods interchangeably with the next() and iter() functions? Explain.
- What is the role of the StopIteration error in iterator design, and when does it typically occur?
- How does the yield keyword contribute to the functionality of generators, and what makes them memory-efficient?
- What are modules and packages in Python?
- What is a module in Python, and what purpose does it serve?
- How do you import a module in Python?
- What are the different types of imports?
- What does the dir() function do, and how can it be used with modules?
- Explain the role of the if name == "main": statement in Python scripts.
- What is the significance of the init.py file in a Python package?
- What are some best practices for styling import statements in Python code?
- What is Object-Oriented Programming (OOP), and what are its main principles in Python?
- What is single inheritance in Python?
- How do you implement inheritance in Python classes, and what syntax is used to denote inheritance?
- How do you access parent class members in a child class?
- What is the purpose of the super() function in Python inheritance, and how is it used?
- Describe the isinstance() function in Python and provide an example of its usage.
- Explain the issubclass() function in Python and provide an example of its usage.
- What is inheritance?
- What is multiple inheritance?
- How does the MRO (Method Resolution Order) work in multiple inheritance?
- What are the advantages and disadvantages of using multiple inheritance?
- How does operator overloading work in Python, and why is it useful?
- What is Mixins?
- What is encapsulation in Python?
- What is polymorphism, and how is it implemented in Python?
- What is abstraction in Python?
- What is the difference between public, private, and protected access modifiers?
- How to achieve data abstraction?
- What is ABC and @abstractmethod?
- What are properties in Python, and how do you use them?
- What are descriptors in Python?
- How do properties and descriptors differ?
- When should you use a property vs. a descriptor?
- What is @property?
- What are setattr(), getattr(), and hasattr(), and what are they used for? What is the difference between them?
- Explain the significance of the set_name method in Python descriptors, and provide an example illustrating its usage.
- What are exceptions in Python?
- What are the three types of errors in Python, and how do they differ from each other?
- How do you use try, except, else, and finally blocks?
- What does the order of except keywords mean?
- What is the purpose of using the
assertstatement in Python code? - How does the raise keyword differ from simply printing an error message in Python?
- What is the significance of creating custom exceptions in Python, and how can they enhance error handling in a program?
- How are exceptions organized in Python, and what is the hierarchy of exception classes?
- What are some common approaches to handling multiple types of exceptions in Python, and why is it important to handle them separately?
- What is the purpose of re-raising an exception in Python, and in what scenarios might it be useful?
- Why should the usage of the try-except block be limited in Python programs, and how can it impact program performance?
- What are the different modes for working with files in Python?
- Why is it essential to close files after performing operations on them, and what can happen if files are left open?
- What are the differences between using the read(), readline(), and readlines() methods for reading files, and when would you use each method?
- How can you write data to a file in Python, and what are the differences between the w(write) and a(append) modes?
- What are context managers in Python, and how can they be used for file handling to ensure proper resource management?
- How does Python manage memory?
- What is reference counting in Python, and why is it essential for memory management?
- What is garbage collection in Python?
- How do you get the memory address of a Python object?
- What is the purpose of the getrefcount() function from the sys module, and how does it work in Python?
- Explain with examples the difference between mutable and immutable objects concerning reference counting and memory management.
- What is the difference between shallow copy and deep copy in Python, and when would you use each?
- What are the differences between automated and manual testing, and what are the advantages of automated testing?
- How does the assert statement work in Python, and what is its primary purpose in testing?
- What is TDD (Test-Driven Development)?
- What are some popular testing frameworks for Python?
- What is the pytest framework, and how does it differ from unittest in terms of syntax and functionality?
- What is unittest in Python?
- Describe the pytest.raises method and its use case in testing for specific exceptions in Python code.
- What is parametrization in testing, and how does pytest support it using the @pytest.mark.parametrize decorator?
- How can you customize test names in pytest when using parametrized tests to make them more descriptive and readable?
- What is the Arrange/Setup step in testing, and why is it important?
- What steps are included in Cleanup/Teardown, and why are they important?
- What is the difference between the setUp() and setUpClass() methods in the unittest framework?
- What is a mock object, and how can it be used to improve test quality?
- What is the difference between using mock.patch in unittest and monkeypatch in pytest for mocking objects?
- What does the scope parameter in pytest fixtures do?
- What are built-in popular modules in Python?
- How to work with dates in Python?
- How to work with float numbers, but with better precision?
- What are the main popular packages (requests, pytest, etc)?
- What do you know about the collections module, which other built-in modules were used?
- What does sys.argv return?
- What is the primary module used for interacting with the operating system in Python?
- How do you shuffle the elements of a list using the random module?
- How do you get the current date and time using the datetime module?
- What is algorithm complexity, and how is it defined?
- Explain the concept of big "O" notation and its significance in algorithmic complexity.
- What types of algorithm complexities are commonly encountered?
- Can you give examples of tasks that are efficiently solved with linear (O(n)) algorithms?
- Explain how Python dict works under the hood.
- What is a hash function?
- What is a dynamically typed language?
- What are literals in Python, and can you give examples of different literals?
- What are keywords in Python?
- What is pass or ... in Python? What is ... in Python?
- What is a database?
- What is SQL?
- What are the main types of databases, and how do they differ from each other?
- What is parametrization (SQL-injection)?
- What is connection/cursor?
- What is CRUD?
- What is ORM (Object-Relational Mapping) and what is its primary purpose in software development?
- For what purposes manage.py is used?
- What is stored in settings.py?
- What are models?
- What are migrations?
- What are QuerySets?
- Which different fields in Django ORM you know (list all of them)?
- What is the difference between null and blank?
- What are field choices?
- What types of dependencies exist between tables in a database, and how are they represented in ORM?
- What parameters does on_delete use for ForeignKey, and what do they do?
- What is a backward relations in Django ORM, and how can it be used to access related model objects from the perspective of the referencing model?
- How is OneToOneField used to establish a "one-to-one" relationship in Django ORM, and in what scenarios can this be useful?
- What type of field is used to represent a many-to-many relationship in Django ORM?
- What is the purpose of an intermediate table (Many-to-many)?
- What is the purpose of using the @property decorator in a Django model
- What are managers?
- What are lazy QuerySets in Django?
- What are some common field lookups used in Django queries?
- How are joins implemented in Django ORM?
- How can Django Shell Plus aid in understanding queries and interacting with models?
- What is the purpose of the save() method in Django models?
- How does QuerySet caching work in Django, and what are its implications?
- What are the potential drawbacks of not using QuerySets properly?
- How can you use the aggregate() method to calculate aggregate values over a QuerySet in Django?
- What is the difference between using the aggregate() and annotate() methods in Django for generating aggregated values?
- What is the N+1 query problem in Django, and how can you address it?
- How does the select_related() method improve query performance in Django, and when should it be used?
- How does the prefetch_related() method improve query performance in Django, particularly in the context of many-to-many relationships?
- How can you use the Meta internal class in Django models, and what are some of its common options?
- What is the purpose of the ordering option in the Meta class, and how is it used to specify default object ordering in Django models?
- How can you specify human-readable names for objects using the verbose_name and verbose_name_plural options in the Meta class?
- What is the purpose of the db_table option in the Meta class?
- What are database indexes?
- How does indexing improve data searching speed in a database, and how can you add indexes to fields in Django models?
- What are constraints in Django models, and how can you define unique constraints using the UniqueConstraint option in the Meta class?
- What is a transaction?
- What is database normalization, and why is it important in database design?
- What are the main reasons for normalizing databases, and what advantages does normalization offer?
- What are the three normal forms (1NF, 2NF, 3NF), and what are the requirements for achieving each of them?
- How does indexing improve data retrieval performance in a database, and what are the main types of indexing methods?
- What are the advantages and disadvantages of indexing in a database?
- Explain the concept of master-slave in database architecture, and how does it optimize I/O operations?
- What is sharding in database architecture, and what are its benefits and drawbacks?
- What is isolation in the context of database transactions, and why is it important for transaction integrity?
- What is Django, and what are some of its key features?
- What are the steps involved in setting up a Django project using the terminal?
- How can you verify if Django is successfully installed on your system?
- When you create a Django project, what files are generated, and what is the purpose of each file?
- What is a Django app, and how do you create one?
- What is the difference between a project and an app in Django?
- Why is the Django admin panel useful, and how can you access it?
- How do you add a model to the Django admin panel, and what is the purpose of the register() method in admin.py?
- What customization options are available for the Django admin panel, and how can you customize it to display specific fields?
- How does Django's MVT architecture facilitate the development of web applications, and what are its core components?
- Explain the role of URLs in Django
- Describe the significance of Views in Django's MVT architecture, and how do they interact with Models and Templates?
- What is the context in Django?
- Explain the importance of Models in Django, and how do they represent data within the application?
- Describe the role of Templates in Django
- How to omit code duplication in django templates (extending, including)?
- What is Jinja2 templating?
- Explain user authentication in Django?
- What are middlewares?
- What’s the use of a session framework?
- What is CSRF?
- What is the purpose of the @login_required decorator in Django?
- How can you limit access to logged-out users in class-based views?
- What is the purpose of Django forms?
- How does Django handle forms in views?
- What steps are involved in the form handling process in Django?
- How can you create a basic form in Django using HTML and Django views?
- What is Django-Crispy-Forms? And what is it used for in Django?
- What is Django form validation?
- How can you implement custom validation in Django forms?
- What is a UserCreationForm, and how is it used in Django?
- What is a ForeignKey field in Django models, and how does it relate to forms?
- What is the purpose of the clean_field function in Django forms?
- What is a widget in Django forms?
- How can you implement searching by a specific parameter in Django?
- What is the purpose of implementing a form for searching in Django?
- What are custom template tags used for in Django?
- What is the difference between using the GET and POST methods in forms for filtering and searching?
- What are the main reasons for writing tests in Django?
- How can you test custom model methods in Django?
- What are the main stages of deploying a Django project?
- What steps are necessary to prepare a Django project for deployment?
- What security practices should be considered when deploying a Django project?
- Which database is better to choose for use during deployment?
- What is an API?
- What is a REST API?
- What is Postman?
- What is browsable API?
- What is the difference between stateful and stateless?
- What is Django Rest Framework?
- What are serializers?
- What are serialization & deserialization?
- What are ViewSets in DRF?
- What are routers in DRF?
- What is the difference between APIViews and ViewSets in DRF?
- What is the difference between GenericAPIView and GenericViewSet?
- What are ViewSet actions in DRF?
- How to write custom action on ViewSet?
- What are the purpose of get_queryset & get_serializer_class methods in ViewSet?
- What is validation in DRF?
- What are Nested Serializers in DRF?
- What are Permissions in DRF?
- What is Token Authentication?
- How can you work with images in Django REST Framework, and what module is commonly used for image processing?
- What is the purpose of the @action decorator in Django REST Framework, and how is it typically used?
- How can you modify the authentication process in Django REST Framework to use email instead of username?
- What are JSON Web Tokens (JWTs)?
- JWT vs Token Authentication vs Session Authentication
- What are access/refresh token?
- What is Swagger?
- What is Docker, and how does it differ from virtual machines (VMs)?
- Explain the concept of containerization and its advantages.
- What is a Docker image, and how does it relate to Docker containers?
- What is Docker Compose, and how does it facilitate running a Django project with a Postgres database?
- Explain the concept of Docker volumes and their significance in persisting data generated by and used by Docker containers.
- How can Docker be used to work with static files and media data in a Django project, and what steps are involved in setting it up?
- How to fix CORS errors in Django?
- What is the difference between concurrency and parallelism in programming, and when would you use each concept?
- How does Python's Global Interpreter Lock (GIL) impact concurrency in the CPython interpreter, and what are its implications for multithreading?
- Explain the concept of threading in Python and how it differs from multiprocessing.
- What is the purpose of the asyncio module in Python, and how does it enable asynchronous programming?
- How does asyncio enable asynchronous programming, and what are the key components involved in asyncio-based code?
- Can you explain the difference between synchronous and asynchronous programming in Python, using examples from asyncio?