163 questions · from 24 interviews · 2 asked more than once
TCS interview questions
Every question candidates reported from their TCS interviews, most frequently asked first. Each links to the write-up it came from, so you can see the round and how it went.
TCS coding and DSA questions
- 01
Maximum Gap
Given an array of integers, find the maximum difference between two consecutive elements after sorting the array. Example: Input: 3 6 9 1 Sorted: 1 3 6 9 Gaps: 2, 3, 3 Output: 3
From # TCS NQT 2026 – Complete Exam Experience & Section-wise Review
- 02
EV Charging Cost Optimization
You are given: - n — number of vehicles - t — number of charging slots - mc — maximum capacity of each slot - vehicles[] — charging requirement of each vehicle - costs[] — cost per unit at each charging slot - penalty — penalty per unit of unfulfilled energy…
From # TCS NQT 2026 – Complete Exam Experience & Section-wise Review
- 03
SQL query for maximum salary
Write an SQL query that returns the maximum salary value from the employee table (or the relevant table containing salary information).
Easy · From TCS Ninja Interview Experience
- 04
Fibonacci series problem
Implement a function to generate Fibonacci numbers. Variations may include recursive, iterative, or memoized approaches.
Easy · From # TCS Digital Interview Experience | 1.7 YOE | Selected
- 05
Count Smaller Elements to the Left
Given an array of integers, for each element count how many elements smaller than a given ordered value appear to its left side of the array.
Easy · From TCS NQT 9 August 2026 Review
- 06
Count Inversions Using Merge Sort
Implement a merge sort algorithm that, while sorting, counts the number of inversions (i.e., pairs of elements that are out of order) in the array.
- 07
Integer to Roman (Extended Range)
Convert an integer to its Roman numeral representation. The input range is extended beyond the typical bounds (up to lakhs and crores), requiring handling of much larger values than the standard problem.
Easy · From TCS NQT || 07 July 2026 || Shift-2
- 08
Rank Transform of an Array
Given an integer array arr, replace each element with its rank among the elements. The rank is defined as 1 plus the number of distinct elements less than the element. Elements with the same value receive the same rank.
Medium · From TCS NQT || 07 July 2026 || Shift-2
- 09
Array Rearrangement to Avoid Original or Reverse
Given an array, rearrange (jumble) its elements so that the resulting arrangement is not identical to the original array and also not identical to the reverse of the original array. Any valid rearrangement satisfying these constraints is acceptable.
- 10
Count laptops with sufficient battery
Given hours h, and an array of laptops indicating their remaining hours, find how many laptops have battery greater than or equal to h.
Easy · From TCS NQT 2026 - April 1
- 11
Happy and Sad people after iterations
Initially there are N Happy people and 0 Sad people. On each iteration: - 70% of Happy people become Sad - 50% of Sad people become Happy For example, (1000,0) → (300,700) after the 1st iteration, and (300,700) → (440,560) after the 2nd iteration. Given a…
Medium · From TCS NQT 2026 - April 1
- 12
Vehicle Parking System Charges Calculation
A vehicle parking system charges based on the number of hours parked. The billing is calculated as follows: - First 2 hours → 100 per hour - Next 3 hours (from 3rd to 5th hour) → 50 per hour - Beyond 5 hours → 20 per hour Conditions: - If the input is not an…
Easy · From TCS NQT | 21-03-2026 | 2nd Shift | Advanced Coding
- 13
Maximize People in Hot Air Balloon
A hot air balloon has a maximum weight carrying capacity X. There are N people waiting to board the balloon. The weight of each person is given in an array S of size N. Your task is to determine the maximum number of people that can be accommodated in the…
Medium · From TCS NQT | 21-03-2026 | 2nd Shift | Advanced Coding
- 14
Gym Fees Calculator
Plans: 3 months = 5000 6 months = 9000 9 months = 12000 12 months = 15000 Given N months, calculate total cost based on priority: 12 → 9 → 6 → 3 If not divisible by 3, print "Error"
From TCS NQT 2026 Coding Questions (Gym Fees + Duplicate Transaction)
- 15
Duplicate Transaction Detection
Detect duplicate transactions where: - sender, receiver, amount are same - timestamp is different
From TCS NQT 2026 Coding Questions (Gym Fees + Duplicate Transaction)
- 16
Prime Factors of an Integer
Given an integer n , print its prime factors in ascending order. Example: Input: 36 Output: 2 2 3 3
Medium · From TCS TAG test 12.01.2026
- 17
Maximum Profit from Continuous Subarray with Cost Constraint
You are given: • An integer W → maximum allowed total cost • An array cost[] of size n • An array profit[] of size n You must select a continuous subarray such that: sum(cost in subarray) ≤ W Among all such subarrays, return the maximum total profit . Example…
Medium · From TCS TAG test 12.01.2026
- 18
OOPs Concepts: Pillars, Use Cases, Constructors, Destructors, Copy
Discuss the four pillars of Object-Oriented Programming (OOPs). Explain real-life use cases of OOPs, why it was improvised, and how it could be defined to people without computers. Write code for constructors and destructors. Explain the difference between…
- 19
Pointers: 'this' keyword, Call by Value vs. Reference
Explain pointers in C++. Specifically, discuss the 'this' keyword, the difference between call by value and call by reference, and the general purpose and benefits of using pointers.
- 20
Basic Star Pattern
Write code to print a basic star pattern (e.g., a square or triangle of asterisks).
Easy · From TCS Prime Interview Experience
- 21
Fibonacci Series (Recursive, Iterative, Memoized)
Write code for the Fibonacci series using three different approaches: recursive, iterative, and memoization (dynamic programming).
Medium · From TCS Prime Interview Experience
- 22
Binary Search Tree (BST) Implementation
Write code to implement a Binary Search Tree (BST). Be prepared to dry run the code and explain its operations.
Medium · From TCS Prime Interview Experience
- 23
Tortoise and Hare Algorithm (Linked List)
Explain the Tortoise and Hare algorithm, also known as Floyd's Cycle-Finding Algorithm, for detecting cycles in a Linked List. Be ready to discuss its implementation and logic.
Medium · From TCS Prime Interview Experience
- 24
Swap Two Numbers (Pass by Value & Reference)
Write code to swap two numbers using both pass by value and pass by reference mechanisms. Explain the differences and implications of each approach.
Easy · From TCS Prime Interview Experience
- 25
Longest Palindromic Substring
Given a string, find the longest palindromic substring within it. I was asked to write the code for this problem.
Medium · From TCS Oncampus Interview Experience(2026 Batch)
25 more in the TCS write-ups.
TCS system design questions
- 01
Database Sharding
Do you know about sharding?
From TCS Digital Interview Experience (TCS NQT Priority Hiring)
- 02
Handling Operations on 2 Billion Entries
If I needed to perform actions on 2 billion entries simultaneously, what approach would I take, and which languages and technologies would I choose, along with the reasoning?
Hard · From Tcs Digital Interview experience
- 03
Database Scaling
What is database scaling? What is the difference between horizontal scaling and vertical scaling?
- 04
Database Design Considerations
What do you consider while designing a database?
- 05
Database Normalization
What is normalization? How did you ensure that your database adheres to the normal forms?
- 06
Handling Large Data Input
Given an application with a large quantity of data input, how would you design a system to handle it efficiently and robustly? (Hint: Consider cache servers, similar to Facebook's approach.)
Medium · From TCS digital interview
- 07
Cache Server Algorithms
Explain the common algorithms and principles that cache servers use for data management, eviction, and consistency.
Medium · From TCS digital interview
- 08
Difference between Application Server and Web Server
Explain the primary distinctions in functionality, purpose, and architecture between an application server and a web server.
Medium · From TCS digital interview
- 09
Why Use MongoDB Over Relational Databases?
Explain the specific advantages, use cases, and scenarios where MongoDB (a NoSQL database) is preferred over traditional relational databases like MySQL.
Medium · From TCS digital interview
- 10
Browser URL Navigation Process
Describe the end-to-end process that occurs, step-by-step, from the moment you type a URL into a browser's address bar and hit enter, until the requested webpage is fully displayed.
Hard · From TCS digital interview
TCS behavioural and HR questions
- 01
Relocation Willingness
The HR asked about my willingness to relocate.
Easy · Asked 2 times · From Tcs Digital Interview experience
- 02
Tell me about yourself
Introduce yourself, covering background, education, and professional experience.
From # TCS Digital Interview Experience | 1.7 YOE | Selected
- 03
Tell me something about yourself not on resume
Share a personal or professional detail that is not listed on your resume.
From # TCS Digital Interview Experience | 1.7 YOE | Selected
- 04
Introduce Yourself
Introduce yourself.
From TCS Digital Interview Experience (TCS NQT Priority Hiring)
- 05
Experience with SQL in Projects
Have you worked with SQL in any of your projects?
From TCS Digital Interview Experience (TCS NQT Priority Hiring)
- 06
Discuss Projects
Tell me about your projects.
From TCS Digital Interview Experience (TCS NQT Priority Hiring)
- 07
Other Offers (Technical Interview)
Do you have any other offers?
From TCS Digital Interview Experience (TCS NQT Priority Hiring)
- 08
TCS Ninja Offer and Choice
If we give you TCS Ninja, will you accept it? What will you choose between TCS and the other organization?
From TCS Digital Interview Experience (TCS NQT Priority Hiring)
- 09
- 10
Relocation Willingness (HR Interview)
Will you be able to relocate?
From TCS Digital Interview Experience (TCS NQT Priority Hiring)
- 11
Other Offers (HR Interview)
Do you have any other offers?
From TCS Digital Interview Experience (TCS NQT Priority Hiring)
- 12
Working Weekends/Night Shifts (HR Interview)
Are you open to working on weekends? Are you open to night shifts?
From TCS Digital Interview Experience (TCS NQT Priority Hiring)
- 13
- 14
- 15
- 16
- 17
Why Mechanical Engineering?
Why did you choose Mechanical Engineering for your studies?
From TCS Interview Experience for Ninja Role 2025 | On-campus | Non-CS Background
- 18
Transition to IT
Why are you transitioning from Mechanical Engineering to IT?
From TCS Interview Experience for Ninja Role 2025 | On-campus | Non-CS Background
- 19
Family Details
Share some details about your family.
From TCS Interview Experience for Ninja Role 2025 | On-campus | Non-CS Background
- 20
Relocation and Night Shifts
Are you open to relocating and working night shifts?
From TCS Interview Experience for Ninja Role 2025 | On-campus | Non-CS Background
- 21
Job Offer Scenario: Ninja vs. Digital Profile
If I were to receive job offers for both the Ninja and Digital profiles, what would I do?
- 22
Reason for Not Pursuing M.Tech After GATE
Given that I had already passed the GATE exam, why did I choose not to pursue an M.Tech degree?
- 23
Introduce Yourself and Project Explanation
I was asked to introduce myself and then explain in detail the best project I had developed.
- 24
Working Shifts Willingness
The HR inquired about my willingness to work in different shifts.
Easy · From Tcs Digital Interview experience
- 25
16 more in the TCS write-ups.
TCS other questions
- 01
MongoDB vs. SQL
Why did you choose MongoDB over SQL? What are the differences?
Asked 2 times · From TCS Prime Interview Experience Feb 2024
- 02
Explain the 4 pillars of OOP
Describe inheritance, encapsulation, abstraction, and polymorphism with examples.
From # TCS Digital Interview Experience | 1.7 YOE | Selected
- 03
Handling Confidential Data Leak
Scenario: Confidential data from a system is leaking, but the source of the leak is unknown. How would you handle the situation? Approach: Identify the affected systems. Analyze logs and monitor unusual activity. Check each file manually to find the root…
- 04
What is TPM?
Explain Total Productive Maintenance (TPM).
From TCS Interview Experience for Ninja Role 2025 | On-campus | Non-CS Background
- 05
Explain Lean Six Sigma
Provide an explanation of Lean Six Sigma methodologies.
From TCS Interview Experience for Ninja Role 2025 | On-campus | Non-CS Background
- 06
What is PDCA Cycle?
Describe the PDCA (Plan-Do-Check-Act) Cycle.
From TCS Interview Experience for Ninja Role 2025 | On-campus | Non-CS Background
- 07
HTML Form Snippet
Write an HTML code snippet that includes a float input, an integer input, and a submit button.
Easy · From TCS Interview Experience for Ninja Role 2025 | On-campus | Non-CS Background
- 08
Java Keyword Explanation
Explain what a keyword is in Java.
Easy · From TCS Interview Experience for Ninja Role 2025 | On-campus | Non-CS Background
- 09
Java User Input
How do you take input from a user in Java?
Easy · From TCS Interview Experience for Ninja Role 2025 | On-campus | Non-CS Background
- 10
Meaning of PSVM in Java
What does psvm stand for in Java?
Easy · From TCS Interview Experience for Ninja Role 2025 | On-campus | Non-CS Background
- 11
How ChatGPT Works
Explain how ChatGPT functions.
From TCS Interview Experience for Ninja Role 2025 | On-campus | Non-CS Background
- 12
OOPs Concepts: Pillars and Abstraction vs. Encapsulation
During the technical interview, I was asked to explain the fundamental pillars of Object-Oriented Programming (OOPs) and clarify the distinction between abstraction and encapsulation.
From TCS NQT Complete Interview Experience | Ninja | 3.3LPA | Full Time
- 13
SQL DML Commands
I was tasked with writing SQL commands for common Data Manipulation Language (DML) operations: CREATE, UPDATE, and DELETE.
From TCS NQT Complete Interview Experience | Ninja | 3.3LPA | Full Time
- 14
Java Compilation Process
The interviewer asked me to describe the end-to-end compilation process in Java.
From TCS NQT Complete Interview Experience | Ninja | 3.3LPA | Full Time
- 15
Current Governor of UP
Who is the current Governor of Uttar Pradesh?
- 16
Current Vice President of India
Who is the current Vice President of India?
- 17
Experience and Knowledge in .NET
Describe my experience and knowledge with the .NET framework.
- 18
Spring Boot Project Discussion
The panel deeply questioned me about my project, which used Spring Boot and MySQL. Specifically, they inquired about Spring Boot annotations and the role of application.properties in the project.
- 19
Define REST and API
I was asked to define what REST is and what an API is.
Easy · From Tcs Digital Interview experience
- 20
REST Method for Database Update
Which HTTP/REST method is typically used for updating data in a database?
Easy · From Tcs Digital Interview experience
- 21
Inheritance Concept and Code Analysis
The interviewer asked me about the concept of Inheritance and then provided a sample code snippet where I needed to identify the correct choice or output based on inheritance principles.
Medium · From Tcs Digital Interview experience
- 22
Features of Java
I was asked to discuss various features of the Java programming language.
- 23
Explain Exception Handling
The panel asked me about Exception Handling in Java.
- 24
Smallest and Biggest Real-Time Java Projects
According to me, what constitutes the smallest and biggest real-time projects built using Java?
- 25
37 more in the TCS write-ups.
TCS interview questions FAQ
What questions are asked in TCS interviews?
Candidates reported 163 distinct questions across 24 TCS interviews. 50 coding and DSA questions, 10 system design questions, 41 behavioural and HR questions, 62 other questions.
Which TCS interview questions are asked most often?
The most repeated are "Relocation Willingness" (2 times), "MongoDB vs. SQL" (2 times).
How difficult are TCS interview questions?
Of the questions candidates rated, 55% were easy, 38% medium and 8% hard.