Skip to content

Tech Mahindra .NET Full Stack Interview Questions & Answers

Curated interview practice questions with answers. These are practice scenarios, not a verified list of past interview questions.

About Tech Mahindra hiring for .NET Full Stack roles

Tech Mahindra is an Indian IT services and consulting company and part of the Mahindra Group. It is known for its strong telecom and communications practice and also serves banking, manufacturing and healthcare clients. In India it hires for software engineers, test engineers, network engineers, data analysts and data engineers.

For .NET Full Stack roles, this Tech Mahindra practice set focuses most on Async Programming and Multithreading (5), C# Fundamentals (5), OOP in C# (4), Entity Framework Core (4). It has 14 easy, 15 medium, 1 hard questions, so you can start easy and work up to the harder ones.

Company type
IT services
Headquarters
Pune, India
Main India offices
Pune, Hyderabad, Bengaluru, Noida, Chennai

Tech Mahindra .NET Full Stack interview process

  1. Online assessment (aptitude + English essay)
  2. Coding test
  3. Technical interview
  4. HR round

Typical pattern based on public candidate experiences. Rounds vary by role, team and year.

Solved for Tech MahindraStart 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

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>; }
02

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.
03

You need to add a new method to a widely implemented interface without breaking existing classes. How can you do it?

Save to ▾
Show answer
Since C# 8, an interface can provide a method body. Classes implementing the interface get that behaviour without writing it, though they can override it. The main use is evolving a published interface: you can add a new member without breaking every existing implementation. The default method is only callable through the interface type, not the class, and overusing it blurs the line with abstract classes.
04

What are DbContext and DbSet, and what lifetime should DbContext have?

Save to ▾
Show answer
DbContext represents a session with the database: it holds configuration, the change tracker and connection handling. Each DbSet<T> property represents a table you can query and add to. DbContext is lightweight and not thread-safe, so it should be short-lived; in ASP.NET Core it is registered as scoped, one per request, via AddDbContext. For background services or Blazor, use IDbContextFactory to create contexts on demand.
05

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.
06

How do you handle requirements that keep changing during a sprint?

Save to ▾
Show answer
In one sprint (Situation) the product owner changed a checkout screen twice. My task was to deliver without losing quality. I asked for a quick meeting to understand the reason, split the work into a stable API part and a flexible UI part, and agreed with the team which change would move to the next sprint. Result: we shipped the core flow on time, and the team started confirming acceptance criteria before sprint planning.
07

Write an extension method that checks whether a string is a valid Indian mobile number.

Save to ▾
Show answer
public static class StringExtensions { public static bool IsIndianMobile(this string? value) => value is not null && System.Text.RegularExpressions.Regex.IsMatch(value, @"^[6-9]\d{9}$"); } // usage bool ok = "9876543210".IsIndianMobile(); Extension methods are static methods in a static class whose first parameter uses this, so they appear like instance methods.
08

Explain the ref, out and in parameter modifiers.

Save to ▾
Show answer
ref passes a variable by reference; it must be initialised before the call and the method can read and change it. out also passes by reference but need not be initialised, and the method must assign it before returning, as in int.TryParse. in passes by reference as read-only, which avoids copying large structs while preventing changes. Overusing ref and out makes code harder to read, so tuples are often cleaner.
09

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.
10

When should you use StringBuilder instead of string?

Save to ▾
Show answer
Strings in C# are immutable, so every concatenation creates a new string object and copies the old content. In a loop that appends thousands of times, this creates heavy allocations. StringBuilder keeps a resizable internal buffer and appends in place, so it is much faster for repeated changes. For two or three concatenations or interpolation in a single statement, a normal string is simpler and fine.
11

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.
12

What is the difference between method overloading and method overriding?

Save to ▾
Show answer
Overloading means several methods with the same name but different parameter lists in the same class, resolved at compile time, for example Add(int, int) and Add(double, double). Overriding means a derived class provides a new implementation of a virtual or abstract base method with the same signature, resolved at runtime based on the actual object type. Overloading is compile-time polymorphism; overriding is runtime polymorphism.
13

What is the difference between CPU-bound and I/O-bound work, and how do you handle each in .NET?

Save to ▾
Show answer
CPU-bound work keeps the processor busy, like encryption, image processing or heavy calculations; speed it up with parallelism using Parallel.For, PLINQ or Task.Run in desktop apps. I/O-bound work spends most time waiting on databases, files or networks; handle it with async/await so threads are released while waiting. Choosing wrongly wastes resources, such as using Parallel.ForEach for HTTP calls or Task.Run around database queries.
14

Explain value types and reference types in C#.

Save to ▾
Show answer
Value types such as int, double, bool, enums and structs hold their data directly, and assigning one copies the value. Reference types such as classes, arrays, strings and delegates hold a reference to an object on the managed heap, so assigning copies only the reference. Changing a copied struct does not affect the original, but changing an object through a copied reference changes what both variables see.
15

What is the difference between DELETE, TRUNCATE and DROP?

Save to ▾
Show answer
DELETE removes rows one by one, supports WHERE, fires triggers and is fully logged, so it is slower on big tables. TRUNCATE removes all rows by deallocating pages, is minimally logged, resets identity values and cannot have WHERE; it fails if foreign keys reference the table. DROP removes the whole table including structure, indexes and permissions. In SQL Server, both DELETE and TRUNCATE can be rolled back inside a transaction.
16

What are your strengths and weaknesses as a developer?

Save to ▾
Show answer
My strength is that I go deep when debugging; I like reading execution plans and logs until I find the real cause, which has helped my team fix slow queries. A weakness was that I spent too long polishing code before asking for feedback. I now open small draft pull requests early and ask for review, which has made me faster and helped me learn from seniors sooner.
17

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.
18

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.
19

Show bulk update and delete with ExecuteUpdate and ExecuteDelete.

Save to ▾
Show answer
// mark all unpaid invoices older than 30 days as overdue int updated = await db.Invoices .Where(i => !i.IsPaid && i.DueDate < DateTime.UtcNow.AddDays(-30)) .ExecuteUpdateAsync(s => s .SetProperty(i => i.Status, "Overdue") .SetProperty(i => i.UpdatedAt, DateTime.UtcNow)); // delete old logs int deleted = await db.AuditLogs .Where(l => l.CreatedAt < cutoff) .ExecuteDeleteAsync(); These run a single SQL UPDATE or DELETE without loading entities, available since EF Core 7. They bypass the change tracker.
20

Why should you avoid async void methods?

Save to ▾
Show answer
An async void method cannot be awaited, so the caller does not know when it finishes. Exceptions thrown inside it cannot be caught by the caller; they go to the synchronization context and can crash the process. It is also hard to unit test. Use async Task instead. The only accepted use of async void is for event handlers, such as button click handlers in desktop apps, where the signature is fixed.
21

How do you use CancellationToken in an ASP.NET Core API?

Save to ▾
Show answer
[HttpGet("report")] public async Task<IActionResult> Report(CancellationToken ct) { var rows = await _db.Sales .Where(s => s.Year == 2026) .ToListAsync(ct); await _http.PostAsJsonAsync("/audit", rows.Count, ct); return Ok(rows); } ASP.NET Core binds the token to HttpContext.RequestAborted, so if the user closes the browser the token is cancelled and EF Core and HttpClient stop work, saving database and CPU time.
22

How does Dictionary<TKey, TValue> work internally?

Save to ▾
Show answer
Dictionary is a hash table. It calls GetHashCode on the key to choose a bucket, then uses Equals to find the exact entry if several keys share a bucket. Lookups, inserts and deletes are O(1) on average. When it fills up, it resizes and rehashes. Keys must have stable hash codes, so never mutate a key object after inserting it, and override GetHashCode with Equals for custom key types.
23

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.
24

Configure a one-to-many relationship between Customer and Order using the Fluent API.

Save to ▾
Show answer
public class Customer { public int Id { get; set; } public List<Order> Orders { get; set; } = []; } public class Order { public int Id { get; set; } public int CustomerId { get; set; } public Customer Customer { get; set; } = null!; } protected override void OnModelCreating(ModelBuilder mb) { mb.Entity<Order>() .HasOne(o => o.Customer) .WithMany(c => c.Orders) .HasForeignKey(o => o.CustomerId) .OnDelete(DeleteBehavior.Restrict); mb.Entity<Order>().Property(o => o.Total).HasPrecision(18, 2); } Restrict prevents deleting a customer who still has orders.
25

What is the difference between WHERE and HAVING?

Save to ▾
Show answer
WHERE filters individual rows before grouping and cannot use aggregate functions. HAVING filters groups after GROUP BY and can use aggregates like COUNT or SUM. For example, WHERE City = 'Pune' keeps only Pune rows, then GROUP BY DepartmentId HAVING COUNT(*) > 10 keeps departments with more than 10 such employees. Put non-aggregate conditions in WHERE so fewer rows are grouped, which is faster.
26

What is the difference between concurrency and parallelism?

Save to ▾
Show answer
Concurrency means dealing with many tasks at once by interleaving them, for example a web server handling thousands of requests that mostly wait on I/O. Parallelism means doing many computations at the same instant on multiple cores, such as processing an image in four chunks. async/await gives concurrency; Parallel.For and PLINQ give parallelism. A program can be concurrent on a single core but parallel only with multiple cores.
27

A read-only product listing endpoint in EF Core uses a lot of memory and CPU. What simple change helps, and why?

Save to ▾
Show answer
By default, EF Core tracks every entity it loads so it can detect changes on SaveChanges, which costs memory and CPU. AsNoTracking tells EF Core not to track the results, making read-only queries faster and lighter. Use it for lists, reports and GET endpoints where you will not update the data. AsNoTrackingWithIdentityResolution avoids duplicate instances of the same entity in results while still skipping tracking.
28

What is the difference between an abstract class and an interface in C#?

Save to ▾
Show answer
An abstract class can have fields, constructors, implemented and abstract members, and a class can inherit only one. An interface defines a contract; a class can implement many. Since C# 8, interfaces can have default method implementations but still no instance fields. Use an abstract class for shared state and base behaviour among closely related types, and interfaces for capabilities like IComparable or for dependency injection.
29

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.
30

Write a query to find duplicate email addresses and delete the extra rows, keeping the lowest Id.

Save to ▾
Show answer
-- find duplicates SELECT Email, COUNT(*) AS Cnt FROM Users GROUP BY Email HAVING COUNT(*) > 1; -- delete duplicates, keep lowest Id WITH d AS ( SELECT Id, ROW_NUMBER() OVER (PARTITION BY Email ORDER BY Id) AS rn FROM Users ) DELETE FROM d WHERE rn > 1; After cleanup, add a unique index on Email to stop duplicates returning.

Tips to crack the Tech Mahindra .NET Full Stack interview

  • Read about telecom basics like 4G, 5G and network operations, since communications is Tech Mahindra's largest vertical.
  • Practise English essay and verbal ability sections, which often appear in Tech Mahindra online assessments.
  • Revise SQL and one programming language, and prepare a clear two-minute explanation of your project.
  • Keep a one-minute story ready for every project on your CV: problem, your part, tools, result.
  • Practise the hard questions on this page aloud; Tech Mahindra interviewers usually ask follow-ups on your first answer.

Frequently asked questions

How many rounds are there in the Tech Mahindra .NET Full Stack interview?

Candidates usually go through 4 stages: Online assessment (aptitude + English essay); Coding test; Technical interview; HR round. The exact rounds change with the role, team, location and your experience, so confirm the process with the recruiter.

Which topics should I prepare for the Tech Mahindra .NET Full Stack interview?

This practice set leans on Async Programming and Multithreading (5), C# Fundamentals (5), OOP in C# (4), Entity Framework Core (4). Revise those first, then practise explaining one or two of your own projects end to end, because most Tech Mahindra interviewers ask you to walk through real work.

Are these the exact questions asked at Tech Mahindra?

No. These are curated practice questions that match the skills and difficulty usually tested in it services interviews like Tech Mahindra's. They are not a leaked or verified list of past questions.

Where does Tech Mahindra hire .NET Full Stack professionals in India?

Tech Mahindra has large teams in Pune, Hyderabad, Bengaluru, Noida, Chennai. Openings and locations change often, so check the Tech Mahindra careers page and filter by city and experience.

.NET Full Stack questions for similar companies