Docsity

backend question for interview, Cheat Sheet of Engineering

Toggle sidebar
bg1
Backend Developer Interview Guide
ESSENTIAL QUESTIONS & ANSWERS FOR FRESHER ROLES
1. Core Web Concepts & Networking
Q1. What happens when you type a URL into a browser and press Enter?
This is a foundational question to test your end-to-end understanding of the web architecture:
DNS Lookup: The browser checks its cache, then requests the OS/DNS server to resolve the domain name
(e.g., google.com) into an IP address.
TCP Connection: The browser initiates a TCP 3-way handshake (SYN, SYN-ACK, ACK) to establish a
connection with the target server.
HTTP Request: The browser sends an HTTP/HTTPS request (GET, POST, etc.) containing headers and
cookies to the server.
Server Processing: The backend server (e.g., Node.js/Express, Spring Boot) processes the request, interacts
with databases, and prepares a response.
HTTP Response: The server sends back an HTTP response code (e.g., 200 OK) along with the requested
payload (HTML, JSON, etc.).
Rendering: The browser parses HTML/CSS/JS and renders the visual page.
Q2. Explain the common HTTP Methods and their Idempotency.
HTTP methods define the action to be performed on a resource. Idempotency means making multiple identical
requests has the same effect as making a single request.
Method Purpose Idempotent? Safe? (Doesn't modify data)
GET Retrieve data from server Yes Yes
POST Create a new resource No No
PUT Update/Replace an entire resource Yes No
PATCH Partially update an existing resource No (usually) No
DELETE Remove a resource Yes No
Q3. What are HTTP Status Codes? Give examples of common ones.
Status codes are 3-digit responses from the server indicating the outcome of a request:
1xx (Informational): 101 Switching Protocols (used in WebSockets).
2xx (Success): 200 OK (Success), 201 Created (Resource successfully created via POST).
3xx (Redirection): 301 Moved Permanently, 304 Not Modified (Cached resource is valid).
4xx (Client Error): 400 Bad Request, 401 Unauthorized (Auth required), 403 Forbidden (Insufficient
permissions), 404 Not Found.
5xx (Server Error): 500 Internal Server Error, 502 Bad Gateway, 503 Service Unavailable.
1.
2.
3.
4.
5.
6.
•
•
•
•
•
Backend Interview Guide (Fresher) 1
pf3
pf4

Partial preview of the text

Download backend question for interview and more Cheat Sheet Engineering in PDF only on Docsity!

Backend Developer Interview Guide

ESSENTIAL QUESTIONS & ANSWERS FOR FRESHER ROLES

1. Core Web Concepts & Networking

Q1. What happens when you type a URL into a browser and press Enter?

This is a foundational question to test your end-to-end understanding of the web architecture:

DNS Lookup: The browser checks its cache, then requests the OS/DNS server to resolve the domain name (e.g., google.com) into an IP address. TCP Connection: The browser initiates a TCP 3-way handshake (SYN, SYN-ACK, ACK) to establish a connection with the target server. HTTP Request: The browser sends an HTTP/HTTPS request (GET, POST, etc.) containing headers and cookies to the server. Server Processing: The backend server (e.g., Node.js/Express, Spring Boot) processes the request, interacts with databases, and prepares a response. HTTP Response: The server sends back an HTTP response code (e.g., 200 OK) along with the requested payload (HTML, JSON, etc.). Rendering: The browser parses HTML/CSS/JS and renders the visual page.

Q2. Explain the common HTTP Methods and their Idempotency.

HTTP methods define the action to be performed on a resource. Idempotency means making multiple identical requests has the same effect as making a single request.

Method Purpose Idempotent? Safe? (Doesn't modify data)

GET Retrieve data from server Yes Yes

POST Create a new resource No No

PUT Update/Replace an entire resource Yes No

PATCH Partially update an existing resource No (usually) No

DELETE Remove a resource Yes No

Q3. What are HTTP Status Codes? Give examples of common ones.

Status codes are 3-digit responses from the server indicating the outcome of a request:

1xx (Informational): 101 Switching Protocols (used in WebSockets). 2xx (Success): 200 OK (Success), 201 Created (Resource successfully created via POST). 3xx (Redirection): 301 Moved Permanently, 304 Not Modified (Cached resource is valid). 4xx (Client Error): 400 Bad Request, 401 Unauthorized (Auth required), 403 Forbidden (Insufficient permissions), 404 Not Found. 5xx (Server Error): 500 Internal Server Error, 502 Bad Gateway, 503 Service Unavailable.

  1. Database Management Systems (DBMS)

Q4. What is the difference between SQL and NoSQL databases? When should you use which?

Feature SQL (Relational - e.g., PostgreSQL, MySQL)

NoSQL (Non-Relational - e.g., MongoDB, Redis)

Structure Structured tables with rigid rows andcolumns. Flexible schemas (Documents, Key-Value,Graphs).

Relationships Handled efficiently using foreign keys andJOINs. Handled via embedded documents or referenceIDs.

Scaling Vertically scalable (upgrade hardwarepower). Horizontally scalable (add more machines/sharding).

ACID Strict compliance natively guaranteed. Varies; prioritizes performance and scalability (BASE).

Use SQL when: Data structural integrity is critical (e.g., Financial transactions), or complex relational reports are needed. Use NoSQL when: Unstructured or rapidly changing data layouts (e.g., Content Management, Product Catalogs), or extreme horizontal write scale is required.

Q5. Explain Database Indexing and why we use it.

An index is a data structure (typically a B-Tree or B+ Tree) that stores pointer references to table records to speed up data retrieval queries at the cost of slower writes (since the index must update whenever data changes).

Analogy: Think of a database index like an index at the back of a textbook. Instead of flipping through every page to find a topic (Full Table Scan), you look up the topic in the index and jump straight to the exact page.

Q6. What are ACID properties in a database?

ACID ensures reliable data transaction processing:

Atomicity: "All or nothing." If any statement within a transaction fails, the entire transaction is rolled back. Consistency: A transaction transforms a database from one valid state to another, maintaining all schema constraints. Isolation: Concurrent transactions run independently without interfering or bleeding dirty data into one another. Durability: Once a transaction commits, changes are permanently saved in non-volatile memory, even during a power failure.

Q11. What is Middleware in a backend context?

Middleware functions are code blocks executed sequentially in the middle of a request-response cycle. They have access to the request object (req), response object (res), and the next middleware function via next(). Common Use cases: Request logging, parsing incoming JSON bodies, checking authentication tokens, adding CORS permissions rules.

  1. Quick Scenario & Problem Solving Tips

Bonus Tip: How to stand out as a Fresher in Backend Interviews?

Don't just mention frameworks: Understand why you use MongoDB instead of SQL, or how Node.js scales differently than a multi-threaded framework like Java Spring Boot. Error Handling: Always explain how you handle edge cases (e.g., checking if database results are null before acting on them, wrapping code in try/catch blocks). Security Fundamentals: Mentioning sanitizing database inputs to prevent SQL Injection or NoSQL injection instantly demonstrates a professional architectural mindset.