Log In

Don't have an account? Sign up now

Lost Password?

Sign Up

Prev Next

Tech Mahindra Interview Guide

Overview of Tech Mahindra Interview Process

  • The hiring process generally begins with a written/online assessment (aptitude + technical), then — for shortlisted candidates — proceeds through a technical test / coding test, followed by technical interview(s) and finally an HR / behavioral round.
  • For freshers, the first written round typically tests your logical reasoning, quantitative aptitude, English/grammar, and sometimes essay-writing.
  • After clearing the initial screening test, candidates are evaluated on core computer science fundamentals — DSA (data structures & algorithms), programming (C / C++ / Java / Python), DBMS, OS, basic CN/ networking, etc.
  • Finally, there is a technical interview, where your theoretical knowledge and practical skills (coding, problem-solving, understanding of CS fundamentals) are tested.
  • Then comes the HR interview / behavioral round — to assess your communication, attitude, motivation, flexibility (e.g. relocation willingness), and cultural fit.

If you have work experience, the process may slightly differ (or have extra emphasis on your project history, job-related skills, domain expertise) — but generally follows the pattern: written/technical test → technical interview → HR interview.


What They Test in Technical Rounds

In the technical assessment + interview, expect questions covering:

  • Data Structures & Algorithms — arrays, linked lists, stacks/queues, trees/graphs, sorting/searching, complexity analysis, etc.
  • Programming Concepts — language-specific fundamentals (C/C++/Java/Python), pointers (if C/C++), OOPs, memory management, error handling, basic code-writing questions.
  • Database / SQL / DBMS basics — normalization, designing schemas, queries, understanding of relational DB concepts.
  • Operating System / Computer Fundamentals — process/thread concepts, memory management, OS basics (for relevant roles) may come up.
  • Problem-solving ability — coding problems (e.g. “print primes in a range”) or logic-based questions.
  • General programming tasks or small code snippets — to test clarity, correctness, understanding of programming constructs.

In interviews, you may also be asked to walk through your projects, explain design decisions, challenges faced, technologies used — especially if you have internship or prior experience.


What They Evaluate in HR / Soft-Skill Rounds

Beyond pure technical skills, Tech Mahindra evaluates:

  • Motivation, attitude, willingness to learn, adaptability (especially for relocations), and cultural fit with the company.
  • Teamwork, interpersonal skills, and pressure handling — since many roles involve collaboration, client communication, or working under deadlines.
  • Basic personal-fit questions: “Why Tech Mahindra?”, “Where do you see yourself in 5 years?”, “Are you willing to relocate?”, etc.

What You Should Do to Prepare

Given the process, here are smart prep tips:

  • Brush up fundamentals in data structures, algorithms, DBMS, OS, programming (in your primary language). Strong fundamentals make a big difference.
  • Practice coding problems, basic logical/quantitative aptitude, and also be ready for quick theory questions (esp. if you’re from non-CS background).
  • Revise your projects/internships thoroughly — be prepared to explain what you did, why, and what you learned.
  • Polish soft skills and communication — practice clear, concise explanations, and be ready for behavioral questions.
  • Be ready for relocation or varied assignments, especially if listed in the job posting — grows flexibility can help.

50 Hard Technical Interview Questions – Tech Mahindra

1. Difference between Process and Thread

A process is an independent execution unit with its own memory space, while a thread is a lightweight unit that exists inside a process and shares its resources. Context switching is heavier for processes and lighter for threads. Multithreading improves responsiveness but increases synchronization challenges. Understanding this is essential for OS-based system design.

2. What is Deadlock? Conditions and Prevention

Deadlock occurs when multiple processes wait for resources locked by each other. It happens when four conditions exist simultaneously — mutual exclusion, hold-and-wait, no pre-emption, and circular wait. Deadlock can be handled using avoidance, detection, recovery, or prevention strategies. Banker’s algorithm is one popular avoidance technique.

3. Explain Memory Management — Paging vs Segmentation

Paging splits memory into fixed-size blocks, while segmentation divides it into variable logical sizes. Paging avoids external fragmentation but suffers internal fragmentation. Segmentation mirrors logical program structure like code/data/stack. Combined paged segmentation is used in many OS.

4. What is a Race Condition?

When multiple threads access shared data simultaneously and the output depends on timing, a race condition occurs. It can cause unpredictable results or data corruption. Synchronization techniques like mutex locks or semaphores prevent it. Understanding race conditions is crucial for concurrency control.

5. Explain Polymorphism in OOP

Polymorphism enables a method to behave differently based on the object calling it. Compile-time polymorphism uses method overloading while runtime uses overriding via inheritance. It leads to extensible and maintainable designs. Virtual functions are key in C++ and dynamic dispatch in Java.

6. Shallow Copy vs Deep Copy

Shallow copy duplicates references to objects, not the actual objects. Deep copy creates an independent clone of all values and referenced objects. Shallow copying can cause unintended side effects when the original changes. Deep copy is expensive but safe.

7. Difference between Abstraction and Encapsulation

Abstraction hides complex implementation and exposes only essential features. Encapsulation wraps data and methods inside a single unit and restricts external access. Both improve security and maintainability, but serve different purposes. Abstraction focuses on “what” while encapsulation focuses on “how”.

8. What is Dynamic Binding?

Dynamic binding resolves function calls at runtime instead of compile-time. It enables runtime polymorphism where overridden methods are selected based on objects, not references. It is implemented using virtual tables (C++) and dynamic dispatch (Java). Helps build flexible system architectures.

9. ACID Properties in DBMS

ACID guarantees reliable transactions — Atomicity, Consistency, Isolation, and Durability. They ensure that even during crashes or power failures, database integrity remains preserved. Isolation controls concurrency using levels like Read Committed or Serializable. Durability ensures committed operations are not lost.

10. Normalization — Why and Levels

Normalization reduces redundancy and improves data integrity. 1NF removes repeating groups, 2NF removes partial dependency, and 3NF removes transitive dependency. BCNF adds further rules for functional dependencies. However, over-normalization might degrade performance for analytical queries.

11. What is a B-Tree? Why used in DBMS Indexing?

B-Trees maintain sorted data and allow logarithmic search, insertion, and deletion. Its multi-way branching keeps tree height small even for large datasets. Databases use B-Trees for indexing to minimize costly disk I/O. B+ Trees store data only in leaf nodes for faster scanning.

12. Difference between Primary Key and Unique Key

Primary key enforces uniqueness and disallows nulls, whereas a unique key also enforces uniqueness but allows a single null. A table has only one primary key but multiple unique constraints. Both improve query performance via indexing.

13. Explain Concurrency Control in DBMS

Concurrency control ensures simultaneous transactions don’t corrupt data. It uses locking (pessimistic), timestamp ordering (optimistic), and multiversion concurrency (MVCC). Deadlocks and starvation must be handled. Serializable isolation is safest but slowest.

14. What is a REST API?

REST uses HTTP methods to perform CRUD operations on resources. It follows statelessness and uniform interface principles. JSON is the commonly used data format. REST APIs are scalable, lightweight, and ideal for microservices.

15. What is Multithreading in Java?

Multithreading executes multiple threads concurrently to utilize CPU effectively. Critical sections require synchronization to avoid race conditions. Thread lifecycle includes new, runnable, blocked, and terminated states. Executors framework improves thread management.

16. Garbage Collection in Java — How it works?

Java automatically frees unused objects via garbage collectors such as Serial GC, Parallel GC, and G1. GC runs in young and old generational spaces. Stop-the-world pauses can affect latency. Memory leaks still occur when references are unintentionally retained.

17. What is Pointer Arithmetic in C/C++?

Pointers store memory addresses and can be incremented or decremented based on data type size. Misuse may cause segmentation faults or memory corruption. Pointer arithmetic is powerful but unsafe. Understanding it improves low-level programming skills.

18. STL vs Collections Framework

STL in C++ provides templates based on compile-time type checking while Java Collections use generics. STL offers algorithms and containers like vector, map, and list. Java Collections include ArrayList, HashMap, LinkedList, and more. STL is faster for competitive programming; Collections are deeply integrated with JVM.

19. Heap vs Stack Memory

Stack is used for local variables and function calls while heap is used for dynamically allocated memory. Stack is faster but limited in size; heap is large but slower. Heap memory requires manual free/delete in C++ and automatic GC in Java.

20. Difference between TCP and UDP

TCP is connection-oriented and reliable, ensuring delivery, ordering, and error recovery. UDP is connectionless, faster, and suitable for real-time apps like gaming and streaming. TCP requires handshaking (3-way handshake) while UDP does not.

21. What is Subnetting?

Subnetting divides a network into multiple segments to improve routing efficiency and security. It reduces broadcast domain size and optimizes IP address utilization. CIDR notation (e.g., /24) defines subnet mask size.

22. SSL/TLS Working

TLS encrypts communication using handshake, certificate validation, symmetric encryption, and hashing. It prevents MITM attacks and packet sniffing. HTTPS is HTTP + TLS. Ensuring up-to-date TLS versions is critical for security.

23. Explain Agile vs Waterfall

Waterfall is linear with fixed stages while Agile is iterative with continuous feedback. Agile adapts to changing requirements; Waterfall suits well-defined projects. Scrum is a widely used Agile framework. Tech Mahindra projects often follow Agile.

24. Microservices vs Monolithic Architecture

Monolith bundles all features into one deployable unit whereas microservices isolate features as independent services. Microservices offer scalability and fault isolation but add complexity in deployment and monitoring. APIs enable inter-service communication.

25. What is Load Balancing?

Load balancing distributes network or application traffic across multiple servers to prevent overload. It improves performance, availability, and fault tolerance. Algorithms include Round Robin, Least Connections, and IP Hash. Modern systems use hardware and software load balancers (e.g., Nginx, AWS ELB).

26. CAP Theorem in Distributed Systems

CAP states that a distributed system can guarantee only two out of three properties — Consistency, Availability, and Partition Tolerance. No system can achieve all three simultaneously during network failure. CP systems focus on consistency, while AP systems focus on availability. Databases like Cassandra (AP) and MongoDB (CP) follow it.

27. What is Containerization (Docker)?

Containerization packages applications with dependencies inside isolated units called containers. Unlike VMs, containers share the host OS, making them lightweight and fast. Docker allows consistent deployment across environments. Kubernetes manages container orchestration.

28. What is CI/CD Pipeline?

CI/CD automates code integration, testing, deployment, and monitoring. CI catches bugs early by integrating small code changes frequently. CD enables automated deployment to staging/production. It accelerates delivery and reduces manual errors.

29. Difference between Public, Private, and Hybrid Cloud

Public cloud is shared infrastructure managed by vendors like AWS and Azure. Private cloud is used by a single organization for enhanced security and control. Hybrid cloud combines both for cost efficiency and flexibility. Most enterprises adopt hybrid models.

30. What is the difference between Parallelism and Concurrency?

Concurrency deals with structuring programs to handle multiple tasks at once, not necessarily simultaneously. Parallelism executes tasks literally at the same time using multiple processors. A concurrent system can be parallel, but parallel systems are not always concurrent. Understanding both is key in multithreaded design.

31. What is Distributed Cache?

A distributed cache shares cached data across multiple servers to reduce database load and improve speed. It stores frequently accessed data in memory and syncs it among nodes. Redis, Memcached, and Hazelcast are popular. Cache invalidation strategies prevent stale data.

32. Explain HashMap Internal Working

HashMap stores key-value pairs using hashing and buckets. Hash collisions are managed using chaining (LinkedList) and tree-based structure (Red-Black Tree after JDK 8). Rehashing is triggered when load factor exceeds threshold. Poor hash functions degrade performance to O(n).

33. What is Dynamic Programming?

DP solves complex problems by storing solutions to subproblems instead of recomputing. It has two strategies — Top-Down (memoization) and Bottom-Up (tabulation). It improves exponential algorithms to polynomial time but requires understanding of overlapping subproblems and optimal substructure.

34. Time Complexity of QuickSort and Why Best Sorting in Practice

Average time complexity is O(n log n), worst case O(n²) when pivot selection is poor. It uses divide-and-conquer and in-place partitioning, making it memory efficient. Randomized and median-of-three pivots reduce worst cases. It outperforms other sorts in practice due to cache locality.

35. What is Thread Pooling?

Thread pooling reuses pre-created worker threads instead of creating threads repeatedly. It reduces CPU overhead and improves throughput. Java Executors and C++ Thread Pools are widely used. Ideal for scalable server-side processing.

36. What is Two-Phase Commit Protocol?

2PC ensures distributed transaction consistency across multiple systems. Phase 1 (prepare) asks all nodes to commit or abort; Phase 2 (commit/rollback) finalizes based on votes. It avoids conflicts but suffers from blocking issues if coordinator fails.

37. What is Event-Driven Architecture?

Applications react to events generated by producers and consumed by event handlers. It improves scalability and decoupling, suitable for real-time systems. Message brokers like Kafka and RabbitMQ facilitate asynchronous communication. Eventual consistency must be considered.

38. What is Inversion of Control (IoC)?

IoC means objects do not control their dependencies — external frameworks provide them. Dependency Injection is the most common implementation. IoC improves testability and reduces tight coupling. Spring Framework heavily uses IoC.

39. SQL vs NoSQL Databases

SQL stores structured data with strict schema, supporting ACID transactions. NoSQL handles unstructured/semi-structured data with flexible schema and horizontal scaling. SQL suits financial/crucial apps, NoSQL suits analytics, IoT, and high-load systems.

40. What is Memory Leak?

A memory leak occurs when an application allocates memory but fails to release it even after use. It gradually consumes RAM and slows down systems. Common in C++ due to manual memory management; possible in Java due to lingering references. Tools like Valgrind and VisualVM help detection.

41. What happens when you type a URL in the browser?

DNS lookup → TCP handshake → TLS handshake (if HTTPS) → HTTP request → Server processing → HTTP response → Page rendering. Each step involves caching, routing, and load balancing. Understanding this demonstrates deep networking knowledge.

42. What is API Rate Limiting?

Rate limiting restricts the number of API calls clients can make within time windows. It protects servers from overload and abuse. Common strategies include fixed window, sliding window, and token bucket algorithms. Essential for SaaS and microservices.

43. What is JWT Authentication?

JWT (JSON Web Token) securely transmits user identity using signed tokens. It consists of header, payload, and signature. Stateless authentication eliminates server-side session storage while ensuring trust. Token expiration prevents misuse.

44. What is Referential Integrity?

Referential integrity ensures foreign keys correctly reference primary keys and prevent orphan records. It maintains relational consistency across tables. Cascading delete/update rules automate dependency enforcement.

45. Explain Mutex vs Semaphore

Mutex is a locking mechanism allowing only one thread to access a resource at a time. Semaphores allow limited number of threads (counting mechanism). Mutex has ownership while semaphore does not. Correct usage prevents deadlocks.

46. What is Circuit Breaker Pattern?

Circuit breaker stops calling a failing service to prevent cascading failures. States include Closed → Open → Half Open based on service health. Widely used in microservices for resiliency. Implemented via Hystrix, Resilience4j.

47. Explain Monotonic Stack Technique

Monotonic Stack maintains elements either always increasing or decreasing during traversal. It efficiently solves problems like Next Greater Element or Histogram Area in O(n) time. Helps reduce nested loops in optimization problems.

48. What is a Bloom Filter?

A Bloom filter is a probabilistic data structure used to test membership with small memory footprint. It can produce false positives but never false negatives. Used in caching, databases, and Big Data systems like HBase.

49. What is Latency vs Throughput?

Latency is the time taken to process one request, while throughput is the number of requests handled per second. Low latency is crucial for responsiveness; high throughput is essential for scalability. Systems must balance both based on use cases.

50. Explain Message Queue vs Stream Processing

Message queues (RabbitMQ, SQS) handle asynchronous task processing with guaranteed delivery. Stream platforms (Kafka, Flink) handle real-time continuous data flows. Queues focus on reliability; streams focus on high-speed event analytics.

Tech Mahindra Coding Question

Question 1:

Write a code that checks if a given integer is positive or negative


Question 2:

Write a code to find the sum of numbers in a given range, where the range is defined by two integer inputs num1 and num2


Question 3:

Write a program to determine if a given number is a prime number, considering that a prime number can only be divided by 1 and itself


Question 4:

Write a program that reverses a given number.


Question 5:

Write a program to find the factors of a given number


Question 6:

Write a program to find all possible palindromic partitions of a given string.


Question 7:

Write a program to find the largest and smallest element in an array.


Question 8:

Write a program to find the sum of elements in an array.


Question 9:

Write a program to find the frequency of elements in an array.


Question 10:

Write a program to check if a given string is a palindrome or not.


Question 11:

Write a program to remove spaces from a string.


Question 12:

Write a program to solve the trapping rainwater problem, where the goal is to calculate the amount of rainwater that can be trapped between bars in an elevation map


Question 13:

Write a program that implements Kadane’s Algorithm to find the largest contiguous subarray sum efficiently


Question 14:

Implement a code to merge intervals, combining overlapping or adjacent intervals into a consolidated set.


Question 15:

Write a program to count the number of inversions in an array


Question 16:

Write a program that performs a linear search to find the position of a given element in an array


Question 17:

Write a program that implements the insertion sort algorithm to sort an array in ascending order.


Question 18:

Write a program that inserts a new node at the end of a singly linked list


Question 19:

Write a program that performs insertion and deletion operations on a linked list


Question 20:

Write a program that prints the reverse of a linked list without actually modifying the original list


Question 21:

Write a program that reverses a linked list in groups of a given size.


Question 22:

Write a program that checks whether a linked list is a palindrome or not


Question 23:

Write a program to insert a new node in the middle of a doubly linked list


Question 24:

Write a program to split a circular linked list into two halves, maintaining the circular structure


Question 25:

Create a program to convert an infix expression to postfix notation


Question 26:

Write a program to reverse the elements of a queue 


Question 27:

Implement a circular queue using linked lists


Question 28:

Write a program to perform an inorder tree traversal on a binary tree without using recursion


Question 29:

 Implement a program to search for a specific node in a binary search tree


Question 30:

Write a program to construct a binary tree using the given postorder and inorder traversal sequences

Leave a Comment