Hi guys, recently I gave an interview at a startup company. I can’t reveal their name, but I am posting the questions they asked me. It was a Python Developer interview, but they also asked questions from Django, MySQL, and JavaScript.
1. What is a Django Signal?
A Django signal is a messaging system that allows certain parts of your application to send notifications (signals) when an action occurs, and other parts of the app can listen and react to those events automatically.
In Other words:
Signals let you run some code whenever something happens in Django (like after a user is saved, deleted, or logged in).
2. How does map() work in JavaScript?
map() is an array method that loops through each element, applies a function, and returns a new array without modifying the original.
Example:
[1, 2, 3].map(n => n * 2) // [2, 4, 6]3. What is Django ORM?
Django ORM is Object Relational Mapper that lets you interact with the database using Python instead of SQL.
Example:
Student.objects.filter(age__gt=20)4. What is a Trigger in SQL?
A trigger is an automatic block of SQL code that runs when you insert, update, or delete data in a table.
Used for logs, validation, and audits.
5. Example of One-to-Many relationship in Django ORM
from django.db import models
class Category(models.Model):
name = models.CharField(max_length=100)
class Product(models.Model):
name = models.CharField(max_length=100)
category = models.ForeignKey(Category, on_delete=models.CASCADE)
6. Difference between REST API and SOAP API
SOAP is a strict, XML-based protocol with built-in security
REST is a lightweight, flexible API style using JSON.
| REST | SOAP |
| Flexible | Strict |
| JSON/XML | XML Only |
| Lightweight | Heavy |
| No WSDL | Uses WSDL |
| Quick | Slower |
Keep it short in interviews.
7. How do you authenticate a REST API?
You can authenticate REST APIs using:
- Token Authentication
- JWT
- OAuth2
- API Key
- Basic Auth
Mention JWT, it’s the most popular.
8. DDL – Data Definition Language
DDL (Data Definition Language) is a type of SQL command used to define, create, modify, and delete database structures such as tables, indexes, schemas, and views.
Commands:
- CREATE
- ALTER
- DROP
- TRUNCATE
- RENAME
Deals with tables, columns, and schemas.
9. DML – Data Manipulation Language
DML (Data Manipulation Language) is a set of SQL commands used to insert, update, delete, and retrieve data from a database.
Commands:
- INSERT
- UPDATE
- DELETE
- MERGE (in some DBs)
Changes data, not structure.
10. How you write a custom SQL query in django
Django provides a connection.cursor() functionality, and by using this cursor, we can write and execute custom SQL queries directly. For example:
from django.db import connection
with connection.cursor() as cursor:
cursor.execute("SELECT * FROM mytable")
data = cursor.fetchall()
