Junior Backend Developer Interview Preparation Guide
Table of Contents
1. Python Programming Fundamentals
2. FastAPI Framework
3. REST API Concepts
4. MongoDB & NoSQL Databases
5. Version Control (Git/GitHub)
6. API Testing with Postman
7. Frontend-Backend Integration
8. DevOps & Deployment
9. Resume-Based Questions
10. System Design & Architecture
Python Programming Fundamentals
Q1: What is Python and why is it popular for backend development?
A: Python is a high-level, interpreted programming language known for its simplicity and readability. It's
popular for backend development because:
Clean, readable syntax
Rich ecosystem of libraries and frameworks
Strong community support
Excellent for rapid development
Cross-platform compatibility
Great for API development and data processing
Q2: Explain the difference between lists and tuples in Python.
A:
Lists: Mutable, ordered collections. Can be modified after creation. Syntax: [1, 2, 3]
Tuples: Immutable, ordered collections. Cannot be modified after creation. Syntax: (1, 2, 3)
Lists use more memory but are flexible; tuples are memory-efficient and can be used as dictionary
keys.
Q3: What are Python decorators and give an example?
A: Decorators are functions that modify or extend the behavior of other functions without changing their
code.
python
def log_execution(func):
def wrapper(*args, **kwargs):
print(f"Executing {func.__name__}")
result = func(*args, **kwargs)
print(f"Finished {func.__name__}")
return result
return wrapper
@log_execution
def add_numbers(a, b):
return a + b
Q4: Explain async/await in Python.
A: Async/await enables asynchronous programming:
async def defines a coroutine function
await pauses execution until the awaited operation completes
Allows handling multiple operations concurrently without blocking
python
async def fetch_data():
await some_async_operation()
return data
Q5: What is the difference between == and is in Python?
A:
== compares values (equality)
is compares object identity (same object in memory)
python
a = [1, 2, 3]
b = [1, 2, 3]
print(a == b) # True (same values)
print(a is b) # False (different objects)
FastAPI Framework
Q6: What is FastAPI and why would you choose it over other frameworks?
A: FastAPI is a modern Python web framework for building APIs. Benefits:
High performance (comparable to NodeJS and Go)
Automatic API documentation (Swagger/OpenAPI)
Type hints support with automatic validation
Async support out of the box
Easy to learn and use
Built-in data validation and serialization
Q7: How do you create a simple FastAPI application?
A:
python
from fastapi import FastAPI
app = FastAPI()
@app.get("/")
async def root():
return {"message": "Hello World"}
@app.get("/items/{item_id}")
async def read_item(item_id: int, q: str = None):
return {"item_id": item_id, "q": q}
Q8: Explain Pydantic models in FastAPI.
A: Pydantic models define data structures with automatic validation:
python
from pydantic import BaseModel
class Item(BaseModel):
name: str
price: float
is_offer: bool = False
@app.post("/items/")
async def create_item(item: Item):
return item
Q9: How do you handle dependencies in FastAPI?
A: Dependencies provide reusable functionality:
python
from fastapi import Depends
async def common_parameters(q: str = None, skip: int = 0, limit: int = 100):
return {"q": q, "skip": skip, "limit": limit}
@app.get("/items/")
async def read_items(commons: dict = Depends(common_parameters)):
return commons
Q10: How do you handle exceptions in FastAPI?
A:
python
from fastapi import HTTPException
@app.get("/items/{item_id}")
async def read_item(item_id: str):
if item_id not in items:
raise HTTPException(status_code=404, detail="Item not found")
return {"item": items[item_id]}
REST API Concepts
Q11: What is REST and what are its principles?
A: REST (Representational State Transfer) is an architectural style for web services:
Stateless: Each request contains all necessary information
Client-Server: Separation of concerns
Cacheable: Responses should be cacheable
Uniform Interface: Consistent API design
Layered System: Architecture can have multiple layers
Code on Demand: Optional - server can send executable code
Q12: Explain HTTP methods and their use in REST APIs.
A:
GET: Retrieve data (idempotent, safe)
POST: Create new resources
PUT: Update/replace entire resource (idempotent)
PATCH: Partial updates
DELETE: Remove resources (idempotent)
HEAD: Get headers only
OPTIONS: Get allowed methods
Q13: What are HTTP status codes and their categories?
A:
1xx: Informational
2xx: Success (200 OK, 201 Created, 204 No Content)
3xx: Redirection (301 Moved Permanently, 304 Not Modified)
4xx: Client Error (400 Bad Request, 401 Unauthorized, 404 Not Found)
5xx: Server Error (500 Internal Server Error, 502 Bad Gateway)
Q14: What is the difference between PUT and PATCH?
A:
PUT: Replaces the entire resource. Send complete object.
PATCH: Partial update. Send only fields to be updated.
PUT /users/1 - Replace entire user
PATCH /users/1 - Update specific fields only
Q15: How do you design RESTful URLs?
A: Best practices:
Use nouns, not verbs: /users not /getUsers
Use plural nouns: /users not /user
Hierarchical structure: /users/1/orders/5
Use query parameters for filtering: /users?status=active&limit=10
Keep URLs simple and consistent
MongoDB & NoSQL Databases
Q16: What is MongoDB and how does it differ from SQL databases?
A: MongoDB is a NoSQL document database:
Structure: Documents (JSON-like) vs Tables/Rows
Schema: Flexible vs Fixed schema
Scalability: Horizontal scaling vs Vertical scaling
Queries: MongoDB queries vs SQL queries
ACID: Eventual consistency vs ACID compliance
Use cases: Unstructured data vs Structured data
Q17: What are MongoDB collections and documents?
A:
Collections: Groups of documents (similar to tables)
Documents: BSON objects containing key-value pairs (similar to rows)
javascript
// Document example
{
"_id": ObjectId("..."),
"name": "John Doe",
"email": "[email protected]",
"orders": [
{"product": "laptop", "price": 999}
]
}
Q18: Basic MongoDB operations in Python (PyMongo)?
A:
python
from pymongo import MongoClient
client = MongoClient("mongodb://localhost:27017/")
db = client["mydatabase"]
collection = db["users"]
# Insert
user = {"name": "John", "email": "[email protected]"}
result = collection.insert_one(user)
# Find
users = collection.find({"name": "John"})
# Update
collection.update_one(
{"name": "John"},
{"$set": {"email": "[email protected]"}}
)
# Delete
collection.delete_one({"name": "John"})
Q19: What are MongoDB indexes and why are they important?
A: Indexes improve query performance:
Speed up data retrieval
Reduce query execution time
Support for compound indexes
javascript
// Create index
db.users.createIndex({"email": 1}) // Ascending
db.users.createIndex({"name": 1, "age": -1}) // Compound
Q20: Explain MongoDB aggregation pipeline.
A: Pipeline for data processing and analysis:
javascript
db.orders.aggregate([
{ $match: { status: "completed" } },
{ $group: { _id: "$userId", total: { $sum: "$amount" } } },
{ $sort: { total: -1 } },
{ $limit: 10 }
])
Version Control (Git/GitHub)
Q21: What is Git and why is it important?
A: Git is a distributed version control system:
Track changes in source code
Collaborate with multiple developers
Maintain project history
Branch and merge capabilities
Backup and recovery
Open source and widely adopted
Q22: Explain basic Git commands.
A:
bash
git init # Initialize repository
git clone <url> # Clone repository
git add . # Stage changes
git commit -m # Commit changes
git push # Push to remote
git pull # Pull from remote
git branch # List branches
git checkout # Switch branches
git merge # Merge branches
git status # Check status
Q23: What is the difference between git pull and git fetch ?
A:
git fetch: Downloads changes but doesn't merge them
git pull: Downloads and automatically merges changes ( fetch + merge )
Q24: Explain Git branching strategies.
A:
Main/Master: Production-ready code
Develop: Integration branch for features
Feature branches: Individual features ( feature/user-auth )
Release branches: Prepare for production release
Hotfix branches: Quick fixes for production issues
Q25: How do you resolve merge conflicts in Git?
A:
1. Git marks conflicts in files with <<<<<<< , ======= , >>>>>>>
2. Manually edit files to resolve conflicts
3. Remove conflict markers
4. git add resolved files
5. git commit to complete merge
API Testing with Postman
Q26: What is Postman and why is it useful for API testing?
A: Postman is an API testing platform:
Test REST, SOAP, GraphQL APIs
Create and organize API collections
Automated testing with scripts
Environment variables management
Team collaboration features
Generate API documentation
Q27: How do you test different HTTP methods in Postman?
A:
1. Select HTTP method (GET, POST, PUT, DELETE, etc.)
2. Enter request URL
3. Add headers if needed
4. Add request body for POST/PUT requests
5. Send request and analyze response
6. Check status code, headers, and response body
Q28: How do you use environment variables in Postman?
A:
Create environments (Dev, Staging, Production)
Define variables: {{baseURL}} , {{apiKey}}
Use in requests: {{baseURL}}/api/users
Switch environments easily
Manage sensitive data securely
Q29: How do you write test scripts in Postman?
A:
javascript
// Test status code
pm.test("Status code is 200", function () {
pm.response.to.have.status(200);
});
// Test response body
pm.test("Response has user data", function () {
var jsonData = pm.response.json();
pm.expect(jsonData.name).to.eql("John Doe");
});
// Set environment variable
pm.environment.set("userId", jsonData.id);
Q30: How do you organize API requests in Postman?
A:
Collections: Group related requests
Folders: Organize within collections
Documentation: Add descriptions and examples
Pre-request scripts: Set up data before requests
Tests: Validate responses after requests
Frontend-Backend Integration
Q31: How do you handle CORS in FastAPI?
A:
python
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
app = FastAPI()
app.add_middleware(
CORSMiddleware,
allow_origins=["http://localhost:3000"], # React app
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)
Q32: How do you consume APIs in React?
A:
javascript
// Using fetch
useEffect(() => {
fetch('http://localhost:8000/api/users')
.then(response => response.json())
.then(data => setUsers(data))
.catch(error => console.error('Error:', error));
}, []);
// Using axios
import axios from 'axios';
const fetchUsers = async () => {
try {
const response = await axios.get('/api/users');
setUsers(response.data);
} catch (error) {
console.error('Error:', error);
}
};
Q33: How do you handle authentication between frontend and backend?
A:
JWT Tokens: Backend generates token, frontend stores and sends in headers
Session cookies: Server maintains session, sends cookie to client
OAuth: Third-party authentication (Google, GitHub)
python
# FastAPI JWT example
from fastapi import Depends, HTTPException, status
from jose import JWTError, jwt
def get_current_user(token: str = Depends(oauth2_scheme)):
try:
payload = jwt.decode(token, SECRET_KEY, algorithms=[ALGORITHM])
username = payload.get("sub")
if username is None:
raise credentials_exception
except JWTError:
raise credentials_exception
return username
Q34: How do you handle file uploads between React and FastAPI?
A:
python
# FastAPI
from fastapi import File, UploadFile
@app.post("/upload/")
async def upload_file(file: UploadFile = File(...)):
contents = await file.read()
# Process file
return {"filename": file.filename}
javascript
// React
const handleFileUpload = async (file) => {
const formData = new FormData();
formData.append('file', file);
await fetch('/upload/', {
method: 'POST',
body: formData,
});
};
DevOps & Deployment
Q35: What is Docker and how is it useful?
A: Docker is a containerization platform:
Containers: Lightweight, portable environments
Images: Templates for containers
Consistency: Same environment across development and production
Isolation: Applications run independently
Scalability: Easy to scale applications
Q36: How do you dockerize a FastAPI application?
A:
dockerfile
FROM python:3.9-slim
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]
Q37: What is CI/CD and its benefits?
A: Continuous Integration/Continuous Deployment:
CI: Automatically integrate code changes, run tests
CD: Automatically deploy to production
Benefits: Faster delivery, fewer bugs, consistent deployments
Tools: GitHub Actions, Jenkins, GitLab CI
Q38: How do you deploy applications to AWS?
A:
EC2: Virtual servers for applications
RDS: Managed database service
S3: File storage
Lambda: Serverless functions
Load Balancer: Distribute traffic
CloudWatch: Monitoring and logging
Resume-Based Questions
Q39: Tell me about your experience at Arvesi Technologies.
A: "I started as a Full Stack Developer Intern working with React.js, Node.js, and RESTful APIs. After
proving myself, I was promoted to Backend Developer where I focused on optimizing performance and
system scalability. Key achievements include:
Refactored backend codebase improving maintainability
Implemented parallel processing reducing response times by 25%
Managed AWS infrastructure with EC2, Lambda, and RDS
Integrated Redis caching and Firebase Cloud Messaging"
Q40: Explain the parallel processing optimization you implemented.
A: "I identified bottlenecks in our API endpoints where operations were running sequentially. I redesigned
the architecture to process multiple operations concurrently using Python's asyncio and
concurrent.futures modules. This resulted in 25% faster response times and 30% lower server load,
significantly improving user experience."
Q41: How did you implement Redis caching?
A: "I used Redis as a caching layer to store frequently accessed data like user sessions, API responses, and
database query results. Implementation involved:
Setting up Redis cluster for high availability
Implementing cache-aside pattern
Using appropriate TTL values for different data types
Monitoring cache hit rates to optimize performance"
Q42: Tell me about the AstroBhanu project.
A: "AstroBhanu is a full-fledged astrology platform I built using Next.js and React.js with Strapi CMS for
content management. Key features include:
Firebase Auth for user authentication
Razorpay integration for payments
PostgreSQL database on AWS RDS
Server-side rendering for better SEO
Responsive design for all devices"
Q43: How did you optimize database latency for the Trunk project?
A: "I migrated our MongoDB instance from Mumbai to US servers to reduce latency for our primary user
base. Additionally, I:
Optimized database queries and indexes
Implemented connection pooling
Used database sharding for better performance
Monitored query execution times and optimized slow queries"
Q44: What was your role in the Doc-Connect hackathon project?
A: "I led the full-stack development of a doctor appointment platform using React and Node.js. The
system included:
User authentication and profile management
Appointment booking and scheduling system
Responsive UI for patients and doctors
MongoDB for scalable data storage
RESTful APIs for frontend-backend communication"
System Design & Architecture
Q45: How would you design a RESTful API for a blog system?
A:
GET /posts - Get all posts
GET /posts/{id} - Get specific post
POST /posts - Create new post
PUT /posts/{id} - Update post
DELETE /posts/{id} - Delete post
GET /posts/{id}/comments - Get post comments
POST /posts/{id}/comments - Add comment
Q46: How do you handle database relationships in MongoDB?
A:
Embedding: Store related data in same document (1-to-few)
Referencing: Store ObjectId references (1-to-many)
Hybrid: Combination based on access patterns
javascript
// Embedded
{
"user": "John",
"address": {
"street": "123 Main St",
"city": "Mumbai"
}
}
// Referenced
{
"user": "John",
"orders": [ObjectId("..."), ObjectId("...")]
}
Q47: How do you implement pagination in APIs?
A:
python
@app.get("/posts")
async def get_posts(skip: int = 0, limit: int = 10):
posts = await collection.find().skip(skip).limit(limit).to_list(length=limit)
total = await collection.count_documents({})
return {
"posts": posts,
"total": total,
"skip": skip,
"limit": limit
}
Q48: How do you handle API versioning?
A:
URL versioning: /api/v1/users , /api/v2/users
Header versioning: Accept: application/vnd.api.v1+json
Query parameter: /api/users?version=1
Subdomain: v1.api.example.com
Q49: How do you implement rate limiting?
A:
python
from slowapi import Limiter, _rate_limit_exceeded_handler
from slowapi.util import get_remote_address
from slowapi.errors import RateLimitExceeded
limiter = Limiter(key_func=get_remote_address)
app.state.limiter = limiter
app.add_exception_handler(RateLimitExceeded, _rate_limit_exceeded_handler)
@app.get("/api/data")
@limiter.limit("5/minute")
async def get_data(request: Request):
return {"data": "response"}
Q50: How do you ensure API security?
A:
Authentication: JWT tokens, API keys
Authorization: Role-based access control
Input validation: Sanitize and validate all inputs
HTTPS: Encrypt data in transit
Rate limiting: Prevent abuse
CORS: Control cross-origin requests
Security headers: XSS protection, content security policy
Regular updates: Keep dependencies updated
Additional Technical Questions
Q51: How do you handle errors in FastAPI applications?
A:
python
from fastapi import HTTPException
from fastapi.responses import JSONResponse
@app.exception_handler(ValueError)
async def value_error_handler(request, exc):
return JSONResponse(
status_code=400,
content={"message": "Invalid value provided"}
)
# Custom exception
class ItemNotFound(Exception):
def __init__(self, item_id: str):
self.item_id = item_id
@app.exception_handler(ItemNotFound)
async def item_not_found_handler(request, exc):
return JSONResponse(
status_code=404,
content={"message": f"Item {exc.item_id} not found"}
)
Q52: What is middleware in FastAPI?
A: Middleware processes requests and responses:
python
@app.middleware("http")
async def add_process_time_header(request: Request, call_next):
start_time = time.time()
response = await call_next(request)
process_time = time.time() - start_time
response.headers["X-Process-Time"] = str(process_time)
return response
Q53: How do you implement background tasks in FastAPI?
A:
python
from fastapi import BackgroundTasks
def send_notification(email: str, message: str):
# Send email notification
pass
@app.post("/send-notification/")
async def send_notification_endpoint(
email: str,
background_tasks: BackgroundTasks
):
background_tasks.add_task(send_notification, email, "Welcome!")
return {"message": "Notification sent"}
Q54: How do you test FastAPI applications?
A:
python
from fastapi.testclient import TestClient
import pytest
client = TestClient(app)
def test_read_main():
response = client.get("/")
assert response.status_code == 200
assert response.json() == {"message": "Hello World"}
def test_create_item():
response = client.post(
"/items/",
json={"name": "Test Item", "price": 10.5}
)
assert response.status_code == 200
assert response.json()["name"] == "Test Item"
Q55: How do you optimize API performance?
A:
Caching: Redis, in-memory caching
Database optimization: Indexes, query optimization
Async operations: Non-blocking I/O
Connection pooling: Reuse database connections
Compression: Gzip response compression
CDN: Content delivery networks for static assets
Load balancing: Distribute requests across servers
Monitoring: Track performance metrics
Interview Tips
Preparation Strategy:
1. Review your resume thoroughly - Be ready to explain every project and technology
2. Practice coding problems - Basic algorithms and data structures
3. Understand the job requirements - Focus on FastAPI, MongoDB, and Python
4. Prepare questions - Show interest in the company and role
5. Mock interviews - Practice explaining technical concepts clearly
During the Interview:
Start with your thought process
Ask clarifying questions
Think out loud while solving problems
Admit when you don't know something
Show enthusiasm for learning
Give specific examples from your experience
Key Points to Emphasize:
Your backend development experience at Arvesi Technologies
Performance optimization achievements (25% improvement)
Full-stack capabilities with modern technologies
Experience with cloud platforms (AWS)
Collaborative development practices (Agile, code reviews)
Good luck with your interview! Remember to stay calm, be confident about your experience, and show
your passion for backend development.