Tech Mahindra Interview Questions: Technical, Coding and HR Model Answers
Practise realistic Tech Mahindra interview question shapes across CS fundamentals, coding, SQL, projects and HR. Each model answer shows the evidence and follow-ups you should be ready to explain.
KnowledgeGate Team
Exam prep & CS education

Memorising interview questions rarely helps when the interviewer changes a value, asks “why”, or moves from code to your project. You need structures that handle follow-ups. Practise CS fundamentals, coding, SQL, project defence and HR responses with worked values you can rehearse aloud. The exact assessment and interview flow can vary by role, campus drive and hiring route, and Tech Mahindra does not publish one universal sequence for candidates.
1. What to Prepare for a Tech Mahindra Interview Without Guessing the Round Pattern
Question shape | What it tests | Evidence to give | Practice example |
|---|---|---|---|
CS concept | Mechanism, not definition alone | One contrast and one use | Process versus thread |
Coding or SQL | Correctness and edge cases | Dry run and complexity | Second-largest distinct value |
Project | Ownership and trade-offs | Contribution and measured result | Duplicate-registration fix |
HR | Clarity and fit | Honest example with a constraint | Relocation answer |
Check the live role on Tech Mahindra’s official careers portal. Tech Mahindra also warns there about fraudulent recruitment offers. Never assume an unstated round count, cutoff, eligibility rule, bond or hiring promise.
Use the Placement Preparation category for aptitude and interview practice. Concepts, code, projects and communication stay useful when a service-based employer changes its hiring flow. Wipro’s published interview guide focuses on a first non-repeating coding trace and project-to-result answers. Wipro Technical Interview Questions: Coding, SQL and HR HCLTech’s published guide maps 12 answers and a 42-minute mock. HCLTech Interview Questions: 12 Technical and HR Answers The Tech Mahindra examples below focus on a second-largest trace, duplicate-safe SQL and a seven-day rehearsal.
2. Technical Questions: Use Definition, Mechanism and Example
Use a definition, mechanism and example in each answer.
How is a process different from a thread? A process owns an address space; threads share process memory and resources. If two threads read
counter = 10and both write 11, two intended increments produce 11 instead of 12. Shared state needs synchronisation.What does transaction atomicity mean? All operations succeed as one unit, or all roll back. If checkout inserts
order_id = 314and reduces inventory from 8 to 7, a failed inventory update must also undo the insert.When would you choose TCP over UDP? Choose TCP for reliable, ordered transfer of
resume.pdf. UDP can suit live voice because retransmission delay may be worse than one lost packet. Neither is universally better.Explain method overriding. If
CardPaymentoverridesPayment.pay(), aPaymentreference holding that child object calls the child implementation at runtime. Overloading changes the parameter list and is resolved at compile time.Why normalise a table? In
Student(student_id, student_name, course_id, course_name, instructor_phone), repeated instructor phones create update anomalies. Separating student, course and enrolment facts reduces duplication. Measured read-heavy needs may justify deliberate denormalisation.
3. Coding Worked Example: Find the Second-Largest Distinct Value
Prompt: Given [4, 7, 2, 7, 5, 2], return the second-largest distinct value without sorting. It is 5, not duplicate maximum 7.
Start largest and second at -infinity. The one-pass states are: 4 gives (4, -infinity); 7 gives (7, 4); 2 leaves (7, 4); duplicate 7 is ignored; 5 gives (7, 5); final 2 leaves (7, 5).
for each x in values:
if x > largest:
second = largest
largest = x
else if largest > x and x > second:
second = x
else:
ignore xThis takes O(n) time and O(1) space. [9] and [3, 3, 3] have no second distinct value. For [-4, -9, -4, -6], distinct order is -4, -6, -9, so return -6. Initialising to 0 fails.
![Diagram traces [4, 7, 2, 7, 5, 2] through largest and second-largest state pairs, ignores duplicate 7, and ends with second = 5, O(n) time, O(1) space.](https://cdn.knowledgegate.ai/blog-assets/blog_asset_1786817971215_ywxgar.jpg)
4. SQL Worked Example: Make Duplicate Values Visible
Employee(id, name, dept, salary) contains (1, Asha, QA, 48000), (2, Ravi, Dev, 60000), (3, Meera, Dev, 60000) and (4, Kabir, QA, 52000). Find the second-highest distinct salary: 52000.
SELECT MAX(salary)
FROM Employee
WHERE salary < (SELECT MAX(salary) FROM Employee);The inner query returns 60000; the outer one finds the greatest lower salary, 52000. Duplicate 60000 rows do not change distinct rank. ORDER BY salary DESC LIMIT 1 OFFSET 1 fails unless duplicates are removed. With only 60000, 60000, the aggregate returns NULL.
5. Project and Resume Questions: Prove What You Personally Changed
In this fictional project, a four-member team built a campus event-registration API for 600 users. You owned POST /events/{eventId}/register; at 40 requests per second, retries created duplicates.
Answer in 60 to 75 seconds: problem, evidence, change, verification, trade-off.
At 40 requests per second, retries created duplicate registrations. Logs showed repeated
X-Request-Id = req-901. I addedUNIQUE(event_id, user_id)as the database guard and stored each idempotency result for 10 minutes. I replayed the same request 100 times and verified exactly 1 database row and 99 safe replays. I personally wrote the endpoint fix, constraint, replay handling and test; the team built the wider API. Idempotency storage adds expiry and monitoring work.
Prepare these follow-ups:
Why keep the unique constraint? Simultaneous requests can pass an application check; the database is the final guard.
After expiry? The idempotency record disappears; the constraint still blocks duplication.
What did you write? The endpoint fix, constraint, replay logic and test, not the whole API.
How test concurrency? Start two requests together, await both, then assert one row and one safely handled duplicate.

6. HR Questions: Replace Stock Lines With Verifiable Facts
For “Tell me about yourself”, use relevant evidence:
I am a final-year BTech CSE student, and my strongest areas are Java and SQL. In a four-member campus event-registration project, I owned the registration endpoint. When client retries created duplicates, I traced the repeated request ID, added a database constraint and idempotency handling, then verified the fix through 100 replays. I am now seeking a graduate role where I can apply backend fundamentals, careful debugging and evidence-led testing while continuing to learn from production engineering work.
For “Why Tech Mahindra?”, use role-first research: “I checked the live role on Tech Mahindra’s careers portal, matched it against my Java, SQL and API work, and identified what I must learn.” Use the skills on your role page.
Prove debugging as a strength by tracing req-901 and testing 100 replays. For a weakness, explain that you rush answers, so you record three two-minute project explanations weekly and review filler words. For relocation or shifts, state the real constraint: “I can relocate after 14 days”.
7. Short Version: Rehearse Answers, Follow-Ups and Evidence for Seven Days
Use 90 minutes daily:
Day 1: Process versus thread and OOP.
Day 2: ACID, normalisation and TCP versus UDP.
Day 3: Solve the array twice and SQL once without notes.
Day 4: Draw and explain the project flow.
Day 5: Record four HR answers.
Day 6: Run a 45-minute mock, then correct answers for 45 minutes.
Day 7: Repeat errors and verify the live role on the careers portal.
The short version: define, demonstrate, defend resume claims with numbers, and answer honestly. For one aptitude-to-interview schedule, use the Placement in 30 Days course next.
Keep learning
Capgemini Interview Questions: Technical and HR Rounds with Model Answers
Practise clear technical and HR answers through Java, SQL, a coding trace and one consistent project story. Each example shows what to say and how to support it.
Cognizant Interview Questions: Technical and HR Model Answers
Prepare clear technical and HR responses through worked programming, SQL, project and STAR examples, then test them in a timed self-review mock.
TCS Interview Questions: Technical and HR Model Answers for Freshers
Prepare for technical follow-ups and HR evidence checks with worked SQL, coding, project, introduction and behavioural practice fixtures.
Hexaware Interview Questions and Answers: Technical, Coding and HR Rounds
Prepare answers that survive follow-up questions. This guide covers CS fundamentals, a worked SQL query, a coding trace, project defence, HR responses and a timed mock.





