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 questions01What 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.
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.
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.
HTML
29 questions01What 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.
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.
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.
CSS
29 questions01Explain 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.
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).
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.
JavaScript
33 questions01What 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.
02What does typeof [] return and how do you check for an array?Beginner
"object", because arrays are objects. Use Array.isArray(value).
typeof []; // "object"
Array.isArray([]); // true
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.
0 == '' // true
0 === '' // false
null == undefined // true
null === undefined // false
jQuery
25 questions01What 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.
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.
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.
ES6+ (Modern JavaScript)
25 questions01What 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.
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.
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).
TypeScript
26 questions01What 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.
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.
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.
React
29 questions01Why 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.
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.
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 { }.
Angular
29 questions01How 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.
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.
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.
Node.js
29 questions01What 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).
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.
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.
Node.js REST API
25 questions01What 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.
02PUT vs PATCH?Beginner
PUT replaces the entire resource with the request body and is idempotent. PATCH applies a partial update to some fields.
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.
C#
28 questions01What 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.
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.
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.
ASP.NET MVC
27 questions01ViewBag 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.
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.
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.
ASP.NET Core MVC
27 questions01What 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().
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.
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.
ASP.NET Web API (.NET Framework)
23 questions01What 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.
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.
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.
ASP.NET Core Web API
27 questions01Why 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.
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.
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.
Blazor
25 questions01What 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.
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.
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.
SQL Server
28 questions01What 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.
02WHERE vs HAVING?Beginner
WHERE filters rows before grouping; HAVING filters groups after GROUP BY and can use aggregate functions.
SELECT Department, COUNT(*) AS Staff
FROM Employees
WHERE IsActive = 1
GROUP BY Department
HAVING COUNT(*) > 5;
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.
ADO.NET
16 questions01What 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.
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.
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.
Microsoft Azure
27 questions01What 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.
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).
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.
AWS
27 questions01What 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.
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.
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.
DevOps
28 questions01Image 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.
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.
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.
Manual Testing
12 questions01What 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.
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.
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.
Automation Testing
10 questions01What 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.
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.
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.
SEO
10 questions01What 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.
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.
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.
IIS (Internet Information Services)
10 questions01What 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.
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.
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.
Java
10 questions01What 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.
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().
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
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.
Scala
10 questions01What 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.
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.
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
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.