DataTerrain
Web Dakaar Digital Consultancy Interview Questions and Answers
Q1. How to fetch API data in Django from server using params and it can fetch data dynamically i.e., -----/?querydata=seetha, here the query data may be a username, email, mobile number, register number, registered...
read moreTo fetch API data in Django from server using params dynamically.
Use Django's HttpRequest object to access query parameters
Extract the query parameter value using request.GET.get('querydata')
Use the extracted value to dynamically fetch data from the server
Q2. How to revert the previous changes made on the database server in Django i.e., Migration A, B, C, D you are now ready with new changes as E but need to revert the changes B?
To revert changes made in Django migrations, use the command 'python manage.py migrate <app_name> <migration_name>'.
Use the command 'python manage.py showmigrations' to list all migrations and their names.
Identify the migration name you want to revert (e.g., 'app_name', '0002_migration_name').
Run the command 'python manage.py migrate <app_name> <migration_name>' to revert the specific migration.
Q3. How to use decorator and explain the difference between @login_required and @permission_required in Django?
Decorators in Django are used to modify the behavior of functions or methods. @login_required ensures user authentication, while @permission_required checks for specific permissions.
Decorators are functions that wrap another function to modify its behavior.
@login_required decorator ensures that the user is authenticated before accessing a view.
@permission_required decorator checks if the user has specific permissions before allowing access.
Example: @login_required def my_view...read more
Q4. What are SQL Procedures and Triggers, when the triggers are used?
SQL Procedures are stored SQL code that can be executed on demand. Triggers are special types of stored procedures that are automatically executed when certain events occur.
SQL Procedures are reusable blocks of SQL code that can be called by other programs or scripts.
Triggers are special types of stored procedures that are automatically executed when specific events occur in the database.
Triggers are commonly used for enforcing business rules, auditing changes, and maintainin...read more
Q5. What is the mechanism for utilizing message queues and caching systems?
Message queues and caching systems are used to improve performance and scalability in web applications.
Message queues help in decoupling components by allowing asynchronous communication between them.
Caching systems store frequently accessed data in memory to reduce database load and improve response times.
Popular message queue systems include RabbitMQ, Kafka, and Redis.
Common caching systems include Memcached and Redis.
Django provides built-in support for caching using the c...read more
Q6. How the REST API works and what are the methods are available and explain?
REST API is a set of rules and conventions for building and interacting with web services.
REST stands for Representational State Transfer
Methods available in REST API are GET, POST, PUT, DELETE
GET - Used to retrieve data from a server
POST - Used to send data to a server to create a new resource
PUT - Used to update an existing resource on the server
DELETE - Used to remove a resource from the server
Example: GET request to fetch a list of users from a database
Q7. What is custom middleware, how to create and explain with example code?
Custom middleware in Django allows for processing requests and responses before reaching views.
Custom middleware is a Python class that defines methods to process requests and responses in Django.
To create custom middleware, define a class with methods like process_request, process_response, etc.
Register the custom middleware in the Django settings.py file under the MIDDLEWARE key.
Example code: class CustomMiddleware: def __init__(self, get_response): self.get_response = get_...read more
Q8. How to handle the different type of databases in Django? Have you done before in your projects?
Django supports multiple databases through its database router feature.
Django allows defining multiple database connections in settings.py
Use database routers to route specific models to different databases
Example: routing user data to a separate database for better performance
Q9. What is difference between Class-based views and function-based views?
Class-based views are based on classes and provide more structure and functionality, while function-based views are based on functions and are simpler and more flexible.
Class-based views are defined as classes and inherit from Django's generic view classes, providing built-in functionality such as mixins and decorators.
Function-based views are defined as functions and are more flexible, allowing for custom logic and control over the request-response cycle.
Class-based views ar...read more
Interview Process at Web Dakaar Digital Consultancy
Reviews
Interviews
Salaries
Users/Month