Skip to main content
Knowledge Hub · Give Back Initiative

HUB_STATUS: OPERATIONAL // 20_YRS_OF_KNOWLEDGE · FREE_ACCESS

Two Decades of Engineering Knowledge,Given Back. For Free.

Thousands of interview questions, real-world errors with root-cause solutions, reusable code archives, and structured learning paths — built through 20 years of actual engineering.

One lamp can light a hundred more without losing its own flame. This knowledge hub is not a product. It is not a funnel. It is a contribution — to every developer who once searched alone at 2 AM for an answer that did not exist anywhere on the internet. It exists now. Here.

"A lamp loses nothing by lighting another lamp. This is why this knowledge exists — not to be held, but to be shared."
— Debasis Bhattacharjee
3,500+
Interview Questions

Across 18 languages & frameworks

1,200+
Debug Solutions

Real errors. Root-cause fixes.

800+
Code Snippets

Copy-paste ready. Production tested.

24
Learning Paths

Beginner → Advanced, structured

Section IV · Knowledge Domains

DOMAINS_MAPPED // PHP · JS · PYTHON · AI · SECURITY · ARCHITECTURE

Explore the Ecosystem

View All Domains →
01 · DOMAIN
Interview Questions

Categorized by language, role, and difficulty. From junior to architect-level. With curated model answers built from real hiring experience.

3,500+ questions Explore →
02 · DOMAIN
Error & Debug Archive

Searchable archive of real runtime errors, stack traces, and exceptions — each with root cause analysis and tested fix. Like Stack Overflow, but curated.

1,200+ solutions Explore →
03 · DOMAIN
Code Snippet Library

Reusable, production-tested code patterns across PHP, Python, JavaScript, VB.NET, SQL and more. No fluff — just working implementations.

800+ snippets Explore →
04 · DOMAIN
System Design Notes

Architecture patterns, design principles, scalability thinking, and real-world system breakdowns explained from an engineer who has built them.

150+ case studies Explore →
05 · DOMAIN
Learning Paths

Structured progression from beginner to professional — curriculum-style roadmaps with sequenced topics, milestones, and recommended resources.

24 paths Explore →
06 · DOMAIN
Security & Ethical Hacking

Penetration testing concepts, vulnerability patterns, OWASP deep dives, and defensive coding practices drawn from real security consulting work.

200+ topics Explore →
Section V · Interview Preparation

INTERVIEW_PREP: ACTIVE // JUNIOR · MID · SENIOR · ARCHITECT

Questions & Answers

All 54 Questions →
Q·011 What is hallucination in LLMs and why does it happen?
AI Integration AI Integration Beginner

Hallucination is when an LLM generates confident-sounding but factually incorrect or fabricated information. It happens because LLMs are trained to produce plausible next tokens based on patterns — not to retrieve verified facts.

Deep Dive: LLMs learn statistical patterns from training data and generate text that sounds fluent and coherent — but they have no mechanism for verifying that what they generate is factually true. The model predicts the most probable next token given context which may not correspond to reality especially for: obscure facts (low representation in training data) recent events (after training cutoff) precise numerical information (dates statistics) citations and URLs (commonly fabricated) and complex multi-step reasoning (errors compound). Hallucination is not a bug it is an inherent property of the probabilistic text generation approach. Mitigation strategies: RAG (ground the model in retrieved documents) chain-of-thought (forces the model to reason explicitly) output validation (verify claims against reliable sources) and citation requirements (ask the model to quote source text supporting claims).

Real-World: A legal AI assistant was generating case citations that did not exist — fabricated case names and citations that looked completely plausible. Lawyers who did not verify sources submitted briefs with non-existent precedents. Implementing a verification layer that checked all citations against a legal database before displaying them eliminated the problem.

⚠ Common Mistakes: Believing LLM outputs are inherently factual. Not validating LLM outputs before acting on them especially for medical legal or financial decisions. Using LLMs to recall specific numbers dates or citations without verification. Thinking that larger models do not hallucinate — they hallucinate less but still hallucinate.

🏭 Production Scenario: A medical information chatbot was confidently providing incorrect drug dosage information that contradicted official guidelines. The information sounded authoritative and patients followed it. This resulted in a product recall and regulatory action. The fix required implementing RAG against official medical databases for all drug-related queries.

Follow-up questions: What is grounding in AI and how does it reduce hallucination? What is the difference between closed-book and open-book question answering? How do you measure hallucination rate in a production system?

// ID: AI-BEG-004  ·  DIFFICULTY: 3/10  ·  ★★★☆☆☆☆☆☆☆

Q·012 What is prompt engineering and why does it matter for production AI systems?
AI Integration AI Integration Beginner

Prompt engineering is the practice of designing inputs to LLMs to reliably produce desired outputs. It matters in production because the same model with different prompts can produce dramatically different quality format and accuracy of responses.

Deep Dive: LLMs are extremely sensitive to how questions and instructions are phrased. A vague prompt produces vague output. A well-structured prompt with context constraints examples and a clear output format produces consistent usable output. Key techniques: zero-shot prompting (just the instruction) few-shot prompting (instruction + examples) chain-of-thought prompting (asking the model to reason step by step) system prompts (persistent instructions that frame all interactions) output format specification (JSON markdown specific structure) role prompting (giving the model a persona) and constraint specification (word limits forbidden content required elements). In production prompts are version-controlled tested and iterated on like code.

Real-World: A customer intent classification system was achieving 67% accuracy with a simple prompt. Adding three labeled examples (few-shot) specifying the output as a JSON object with confidence scores and adding a chain-of-thought instruction to 'explain your reasoning before giving the final category' raised accuracy to 89% on the same model.

⚠ Common Mistakes: Writing prompts that work once and assuming they will always work — LLMs are sensitive to small wording changes. Not version-controlling prompts making production debugging impossible. Using prompts that work on GPT-4 and assuming they work identically on GPT-3.5 or other models. Ignoring prompt injection vulnerabilities when building user-facing systems.

🏭 Production Scenario: A content moderation system was incorrectly flagging safe content as harmful at a rate of 12%. Prompt analysis revealed the system prompt was ambiguous about edge cases. Adding 10 examples of borderline-safe content with explicit reasoning reduced false positive rate to 3% without model retraining.

Follow-up questions: What is chain-of-thought prompting? What is the difference between system and user prompts? How do you evaluate and A/B test prompts?

// ID: AI-BEG-002  ·  DIFFICULTY: 3/10  ·  ★★★☆☆☆☆☆☆☆

Q·013 What is a neural network and how does it learn?
Machine Learning AI/ML Beginner

A neural network is a series of connected layers of mathematical functions (neurons) that transform inputs into outputs. It learns by adjusting the connection weights using backpropagation — computing how much each weight contributed to the error and updating it to reduce the error.

Deep Dive: A neural network has an input layer (receives features) hidden layers (learn representations) and an output layer (produces predictions). Each neuron computes a weighted sum of its inputs adds a bias and applies an activation function (ReLU sigmoid tanh) to introduce non-linearity. Learning happens through: forward pass (compute prediction) loss computation (measure how wrong the prediction was using a loss function like cross-entropy or MSE) backpropagation (use chain rule to compute gradient of loss with respect to each weight) and gradient descent (update weights in the direction that reduces loss). This cycle repeats for many iterations (epochs) over the training data. The learning rate controls how large each weight update is.

Real-World: Image classification: the input layer receives pixel values early hidden layers learn to detect edges and colors middle layers detect shapes and textures later layers detect object parts and the output layer assigns class probabilities. This hierarchical feature learning happens automatically through training — no hand-engineering required.

⚠ Common Mistakes: Using too high a learning rate causing the loss to oscillate or diverge. Not normalizing inputs (neural networks are sensitive to input scale). Not enough data — neural networks need more data than traditional ML algorithms to generalize. Using too many layers for a simple problem when a shallower network would suffice.

🏭 Production Scenario: A production image recognition model for quality control on a manufacturing line was failing to converge during training. Investigation showed input images were not normalized — pixel values ranged 0-255 instead of 0-1. Adding a normalization layer as the first layer stabilized training and the model converged in 50 epochs.

Follow-up questions: What is the vanishing gradient problem? What is the difference between SGD Adam and RMSprop optimizers? What is batch size and how does it affect training?

// ID: ML-BEG-005  ·  DIFFICULTY: 3/10  ·  ★★★☆☆☆☆☆☆☆

Q·014 What is a training set validation set and test set — and why do you need all three?
Machine Learning AI/ML Beginner

Training set is used to fit the model. Validation set is used to tune hyperparameters and select the best model. Test set is held out completely and used only once to report final performance. Using only train/test leads to overfitting on the test set through repeated evaluation.

Deep Dive: Without a separate validation set developers tune hyperparameters (learning rate tree depth regularization strength) by evaluating on the test set. Each evaluation leaks information about the test set into the model selection process — the final reported test accuracy is optimistically biased. A proper split: 70% training (model learns from this) 15% validation (used during development for hyperparameter tuning and model selection) 15% test (locked away evaluated exactly once to report final performance). For small datasets k-fold cross-validation replaces the validation set by rotating which portion of training data is held out. The test set must never be touched during any development decision.

Real-World: An ML competition showed that teams who repeatedly submitted to the public leaderboard (which used the test set) were effectively overfitting to the test set through hundreds of submission cycles. Teams who maintained a strict held-out final test set reported the more realistic performance numbers.

⚠ Common Mistakes: Using the test set during hyperparameter tuning then reporting test set performance as if it were unbiased. Not stratifying the split for classification — random splits of imbalanced data can put almost no positive examples in the validation set. Time-series data: splitting randomly instead of chronologically leaks future information into training.

🏭 Production Scenario: A production recommendation system was developed with 50 rounds of hyperparameter tuning each evaluated on the same test set. Deployed performance was 15% lower than the reported test AUC. Post-mortem confirmed the test set had been evaluated 50 times during development causing effective test set overfitting.

Follow-up questions: What is k-fold cross-validation and when do you use it? How do you handle time-series data splitting? What is nested cross-validation?

// ID: ML-BEG-004  ·  DIFFICULTY: 3/10  ·  ★★★☆☆☆☆☆☆☆

Q·015 What is the difference between a Python module and a package?
Python Core Python Beginner

A module is a single .py file containing Python code. A package is a directory containing multiple modules and an __init__.py file. Packages allow organizing related modules into a hierarchical namespace.

Deep Dive: Any .py file is a module — it can be imported with 'import filename'. A package is a directory with an __init__.py file (can be empty) that tells Python to treat the directory as a package. The __init__.py can import from submodules to define the package's public API. Modern Python (3.3+) supports namespace packages — directories without __init__.py — but explicit __init__.py is still preferred for clarity. Import paths follow the directory structure: in a package 'myapp' with a subpackage 'utils' containing 'helpers.py' you import with 'from myapp.utils.helpers import my_function'. The __init__.py content controls what 'from myapp import *' exports.

Real-World: Django is structured as a package: the top-level 'django' directory contains __init__.py and subpackages like 'django.db' 'django.http' 'django.contrib' each have their own __init__.py. This allows clean imports like 'from django.db import models' while keeping the codebase organized across hundreds of files.

⚠ Common Mistakes: Forgetting __init__.py in package directories (causes ImportError in Python 2 sometimes works as namespace package in Python 3 but can cause confusing behavior). Circular imports between modules in the same package. Relative imports (from . import module) vs absolute imports — relative imports can cause issues when running scripts directly.

🏭 Production Scenario: A production Django application was growing to 50+ Python files in a single directory. Refactoring into packages (api/ models/ services/ utils/) with __init__.py files and clean public APIs reduced import statement complexity and made it possible to see the application structure at a glance.

Follow-up questions: What is the __all__ variable in Python modules? How does Python's import system search for modules (sys.path)? What is the difference between 'import module' and 'from module import name'?

// ID: PY-BEG-008  ·  DIFFICULTY: 3/10  ·  ★★★☆☆☆☆☆☆☆

Q·016 How does try-except-finally work in Python?
Python Core Python Beginner

'try' runs code that might fail. 'except' catches specific errors. 'finally' always runs regardless of whether an error occurred — used for cleanup.

Deep Dive: The try block contains the risky code. If an exception occurs Python looks for a matching except clause. You can catch specific exception types (except ValueError) or use a bare except to catch everything (not recommended). The else clause (optional) runs only if no exception occurred. The finally clause always executes even if there was an exception or a return statement inside try — making it essential for releasing resources like file handles database connections or locks. Multiple except clauses can handle different exception types differently.

Real-World: In a database write operation: the try block executes the INSERT query the except block catches IntegrityError for duplicate keys and returns a meaningful error message the finally block always closes the database connection regardless of success or failure — preventing connection pool exhaustion.

⚠ Common Mistakes: Using a bare 'except:' that catches everything including KeyboardInterrupt and SystemExit making the program impossible to stop. Not closing resources in finally causing memory or connection leaks. Catching too broad an exception type and hiding real bugs.

🏭 Production Scenario: A production API server ran out of database connections after 6 hours because a developer forgot to close connections in a finally block. The try block opened a connection an exception occurred the connection was never closed and the pool was exhausted within hours under normal traffic.

Follow-up questions: What is the difference between except Exception and bare except? When does finally NOT execute? How do context managers (with statement) relate to try-finally?

// ID: PY-BEG-006  ·  DIFFICULTY: 3/10  ·  ★★★☆☆☆☆☆☆☆

Q·017 What are *args and **kwargs in Python functions?
Python Core Python Beginner

*args collects extra positional arguments as a tuple. **kwargs collects extra keyword arguments as a dictionary. Both allow functions to accept a variable number of arguments.

Deep Dive: When you define a function with *args any positional arguments beyond the explicitly defined ones are packed into a tuple called args. With **kwargs any keyword arguments not explicitly defined are packed into a dictionary called kwargs. The names args and kwargs are just convention — the * and ** operators are what matter. You can use *args and **kwargs together and you can also use them when calling functions to unpack sequences and dictionaries into arguments. This pattern is heavily used in decorators, class inheritance, and API wrappers.

Real-World: Django's class-based views use **kwargs extensively to pass URL parameters captured by the router into view methods. FastAPI uses *args and **kwargs in middleware to forward requests without knowing the exact signature of the next handler.

⚠ Common Mistakes: Confusing *args (tuple) with a list. Forgetting that *args must come before **kwargs in the function signature. Trying to access args by keyword or kwargs by position. Mutating args thinking it is a list.

🏭 Production Scenario: A logging decorator in a production Flask app broke when a new endpoint added a keyword argument. The fix was changing the decorator to use *args and **kwargs so it would transparently forward any arguments to the wrapped function without needing updates every time a new parameter was added.

Follow-up questions: How does ** unpacking work when calling a function? Can you have both *args and explicit keyword arguments? How are *args and **kwargs used in class __init__ with inheritance?

// ID: PY-BEG-003  ·  DIFFICULTY: 3/10  ·  ★★★☆☆☆☆☆☆☆

Q·018 What does the ‘is’ operator do versus ‘==’?
Python Core Python Beginner

'==' checks value equality. 'is' checks identity — whether two variables point to the exact same object in memory.

Deep Dive: The == operator calls the __eq__ method and compares values. The 'is' operator compares object identity using id(). Two objects can be equal in value but be different objects in memory. Python caches small integers (-5 to 256) and interned strings which can make 'is' return True unexpectedly for these values leading to subtle bugs if misused. You should almost never use 'is' to compare values — reserve it for None checks (if x is None) where it is both correct and idiomatic.

Real-World: In a user authentication system: 'if user_role == admin_role' correctly compares role names as strings. Using 'is' instead works on small test data due to string interning but silently fails in production when role strings come from a database and are different objects with the same value.

⚠ Common Mistakes: Using 'is' to compare strings or integers expecting value equality. Being confused by small integer caching making 'is' appear to work correctly during testing. Not using 'is None' — using == None instead which is slower and less Pythonic.

🏭 Production Scenario: A production bug was caused by comparing user permission strings with 'is' instead of '=='. Tests passed because short strings were interned but in production with database-fetched strings the comparison always returned False locking all users out of admin features.

Follow-up questions: What is object identity in Python? How does Python intern strings? Why is 'is None' preferred over '== None'?

// ID: PY-BEG-002  ·  DIFFICULTY: 3/10  ·  ★★★☆☆☆☆☆☆☆

Q·019 What is cross-validation and why is it better than a single train-test split?
Machine Learning AI/ML Beginner

Cross-validation trains and evaluates a model multiple times on different subsets of data giving a more reliable estimate of generalization performance especially for small datasets. The most common form is k-fold cross-validation.

Deep Dive: In k-fold cross-validation the dataset is split into k equal parts (folds). The model is trained k times each time using k-1 folds for training and 1 fold for validation. The final performance metric is the average across all k evaluations and you also get a standard deviation showing how stable the model is. Common choices: k=5 (20% validation each time) or k=10 (10% validation). Benefits over single split: uses all data for both training and validation (important for small datasets) provides confidence intervals on performance (single split gives one number — is it lucky or representative?) and reveals if the model is sensitive to which data is in training vs validation (high variance = potential overfitting). Stratified k-fold maintains class proportions in each fold — essential for imbalanced classification.

Real-World: A medical ML model for rare disease diagnosis had only 800 labeled examples. A single 80/20 split would train on 640 examples and validate on 160 — too few for either. 10-fold cross-validation trained 10 models each on 720 examples and validated on 80 giving a reliable performance estimate with confidence intervals and using all data for both training and evaluation.

⚠ Common Mistakes: Using k-fold cross-validation for hyperparameter tuning and reporting those scores as test performance (data leakage — use nested cross-validation instead). Not using stratified folds for imbalanced classification. Ignoring the standard deviation across folds — high variance means the model is sensitive to data splits which is itself a problem. Applying cross-validation to time-series data without using TimeSeriesSplit.

🏭 Production Scenario: A production model selection process used 5-fold cross-validation to compare 20 candidate models. The winning model had a mean AUC of 0.87 with standard deviation 0.02 — indicating stable performance across folds. The runner-up had mean AUC 0.86 with standard deviation 0.09 — highly variable and less trustworthy. The stable model was selected and performed as expected in production.

Follow-up questions: What is nested cross-validation and when do you need it? What is TimeSeriesSplit and why can't you use standard k-fold for time-series? What is sklearn Pipeline and why does it matter for cross-validation?

// ID: ML-BEG-006  ·  DIFFICULTY: 4/10  ·  ★★★★☆☆☆☆☆☆

Showing 9 of 19 questions

Section VI · Error & Debug Archive

DEBUG_ARCHIVE: LIVE // REAL_ERRORS · ANNOTATED_FIXES

Real Errors. Root-Cause Fixes.

All 1,200 Solutions →
PHP ERROR E_FATAL · #DB-001
Undefined variable: $conn — PDO connection not persisted across scope
Fatal error: Uncaught Error: Call to a member function query() on null

Connection object passed by value. Fix: pass by reference or use dependency injection through constructor.

4,200 views Read Fix →
JAVASCRIPT RUNTIME · #JS-044
Cannot read properties of undefined — React state not yet populated on first render
TypeError: Cannot read properties of undefined (reading 'map')

State initialized as undefined, not empty array. Fix: initialize with useState([]) and guard with optional chaining.

7,800 views Read Fix →
SQL ERROR CONSTRAINT · #SQL-019
Foreign key constraint fails on INSERT — parent row not found in referenced table
ERROR 1452: Cannot add or update a child row: a foreign key constraint fails

Insertion order violation. Fix: insert parent record first, or disable FK checks during bulk migration with SET FOREIGN_KEY_CHECKS=0.

3,100 views Read Fix →
PYTHON IMPORT · #PY-007
ModuleNotFoundError in virtual environment — pip installed globally but not inside venv
ModuleNotFoundError: No module named 'requests'

Package installed to system Python, not active venv. Fix: activate venv first, then pip install. Verify with which python.

5,400 views Read Fix →
VB.NET RUNTIME · #VB-031
NullReferenceException on DataGridView load — DataSource bound before data fetched
System.NullReferenceException: Object reference not set to an instance

Binding fires before async fetch completes. Fix: await the data load, then set DataSource. Use BindingSource for dynamic updates.

2,700 views Read Fix →
WORDPRESS PLUGIN · #WP-012
White Screen of Death after plugin activation — memory limit exhausted on init hook
Fatal error: Allowed memory size of 67108864 bytes exhausted

Plugin loading heavy library on every request. Fix: lazy-load on relevant admin pages only. Increase WP_MEMORY_LIMIT in wp-config as temporary measure.

6,200 views Read Fix →
Section VII · Code Archive

Copy. Adapt. Ship.

All 800 Snippets →
PHP · PATTERN
Singleton Database Connection

Thread-safe PDO connection with single instance guarantee. Works with MySQL, PostgreSQL, SQLite.

private static ?self $instance = null;
12 uses this week View →
PYTHON · UTILITY
Rate-Limited API Client

Async HTTP client with automatic retry, exponential backoff, and per-domain rate limiting.

async def fetch_with_retry(url, max=3):
28 uses this week View →
SQL · QUERY
Recursive CTE Hierarchy

Self-referencing table traversal for category trees, org charts, and menu structures using Common Table Expressions.

WITH RECURSIVE tree AS (SELECT ...)
19 uses this week View →
JAVASCRIPT · HOOK
Custom useDebounce Hook

React hook for debouncing search inputs, form fields, and resize events. Prevents excessive API calls.

const useDebounce = (value, delay) => {
41 uses this week View →
Section VIII · Structured Learning

LEARNING_PATHS: READY // 4_TRACKS · STRUCTURED · MENTOR_GUIDED

Learning Paths

All 24 Paths →

PHP Developer: Zero to Production

Beginner

From syntax fundamentals to building RESTful APIs and WordPress plugins. Designed for complete beginners with no prior programming background.

PHP Syntax & Data Types
OOP: Classes, Interfaces, Traits
Database: PDO & MySQL
REST API Design
WordPress Plugin Development
18 modules · ~40 hrs Start Path →

Full-Stack JavaScript: React + Node

Mid-Level

Modern full-stack development with React, Node.js, Express, and PostgreSQL. Includes deployment, auth, and real project builds.

Modern ES2024 JavaScript
React: State, Hooks, Context
Node.js & Express APIs
Auth: JWT & OAuth 2.0
CI/CD & Deployment
22 modules · ~60 hrs Start Path →

Software Architecture Mastery

Advanced

Design patterns, SOLID principles, microservices, event-driven architecture, and real-world system design interview preparation.

Design Patterns: GoF 23
Domain-Driven Design
Microservices & Event Bus
Scalability Patterns
System Design Interviews
16 modules · ~35 hrs Start Path →

AI Integration for Developers

Mid-Level

Practical AI integration using Claude API, OpenAI, and MCP. Build real AI-powered applications, tools, and automation workflows.

LLM Fundamentals & Prompting
Claude API & OpenAI SDK
Model Context Protocol (MCP)
RAG Systems & Embeddings
Deploying AI-Powered Apps
14 modules · ~28 hrs Start Path →

"The best engineering knowledge is not found in textbooks — it is extracted from late nights, broken builds, angry clients, and the stubborn refusal to stop until the problem is solved."

— Debasis Bhattacharjee · Software Architect · 20 Years in Production

Section X · The Ecosystem Grows

ARCHIVE_GROWING // CONTRIBUTIONS_OPEN · LIVING_DOCUMENT

This Is a Living Archive. Not a Static Library.

Every week, new errors are documented, new interview patterns are added, and new solutions are tested in production. The knowledge hub grows because real problems keep appearing — and every answer earns its place here by actually working.

If you found a fix that saved your project, or spotted an answer that could be better — the door is always open. This ecosystem belongs to everyone who uses it.

Submit via Email
Send your question, error, or solution directly
Submit →
Leave a Testimonial
Did something here help you? Share your experience
Share →
Comment on Facebook
Find us at @iamdebasisbhattacharjee
Visit →
Get Update Alerts
Subscribe to be notified of new additions
Subscribe →
Section XI · Let's Talk

Knowledge is Free.
Mentorship is Personal.

The hub is open to everyone — but if you need structured guidance, 1-on-1 mentorship, or corporate training, that's a different conversation. Let's have it.

hello@debasisbhattacharjee.com  ·  +91 8777088548  ·  Mon–Fri, 9AM–6PM IST