Interview preparation

Interview Questions & Answers

Answers written to be said out loud in an interview — each with a common follow-up question and a link to the tutorial that explains it in depth.

Beginner
207
Intermediate
279
Experienced
167

Browse by technology

OOP Concepts

29 questions
01What is object-oriented programming?Beginner

A programming paradigm that organises code around objects — units that combine data (state) and behaviour (methods). Its four pillars are encapsulation, abstraction, inheritance and polymorphism.

Learn more: OOP Concepts — Introduction to OOP
02What is the difference between a class and an object?Beginner

A class is a blueprint that defines properties and methods. An object is a concrete instance created from that blueprint, with its own values for those properties.

Learn more: OOP Concepts — Classes and Objects
03Explain the four pillars of OOP.Beginner

Encapsulation hides internal state and controls access to it. Abstraction exposes what an object does while hiding how. Inheritance lets a class reuse and extend another class. Polymorphism lets different objects respond to the same call in their own way.

Learn more: OOP Concepts — Encapsulation
View all 29 OOP Concepts questions

HTML

29 questions
01What is semantic HTML and why does it matter?Beginner

Semantic HTML uses elements that describe their meaning — <header>, <nav>, <main>, <article>, <button> — rather than generic <div>s. It improves accessibility (screen readers expose landmarks and roles), SEO (search engines understand the main content) and maintainability.

Learn more: HTML — Semantic HTML
02What does <!DOCTYPE html> do?Beginner

It tells the browser to render the page in standards mode. Without it, browsers fall back to “quirks mode”, which emulates old, inconsistent behaviour.

Learn more: HTML — Introduction to HTML
03What is the difference between block and inline elements?Beginner

Block elements (div, p, h1) start on a new line and take the full available width. Inline elements (span, a, strong) flow within text and only take the width of their content. CSS display can change either.

Learn more: HTML — HTML Elements and Tags
View all 29 HTML questions

CSS

29 questions
01Explain the CSS box model and box-sizing.Beginner

Every element is a box of content, padding, border and margin. With the default content-box, width covers only the content; padding and border are added on top. With border-box, width includes padding and border, which makes sizing predictable.

Learn more: CSS — Box Model
02What are the different values of the position property?Beginner

static (default flow), relative (offset from its normal place), absolute (positioned relative to the nearest positioned ancestor), fixed (relative to the viewport) and sticky (behaves like relative until a scroll threshold, then sticks).

Learn more: CSS — Positioning
03What is the difference between em, rem and px?Beginner

px is a fixed unit. em is relative to the font size of the element (or parent for font-size), so it compounds when nested. rem is relative to the root font size, which makes it predictable and good for accessibility.

Learn more: CSS — Typography
View all 29 CSS questions

JavaScript

33 questions
01What are the differences between var, let and const?Beginner

var is function-scoped and hoisted with the value undefined. let and const are block-scoped and are in the temporal dead zone until declared. const cannot be reassigned, although objects it refers to can still be mutated.

Learn more: JavaScript — Variables: var, let, const
02What does typeof [] return and how do you check for an array?Beginner

"object", because arrays are objects. Use Array.isArray(value).

JavaScript Illustrative
typeof [];          // "object"
Array.isArray([]);  // true
Learn more: JavaScript — Data Types
03What is the difference between == and ===?Beginner

=== compares value and type without conversion. == converts types first, which leads to surprises like 0 == "" being true. Use === by default.

JavaScript Illustrative
0 == ''     // true
0 === ''    // false
null == undefined   // true
null === undefined  // false
Learn more: JavaScript — Operators
View all 33 JavaScript questions

jQuery

25 questions
01What is jQuery and why was it popular?Beginner

A JavaScript library that simplified DOM selection, events, animations and AJAX with a concise, chainable API and smoothed over browser inconsistencies at a time when browsers differed greatly.

Learn more: jQuery — Introduction to jQuery
02What does $(document).ready() do?Beginner

It runs a function once the DOM is fully parsed, so elements can be safely selected. The shorthand is $(function () { … }). It does not wait for images like window.onload does.

Learn more: jQuery — Introduction to jQuery
03What is the difference between .text(), .html() and .val()?Beginner

.text() gets or sets text content (safe against HTML injection). .html() gets or sets inner HTML (unsafe with untrusted input). .val() gets or sets the value of form fields.

Learn more: jQuery — DOM Manipulation
View all 25 jQuery questions
01What is ECMAScript and how does it relate to JavaScript?Beginner

ECMAScript is the language specification; JavaScript is the most widely used implementation. ES6 (ES2015) was a major update, and new editions now appear every year.

Learn more: ES6+ (Modern JavaScript) — Introduction to ECMAScript
02How do arrow functions differ from regular functions?Beginner

Arrow functions are shorter, do not have their own this, arguments or super, cannot be used with new, and implicitly return a single expression when written without braces.

Learn more: ES6+ (Modern JavaScript) — Arrow Functions
03Spread vs rest — what is the difference?Beginner

Both use …. Spread expands an iterable or object into individual elements ([...a, ...b], { ...obj }). Rest collects remaining elements into an array or object (function f(...args), const { id, ...rest } = obj).

Learn more: ES6+ (Modern JavaScript) — Spread Operator
View all 25 ES6+ (Modern JavaScript) questions

TypeScript

26 questions
01What is the difference between interface and type?Beginner

Both describe object shapes. Interfaces can be re-opened (declaration merging) and extended with extends. Type aliases can also name unions, tuples and mapped types. For object shapes, either works; teams usually pick one convention.

Learn more: TypeScript — Interfaces
02What is TypeScript and why use it?Beginner

A superset of JavaScript that adds static types. The compiler catches type errors before runtime, editors give better autocompletion and refactoring, and types document how code is meant to be used.

Learn more: TypeScript — Introduction to TypeScript
03any vs unknown vs never?Beginner

any disables type checking. unknown accepts any value but forces you to narrow it before use — the safe choice for untrusted data. never represents values that never occur, such as a function that always throws or an exhaustive switch default.

Learn more: TypeScript — Basic Types
View all 26 TypeScript questions

React

29 questions
01Why does calling setCount(count + 1) twice only add one?Beginner

Both calls read count from the same render, so both schedule the same value. Use the updater form setCount(c => c + 1) so each update receives the latest value.

Learn more: React — useState
02Why do list items need keys, and why not use the array index?Beginner

Keys let React match items between renders. If items are reordered, inserted or removed, index keys can attach state to the wrong item. Use a stable unique id.

Learn more: React — Lists and Keys
03What is JSX?Beginner

A syntax extension that lets you write HTML-like markup in JavaScript. A build tool compiles it into function calls that create React elements. Expressions go inside { }.

Learn more: React — JSX
View all 29 React questions

Angular

29 questions
01How does dependency injection work in Angular?Beginner

Services marked @Injectable({ providedIn: "root" }) are registered with the root injector. Components receive them through inject() or constructor parameters. Providers can also be scoped to routes or components.

Learn more: Angular — Dependency Injection
02What are components in Angular?Beginner

The building blocks of the UI: a TypeScript class decorated with @Component, plus a template and styles. Modern Angular uses standalone components that declare their own imports.

Learn more: Angular — Components
03Explain the four kinds of data binding.Beginner

Interpolation {{ value }} and property binding [prop]="value" flow from component to view. Event binding (event)="handler()" flows from view to component. Two-way binding [(ngModel)] combines both.

Learn more: Angular — Data Binding
View all 29 Angular questions

Node.js

29 questions
01What is middleware in Express?Beginner

A function (req, res, next) that runs during the request lifecycle. It can modify req/res, end the response, or call next() to pass control on. Error-handling middleware has four parameters (err, req, res, next).

Learn more: Node.js — Middleware
02What is Node.js?Beginner

A JavaScript runtime built on Chrome’s V8 engine that runs JavaScript outside the browser. It uses an event-driven, non-blocking I/O model, which suits APIs and real-time apps.

Learn more: Node.js — Introduction to Node.js
03What is the purpose of package.json and package-lock.json?Beginner

package.json describes the project, its scripts and dependency ranges. package-lock.json records the exact installed versions so every install is reproducible.

Learn more: Node.js — package.json
View all 29 Node.js questions

Node.js REST API

25 questions
01What is a REST API?Beginner

An API that exposes resources at URLs and uses HTTP methods (GET, POST, PUT, PATCH, DELETE) and status codes to operate on them, with stateless requests usually exchanging JSON.

Learn more: Node.js REST API — REST API Fundamentals
02PUT vs PATCH?Beginner

PUT replaces the entire resource with the request body and is idempotent. PATCH applies a partial update to some fields.

Learn more: Node.js REST API — GET, POST, PUT, PATCH, DELETE
03How do you design REST URLs?Beginner

Use nouns for resources and HTTP methods for actions: GET /api/products, POST /api/products, GET /api/products/42, PATCH /api/products/42, DELETE /api/products/42. Nest only for true ownership (/api/orders/7/items) and use plural, lowercase names.

Learn more: Node.js REST API — REST API Fundamentals
View all 25 Node.js REST API questions

C#

28 questions
01What is the difference between value types and reference types?Beginner

Value types (int, struct, record struct) hold their data directly and are copied on assignment. Reference types (class, string, arrays) hold a reference to an object on the heap; assignment copies the reference.

Learn more: C# — Variables and Data Types
02What is the difference between const and readonly?Beginner

const is a compile-time constant, implicitly static, and must be a primitive or string. readonly is set at runtime — in the declaration or constructor — and can hold any type.

Learn more: C# — Variables and Data Types
03What are nullable reference types?Beginner

A C# 8+ feature where reference types are non-nullable by default and string? marks values that may be null. The compiler warns when you might dereference null.

Learn more: C# — Nullable Types
View all 28 C# questions

ASP.NET MVC

27 questions
01ViewBag vs ViewData vs TempData?Beginner

ViewData is a string-keyed dictionary; ViewBag is a dynamic wrapper over it. Both last for one request. TempData persists across a redirect until it is read, which suits flash messages.

Learn more: ASP.NET MVC — ViewBag, ViewData, and TempData
02Explain the MVC pattern.Beginner

Model holds data and business logic, View renders the UI, and Controller handles requests, works with models and selects a view. It separates concerns so each part can change and be tested independently.

Learn more: ASP.NET MVC — MVC Architecture
03How does routing work in ASP.NET MVC 5?Beginner

Routes registered in RouteConfig (or with [Route] attributes after MapMvcAttributeRoutes) map URL patterns like {controller}/{action}/{id} to controller actions.

Learn more: ASP.NET MVC — Routing
View all 27 ASP.NET MVC questions

ASP.NET Core MVC

27 questions
01What is Program.cs responsible for in ASP.NET Core?Beginner

It creates the WebApplication builder, registers services in the DI container, builds the app, configures the middleware pipeline and maps endpoints, then calls app.Run().

Learn more: ASP.NET Core MVC — Program.cs
02What is the difference between IActionResult types like View, Json, Redirect and NotFound?Beginner

They are action results that tell ASP.NET Core how to respond: View renders Razor, Json serialises data, RedirectToAction issues a 302, NotFound returns 404 and Ok returns 200 with a body.

Learn more: ASP.NET Core MVC — Action Results
03What is ASP.NET Core MVC?Beginner

A cross-platform framework for server-rendered web apps on modern .NET. Controllers handle requests, models carry data and Razor views render HTML. It runs on Kestrel, has DI, configuration and logging built in and deploys to Windows, Linux or containers.

Learn more: ASP.NET Core MVC — Introduction to ASP.NET Core MVC
View all 27 ASP.NET Core MVC questions
01What is ASP.NET Web API 2?Beginner

A framework on .NET Framework for building HTTP services. Controllers derive from ApiController, routing is configured in WebApiConfig, and it is typically hosted on IIS.

Learn more: ASP.NET Web API (.NET Framework) — Introduction to Web APIs
02What is IHttpActionResult?Beginner

An interface returned from actions that represents an HTTP response, with helpers such as Ok(), NotFound(), BadRequest() and Created(). It makes actions easier to unit test than returning HttpResponseMessage directly.

Learn more: ASP.NET Web API (.NET Framework) — Controllers and Endpoints
03What is a Web API, and how is it different from an MVC site?Beginner

A Web API returns data (JSON or XML) for other programs — SPAs, mobile apps, other services — instead of HTML pages. In Web API 2 controllers inherit ApiController and actions are selected by HTTP method.

Learn more: ASP.NET Web API (.NET Framework) — Introduction to Web APIs
View all 23 ASP.NET Web API (.NET Framework) questions

ASP.NET Core Web API

27 questions
01Why use DTOs instead of returning EF entities?Beginner

DTOs define a stable API contract, prevent over-posting (clients setting fields like IsAdmin), avoid leaking internal data, and avoid serialisation problems with navigation properties.

Learn more: ASP.NET Core Web API — CRUD API
02Which status codes should CRUD endpoints return?Beginner

GET 200 (404 if missing), POST 201 with a Location header, PUT/PATCH 204 or 200, DELETE 204, invalid input 400, unauthenticated 401, forbidden 403, conflicts 409.

Learn more: ASP.NET Core Web API — HTTP Status Codes
03What does the [ApiController] attribute do?Beginner

Enables API behaviours: automatic 400 responses for invalid models, binding-source inference ([FromBody] for complex types), attribute routing requirement and ProblemDetails error responses.

Learn more: ASP.NET Core Web API — Controllers and Endpoints
View all 27 ASP.NET Core Web API questions

Blazor

25 questions
01What is Blazor?Beginner

A .NET framework for building interactive web UI with C# and Razor components instead of JavaScript. Components can render on the server or run in the browser via WebAssembly.

Learn more: Blazor — Introduction to Blazor
02How do component parameters work?Beginner

Public properties marked [Parameter] receive values from the parent component. [EditorRequired] warns when a required parameter is missing, and EventCallback parameters let children notify parents.

Learn more: Blazor — Component Parameters
03What is a Razor component?Beginner

A .razor file that combines HTML markup with C# in an @code block. It renders UI, handles events and can be reused with parameters, like <ProductCard Product="p" />. Components can be pages (with @page) or building blocks.

Learn more: Blazor — Razor Components
View all 25 Blazor questions

SQL Server

28 questions
01What is the difference between INNER JOIN and LEFT JOIN?Beginner

INNER JOIN returns only rows with matches in both tables. LEFT JOIN returns all rows from the left table, with NULLs for unmatched right-hand columns.

Learn more: SQL Server — Joins
02WHERE vs HAVING?Beginner

WHERE filters rows before grouping; HAVING filters groups after GROUP BY and can use aggregate functions.

SQL Illustrative
SELECT Department, COUNT(*) AS Staff
FROM Employees
WHERE IsActive = 1
GROUP BY Department
HAVING COUNT(*) > 5;
Learn more: SQL Server — HAVING
03DELETE vs TRUNCATE vs DROP?Beginner

DELETE removes rows (optionally filtered), is fully logged and fires triggers. TRUNCATE removes all rows quickly, resets identity and cannot use WHERE. DROP removes the table itself.

Learn more: SQL Server — DELETE
View all 28 SQL Server questions

ADO.NET

16 questions
01What is ADO.NET?Beginner

The data access technology built into .NET. Providers such as Microsoft.Data.SqlClient supply connections, commands, data readers and adapters, so C# code can run SQL and stored procedures and read the results. EF Core and Dapper are built on top of it.

Learn more: ADO.NET — Introduction to ADO.NET
02What is the difference between the connected and disconnected models?Beginner

Connected: open a SqlConnection, run a SqlCommand and stream rows with a SqlDataReader while the connection stays open. Disconnected: a SqlDataAdapter fills a DataSet/DataTable, closes the connection, and you work with the in-memory copy, later pushing changes back with Update.

Learn more: ADO.NET — ADO.NET Architecture
03What do ExecuteNonQuery, ExecuteScalar and ExecuteReader return?Beginner

ExecuteNonQuery returns the number of rows affected (for INSERT/UPDATE/DELETE). ExecuteScalar returns the first column of the first row (or null if there are no rows). ExecuteReader returns a SqlDataReader for streaming result rows.

Learn more: ADO.NET — SqlCommand
View all 16 ADO.NET questions

Microsoft Azure

27 questions
01What is an App Service plan?Beginner

The compute that runs App Service apps: region, OS, pricing tier, instance size and count. Several apps can share one plan and its cost.

Learn more: Microsoft Azure — Azure App Service
02IaaS vs PaaS vs SaaS?Beginner

IaaS gives you virtual machines and networks to manage (Azure VMs). PaaS manages the platform so you deploy code (App Service, Azure SQL). SaaS is a finished application (Microsoft 365).

Learn more: Microsoft Azure — Introduction to Cloud Computing
03What is a resource group?Beginner

A logical container for related Azure resources that share a lifecycle. You can deploy, secure (RBAC), tag and delete them together.

Learn more: Microsoft Azure — Subscriptions and Resource Groups
View all 27 Microsoft Azure questions

AWS

27 questions
01What is the principle of least privilege in IAM?Beginner

Grant identities only the permissions they need for their task, nothing more. Prefer roles with temporary credentials over long-lived access keys, and avoid using the root user.

Learn more: AWS — IAM
02What is EC2?Beginner

Elastic Compute Cloud provides resizable virtual servers. You choose an instance type, AMI, storage and security groups, and pay for the time instances run.

Learn more: AWS — EC2
03What is S3?Beginner

Simple Storage Service is object storage for files of any size, organised in buckets, with very high durability, versioning, lifecycle rules and multiple storage classes.

Learn more: AWS — S3
View all 27 AWS questions

DevOps

28 questions
01Image vs container?Beginner

An image is a read-only template with the OS layer, runtime, code and dependencies. A container is a running instance of an image with its own writable layer.

Learn more: DevOps — Docker
02What is DevOps?Beginner

A set of practices and culture that brings development and operations together to deliver software faster and more reliably through automation, continuous integration and delivery, monitoring and shared ownership.

Learn more: DevOps — Introduction to DevOps
03Continuous integration vs continuous delivery vs continuous deployment?Beginner

CI merges and tests code frequently and automatically. Continuous delivery keeps every build releasable, with a manual approval to production. Continuous deployment releases every passing change automatically.

Learn more: DevOps — CI/CD Fundamentals
View all 28 DevOps questions

Manual Testing

12 questions
01What is software testing and why is it needed?Beginner

Software testing is evaluating a product to find defects and check it meets requirements and user needs. It reduces the risk of failures in production, protects users and reputation, and gives the team confidence to release.

Learn more: Manual Testing — Introduction to Software Testing
02What is the difference between verification and validation?Beginner

Verification asks “are we building the product right?” — reviews of requirements, designs and code against specifications. Validation asks “are we building the right product?” — executing the software to check it meets user needs.

Learn more: Manual Testing — Verification and Validation
03What are the phases of the STLC?Beginner

Requirement analysis, test planning, test case design, test environment setup, test execution, and test closure. Each phase has entry and exit criteria and produces deliverables such as the test plan, test cases and the closure report.

Learn more: Manual Testing — SDLC and STLC
View all 12 Manual Testing questions

Automation Testing

10 questions
01What should and should not be automated?Beginner

Automate stable, repetitive, high-value checks: regression suites, smoke tests, data-driven cases and API tests. Do not automate one-off tests, rapidly changing UI, exploratory or usability testing, or anything cheaper to check by hand.

Learn more: Automation Testing — What to Automate
02What is the test automation pyramid?Beginner

Many fast unit tests at the base, fewer integration/API tests in the middle and a small number of end-to-end UI tests at the top. Lower tests are faster, cheaper and more stable.

Learn more: Automation Testing — Test Automation Pyramid
03Which Selenium locators do you prefer and why?Beginner

Stable, unique attributes first: id, name or a dedicated data-testid via CSS selectors. Avoid absolute XPath and positional selectors that break with small layout changes.

Learn more: Automation Testing — Locators
View all 10 Automation Testing questions

SEO

10 questions
01What is SEO and what are its main areas?Beginner

Search engine optimization improves a site’s visibility in organic search results. Main areas: technical SEO (crawling, indexing, speed), on-page SEO (content, titles, headings, links) and off-page SEO (links and mentions from other sites), plus local SEO for physical businesses.

Learn more: SEO — Introduction to SEO
02How do search engines work?Beginner

They crawl the web by following links and sitemaps, render and analyse pages, index the content, and rank indexed pages for each query using many signals such as relevance, quality, links and page experience.

Learn more: SEO — How Search Engines Work
03What is search intent?Beginner

The goal behind a query: informational (learn), navigational (find a site), commercial (compare) or transactional (buy). Pages rank best when their format and content match the dominant intent.

Learn more: SEO — Search Intent
View all 10 SEO questions
01What is IIS?Beginner

Internet Information Services is Microsoft’s web server for Windows. It receives HTTP(S) requests through the kernel driver HTTP.sys and serves static files or hands requests to applications such as ASP.NET Core (via the ASP.NET Core Module) or ASP.NET Framework running in worker processes.

Learn more: IIS (Internet Information Services) — Introduction to IIS
02What is an application pool?Beginner

An isolated container of one or more w3wp.exe worker processes with its own identity, .NET CLR setting, pipeline mode and recycling rules. Separate pools keep one crashing or slow app from affecting others.

Learn more: IIS (Internet Information Services) — Application Pools
03What is a site binding?Beginner

The combination of protocol, IP address, port and host name that IIS uses to decide which site receives a request — for example https, All Unassigned, 443, shop.example.com with SNI.

Learn more: IIS (Internet Information Services) — Websites and Bindings
View all 10 IIS (Internet Information Services) questions

Java

10 questions
01What are the JDK, JRE and JVM?Beginner

The JVM runs Java bytecode. The JRE is the JVM plus the standard libraries needed to run programs. The JDK is everything in the JRE plus development tools such as javac, jar and jshell. Developers install the JDK.

Learn more: Java — Introduction to Java
02What is the difference between == and equals()?Beginner

== compares primitive values, or object references (same object in memory). equals() compares object contents when the class overrides it, as String does. Always compare strings with equals().

Java Illustrative
String a = new String("java");
String b = new String("java");
System.out.println(a == b);      // false — different objects
System.out.println(a.equals(b)); // true  — same contents
Learn more: Java — Strings
03Why are Strings immutable in Java?Beginner

Immutability makes strings safe to share between threads, allows the string pool to reuse instances, and keeps hash codes stable for HashMap keys. Use StringBuilder when building text in loops.

Learn more: Java — Strings
View all 10 Java questions

Scala

10 questions
01What is the difference between val and var?Beginner

val declares an immutable reference that cannot be reassigned; var declares a mutable one. Idiomatic Scala prefers val and immutable collections.

Learn more: Scala — Values and Variables
02What is a case class?Beginner

A class for immutable data. The compiler generates a constructor without new, field accessors, equals/hashCode based on values, toString, copy and pattern-matching support.

Text Illustrative
case class User(name: String, age: Int)
val a = User("Asha", 25)
val b = a.copy(age = 26)   // User(Asha,26)
a == User("Asha", 25)      // true
Learn more: Scala — Case Classes
03What is Option?Beginner

A type that is either Some(value) or None, used instead of null to represent a value that may be missing. Use map, getOrElse, fold or pattern matching to handle both cases.

Learn more: Scala — Option and Either
View all 10 Scala questions