Skip to content

.NET Full Stack Online Assessment Questions & Answers

40 questions for the online assessment stage — 18 easy, 22 medium.

About the online assessment round

Most companies start with an online test: aptitude and reasoning, a few MCQs on core .NET Full Stack concepts, and one or two short hands-on tasks. It filters a large number of applicants, so speed and accuracy both count.

Tips for the online assessment round

  • Practise under a timer: about one minute per MCQ and 15-20 minutes per hands-on task.
  • Read every option before answering; tests often include two nearly correct choices.
  • Use a stable internet connection, keep your camera on and avoid switching tabs in proctored tests.
  • Attempt the questions you are sure about first, then return to the harder ones.
Solved — online assessmentStart practicing
3 QUESTIONS FREESign up to unlock the full question bank and track your progress.Unlock every question and answer, then continue practising company-wise and package-wise.
3 questions free Unlock the rest in seconds
01

What is the difference between == and Equals() in C#?

Save to ▾
Show answer
For reference types, == by default checks reference equality, meaning both variables point to the same object, while Equals can be overridden to compare content. String overrides both, so == compares text. For value types, Equals compares field values. Records generate value-based equality automatically. When you override Equals, also override GetHashCode so objects behave correctly in dictionaries and hash sets.
02

What are generic constraints? Give examples.

Save to ▾
Show answer
Constraints restrict which types can be used for a type parameter so the generic code can rely on certain members. Examples: where T : class (reference type), where T : struct, where T : new() (has a parameterless constructor), where T : BaseEntity (inherits a class), where T : IComparable<T>, and where T : notnull. A repository might use where T : class, IEntity so it can read the Id property safely.
03

Sort a list of students by marks descending, then by name ascending.

Save to ▾
Show answer
var ranked = students .OrderByDescending(s => s.Marks) .ThenBy(s => s.Name) .ToList(); // in-place alternative with a comparison students.Sort((a, b) => b.Marks != a.Marks ? b.Marks.CompareTo(a.Marks) : string.Compare(a.Name, b.Name, StringComparison.Ordinal)); OrderBy is stable and returns a new sequence; List.Sort sorts in place and is not stable.
04

What does the sealed keyword do?

Save to ▾
Show answer
A sealed class cannot be inherited, and a sealed override method cannot be overridden further in derived classes. Use it when a class is not designed for extension, such as a security-sensitive or immutable type; string is sealed for this reason. Sealing also lets the JIT devirtualise calls, giving small performance gains. Many teams seal classes by default and unseal only when inheritance is genuinely needed.
05

Write an Angular HTTP interceptor that adds a JWT to every API request.

Save to ▾
Show answer
import { HttpInterceptorFn } from '@angular/common/http'; import { inject } from '@angular/core'; export const authInterceptor: HttpInterceptorFn = (req, next) => { const token = inject(AuthService).token(); if (token) { req = req.clone({ setHeaders: { Authorization: `Bearer ${token}` } }); } return next(req); }; // app.config.ts provideHttpClient(withInterceptors([authInterceptor])); Requests are immutable, so clone() creates a modified copy. The ASP.NET Core JWT middleware then reads the header.
06

What are partial classes and partial methods?

Save to ▾
Show answer
A partial class splits one class definition across multiple files, and the compiler merges them. It is used heavily with generated code: designers, EF Core scaffolding and source generators write one part while you write the other, so regeneration does not erase your code. Partial methods declare a signature in one part and an optional implementation in another; since C# 9 they can have return types and access modifiers if implemented.
07

Explain the transient, scoped and singleton service lifetimes.

Save to ▾
Show answer
Transient services are created every time they are requested, suitable for lightweight stateless helpers. Scoped services are created once per HTTP request and shared within it; DbContext is registered as scoped. Singleton services are created once for the whole application lifetime, suitable for caches and configuration. Choose based on state: anything holding per-request data must not be singleton, and singletons must be thread-safe.
08

What do async and await do in C#?

Save to ▾
Show answer
async marks a method that can contain await, and the compiler turns it into a state machine. await pauses the method until a Task finishes without blocking the thread; the thread returns to the pool to do other work and the method resumes later, often on another thread. It is ideal for I/O such as database calls, HTTP requests and file reads. An async method returns Task, Task<T> or ValueTask.
09

Explain the access modifiers in C#, including protected internal and private protected.

OOP in C#Medium
Save to ▾
Show answer
public is accessible everywhere, private only inside the type, protected inside the type and derived types, and internal anywhere in the same assembly. protected internal means accessible from the same assembly or from derived types in any assembly. private protected is stricter: only derived types inside the same assembly. Class members default to private and top-level types default to internal. Use the narrowest modifier that works.
10

What is the difference between reactive forms and template-driven forms in Angular?

Save to ▾
Show answer
Template-driven forms are defined mainly in HTML with ngModel and directives; they are quick for simple forms but harder to test. Reactive forms are defined in TypeScript with FormGroup, FormControl and Validators, giving explicit, strongly typed models, easy dynamic fields, custom and async validators, and straightforward unit testing. For enterprise apps such as loan application or KYC forms, reactive forms are the usual choice.
11

Write a SQL Server query to find the second highest salary.

Save to ▾
Show answer
-- using DENSE_RANK (handles ties) SELECT Salary FROM ( SELECT Salary, DENSE_RANK() OVER (ORDER BY Salary DESC) AS rnk FROM Employees ) t WHERE rnk = 2; -- using OFFSET SELECT DISTINCT Salary FROM Employees ORDER BY Salary DESC OFFSET 1 ROW FETCH NEXT 1 ROW ONLY; Change 2 to N for the Nth highest salary.
12

Find the second highest salary from a list using LINQ.

Save to ▾
Show answer
int? second = employees .Select(e => e.Salary) .Distinct() .OrderByDescending(s => s) .Skip(1) .Cast<int?>() .FirstOrDefault(); Distinct handles ties, so if two people earn the top salary the next lower value is returned. Casting to int? makes the result null instead of 0 when fewer than two distinct salaries exist.
13

What are record types and when would you use them?

Save to ▾
Show answer
Records are reference types (or record struct for value types) designed for immutable data. The compiler generates value-based equality, a readable ToString, a deconstructor and support for with-expressions that create a modified copy. A positional record is one line: public record Order(int Id, decimal Total). They suit DTOs, API responses, events and value objects, but not EF Core entities that need change tracking by identity.
14

Show the newer LINQ methods Chunk, DistinctBy and MaxBy.

Save to ▾
Show answer
// split 1,000 ids into batches of 100 for bulk API calls foreach (int[] batch in ids.Chunk(100)) await SendBatchAsync(batch); // unique customers by email var unique = customers.DistinctBy(c => c.Email).ToList(); // highest-paid employee object, not just the salary Employee? top = employees.MaxBy(e => e.Salary); These were added in .NET 6 and remove the need for custom helpers or third-party libraries like MoreLINQ.
15

How do you run raw SQL safely in EF Core?

Save to ▾
Show answer
// entity query with parameters (interpolation becomes SqlParameter) var orders = await db.Orders .FromSql($"SELECT * FROM Orders WHERE City = {city}") .Where(o => o.Total > 1000) .ToListAsync(); // non-entity results var totals = await db.Database .SqlQuery<decimal>($"SELECT SUM(Total) AS Value FROM Orders") .ToListAsync(); // stored procedure await db.Database.ExecuteSqlAsync($"EXEC usp_CloseMonth {month}"); Never build SQL by string concatenation; FromSqlRaw with concatenated input invites SQL injection.
16

Explain First, FirstOrDefault, Single and SingleOrDefault.

Save to ▾
Show answer
First returns the first match and throws if none exists. FirstOrDefault returns the default value, null for classes, if none exists. Single expects exactly one match and throws if there are zero or more than one. SingleOrDefault returns default for zero but still throws for more than one. Use Single when duplicates would indicate a data bug, such as lookup by unique PAN number; otherwise FirstOrDefault is cheaper.
17

What is the difference between a shallow copy and a deep copy?

OOP in C#Medium
Save to ▾
Show answer
A shallow copy duplicates the object but its reference fields still point to the same child objects; MemberwiseClone and record with-expressions do this. A deep copy duplicates the whole object graph, so changes to the copy never affect the original. Deep copies are usually written by hand or by serialising and deserialising. ICloneable is avoided because it does not say which kind of copy it returns.
18

Show constructor chaining in C#.

Save to ▾
Show answer
public class Customer { public string Name { get; } public string City { get; } public Customer(string name) : this(name, "Unknown") { } public Customer(string name, string city) { Name = name; City = city; } } public class PremiumCustomer : Customer { public PremiumCustomer(string name) : base(name, "Delhi") { } } this() calls another constructor of the same class and base() calls the parent constructor, avoiding duplicated setup code.
19

What is the difference between controllers and Minimal APIs?

Save to ▾
Show answer
Controllers group actions into classes with attributes for routing, filters and model binding, which suits large APIs with many conventions. Minimal APIs map endpoints directly with app.MapGet and lambdas, with less ceremony and slightly better performance, ideal for microservices and small APIs. Since .NET 7 they support filters, route groups and OpenAPI, and .NET 10 adds built-in validation, so both are production-ready choices.
20

What is the difference between props and state in React?

Save to ▾
Show answer
Props are inputs passed from a parent component to a child, like function arguments, and the child must not modify them. State is data owned and managed inside a component with useState or useReducer, and changing it re-renders the component. For example, a ProductCard receives product details as props, while a Cart component keeps the quantity in state. Shared state is lifted up to a common parent or moved into a store.
21

Show how Task.WhenAll and Task.WhenAny are used.

Save to ▾
Show answer
// run three independent calls in parallel var userTask = userApi.GetAsync(id); var ordersTask = orderApi.GetAsync(id); var walletTask = walletApi.GetAsync(id); await Task.WhenAll(userTask, ordersTask, walletTask); var dashboard = new Dashboard(userTask.Result, ordersTask.Result, walletTask.Result); // timeout using WhenAny var work = SlowCallAsync(); if (await Task.WhenAny(work, Task.Delay(2000)) != work) throw new TimeoutException(); WhenAll completes when all finish; WhenAny returns the first task to finish.
22

What is the difference between a clustered and a non-clustered index?

Save to ▾
Show answer
A clustered index defines the physical order of the table's data, so the leaf level is the data itself, and a table can have only one. A non-clustered index is a separate structure with key values and a pointer back to the row, and a table can have many. Range queries on the clustered key are fast. Non-clustered indexes speed up searches on other columns but add cost to inserts and updates.
23

Explain normalisation and the first three normal forms.

Save to ▾
Show answer
Normalisation organises tables to reduce redundancy and update anomalies. 1NF: each column holds atomic values and there are no repeating groups. 2NF: in 1NF and every non-key column depends on the whole primary key, not part of a composite key. 3NF: in 2NF and non-key columns do not depend on other non-key columns, for example City should not be stored with an order if it depends on the customer. Reporting databases may denormalise for speed.
24

What is the difference between an RxJS Observable and a Promise?

Save to ▾
Show answer
A Promise represents a single future value, starts immediately and cannot be cancelled. An Observable can emit many values over time, is lazy until subscribed, and can be cancelled by unsubscribing. RxJS operators like map, debounceTime, switchMap and retry make it powerful for streams such as search boxes or WebSocket data. Angular's HttpClient returns Observables; use the async pipe or toSignal to avoid manual unsubscribe.
25

What are boxing and unboxing?

Save to ▾
Show answer
Boxing converts a value type to object or an interface type by wrapping it in a heap object, for example object o = 42. Unboxing extracts the value back with an explicit cast, such as int n = (int)o. Both cost allocations and CPU time, and repeated boxing in loops increases garbage collection pressure. Generic collections like List<int> avoid boxing, which is one reason ArrayList is no longer used.
26

What is LINQ and why is it useful?

Save to ▾
Show answer
LINQ, Language Integrated Query, lets you query collections, databases, XML and other sources with the same C# syntax using methods like Where, Select, OrderBy and GroupBy. Queries are type-checked at compile time and read close to the intent, for example orders.Where(o => o.Total > 500).OrderBy(o => o.Date). With EF Core, the same LINQ expression is translated into SQL, so you rarely write raw SQL strings.
27

What is the CLR and what does it do?

Save to ▾
Show answer
The Common Language Runtime is the execution engine of .NET. It loads compiled IL code, converts it to machine code with the JIT compiler, manages memory through the garbage collector, enforces type safety, handles exceptions and manages threads. Because every .NET language compiles to the same IL, C#, F# and VB.NET code can run on the same CLR and call each other.
28

What are components and standalone components in Angular?

Save to ▾
Show answer
A component is a TypeScript class with the @Component decorator, a template and styles, representing one piece of UI such as a product card. Earlier, every component had to be declared in an NgModule. Standalone components import their own dependencies directly through the imports array and need no module; since Angular 19 they are the default. This simplifies apps, enables easier lazy loading and is the recommended approach in 2026.
29

Show encapsulation using properties, including init-only and validation.

Save to ▾
Show answer
public class BankAccount { public string AccountNo { get; init; } = ""; public decimal Balance { get; private set; } public void Deposit(decimal amount) { if (amount <= 0) throw new ArgumentOutOfRangeException(nameof(amount)); Balance += amount; } } var acc = new BankAccount { AccountNo = "SB1001" }; Balance can only change through Deposit, and AccountNo can be set only during object creation.
30

What is the difference between const, readonly and static readonly?

Save to ▾
Show answer
const is a compile-time constant, implicitly static, and its value is copied into calling assemblies, so changing it requires recompiling them. readonly fields are set at declaration or in the constructor and can differ per instance. static readonly is set once per type at runtime, so it can hold values like DateTime.Now or a new object. Use const only for values that will never change, such as Math.PI.
31

How do model binding and validation work in ASP.NET Core Web API?

Save to ▾
Show answer
Model binding maps request data into action parameters from the route, query string, headers or body, using [FromRoute], [FromQuery] and [FromBody]. Validation uses data annotations like [Required], [StringLength] and [Range] on DTOs. With [ApiController], invalid models automatically return 400 Bad Request with ProblemDetails listing the errors, so you do not need to check ModelState manually. FluentValidation is popular for complex rules.
32

How does EF Core handle many-to-many relationships?

Save to ▾
Show answer
Since EF Core 5, you can define collection navigations on both sides, such as Student.Courses and Course.Students, and EF Core creates a hidden join table automatically. If the join needs extra data, like EnrolledOn or Grade, create an explicit join entity Enrollment with two foreign keys and configure it with UsingEntity or two one-to-many relationships. Querying works naturally with Include or projections through the navigations.
33

Your code builds a LINQ query over a database, then calls Count() and later loops over it, and the logs show two SQL queries. Why, and how do you fix it?

Save to ▾
Show answer
This is multiple enumeration caused by deferred execution. The variable holds a query, not data, so Count runs one SQL statement and the foreach runs another. Besides extra load, the two results may differ if data changes in between. Materialise once with var list = await query.ToListAsync(), then use list.Count and loop over the list. Code analysers flag possible multiple enumeration of IEnumerable as a warning.
34

Fetch products from an ASP.NET Core API in React with loading and error states.

Save to ▾
Show answer
function Products() { const [items, setItems] = useState([]); const [loading, setLoading] = useState(true); const [error, setError] = useState(null); useEffect(() => { const ctrl = new AbortController(); fetch('/api/products', { signal: ctrl.signal }) .then(r => { if (!r.ok) throw new Error(r.status); return r.json(); }) .then(setItems) .catch(e => { if (e.name !== 'AbortError') setError(e.message); }) .finally(() => setLoading(false)); return () => ctrl.abort(); }, []); if (loading) return <p>Loading...</p>; if (error) return <p>Error: {error}</p>; return <ul>{items.map(p => <li key={p.id}>{p.name}</li>)}</ul>; }
35

What is the difference between a Task and a Thread?

Save to ▾
Show answer
A Thread is an OS-level execution unit with its own stack, costly to create. A Task is a higher-level promise of work that may or may not use a thread; I/O tasks often use no thread while waiting, and CPU tasks run on pooled threads. Tasks support return values, continuations, cancellation, exceptions and composition with WhenAll. In modern .NET you almost always use Tasks rather than creating threads manually.
36

What are nullable value types and nullable reference types?

Save to ▾
Show answer
Nullable value types like int? wrap a struct so it can hold null, with HasValue and Value properties. Nullable reference types, enabled by <Nullable>enable</Nullable>, are a compile-time feature: string means non-null and string? means may be null, and the compiler warns when you dereference a possible null. They do not change runtime behaviour but catch many NullReferenceException bugs before deployment.
37

A report builder concatenates 50,000 rows into one string with += and takes several seconds. What do you change?

Save to ▾
Show answer
Each += creates a new string and copies everything built so far, so the cost grows quadratically. Replace it with a StringBuilder, ideally created with an estimated capacity, and call Append or AppendLine in the loop, then ToString once at the end. For very large output, write directly to a StreamWriter or the response stream instead of building the whole string in memory.
38

What is deferred execution in LINQ?

Save to ▾
Show answer
Most LINQ operators such as Where and Select do not run when you write them; they build a query that executes only when you enumerate it with foreach, ToList, Count or First. This means the query sees the latest data at enumeration time and can be composed step by step. The catch is that enumerating the same query twice runs it twice, which can mean two database calls. Call ToList to materialise once.
39

Show how to stream data with IAsyncEnumerable.

Save to ▾
Show answer
public async IAsyncEnumerable<Order> GetOrdersAsync( [EnumeratorCancellation] CancellationToken ct = default) { await foreach (var o in _db.Orders.AsNoTracking().AsAsyncEnumerable().WithCancellation(ct)) yield return o; } // consumer await foreach (var order in service.GetOrdersAsync()) Console.WriteLine(order.Id); Items are produced and consumed one at a time asynchronously. ASP.NET Core can stream an IAsyncEnumerable result as JSON without buffering the whole list.
40

What are generics and what benefits do they give?

Save to ▾
Show answer
Generics let you write classes and methods with a type parameter, such as List<T> or Repository<T>, that work with any type while staying type-safe. Benefits are compile-time checking instead of casts, no boxing for value types, and code reuse. For example, one generic Result<T> type can wrap any API response. The CLR creates specialised code for value types and shares code for reference types.

Frequently asked questions

What happens in the .NET Full Stack online assessment round?

Most companies start with an online test: aptitude and reasoning, a few MCQs on core .NET Full Stack concepts, and one or two short hands-on tasks. It filters a large number of applicants, so speed and accuracy both count.

How do I clear the online assessment round?

Practise under a timer: about one minute per MCQ and 15-20 minutes per hands-on task. Read every option before answering; tests often include two nearly correct choices. Use a stable internet connection, keep your camera on and avoid switching tabs in proctored tests.

Which round comes next?

A typical order is online assessment, telephonic screening, one or two technical rounds, a managerial round and HR. Use the other round pages to practise each stage.