TCS Interview Questions 2026

Published July 22, 2026 · Updated July 22, 2026

167 real interview questions asked at TCS. Covers Domain, System Design, Behavioral, DSA / Arrays, React / Strict Mode, React / Browser Compatibility, React / Cross-browser, React / State Management, React / Migration, Node.js / Performance, Node.js / Streams, Node.js / Error Handling, SQL / Query Planning, SQL / Indexing, SQL / MySQL, SQL / Advanced SQL, SQL / Maintenance, SQL / Database Architecture, Java / Spring Transactions, Java / Connection Pool, Java / Concurrency, Java / Performance, Java / Spring Async, Java / Design Patterns, Python / Django ORM, DevOps / Docker, Security / Information Disclosure, Security / Cryptography, Behavioral / Technical Debt, DSA / Stack, DSA / Sliding Window, React / Code Splitting, React / Hooks, Java / Spring Boot, Java / Threading, Java / Optional, Java / Exception Handling, Java / Memory, Java / Core Java, Java / Spring AOP, Java / Hibernate, Java / Generics, Python / Deployment, Python / Core Python, SQL / Window Functions, SQL / Set Operations, Security / CORS, TypeScript / Migration, Java / API Versioning, Java / Spring Boot Internals, Java / Scheduling, Java / Spring Security, Java / Spring Core, Java / Spring MVC, Java / Spring Scopes, Java / Testing, DSA / String, DSA / Bit Manipulation, Behavioral / Project Management, Behavioral / Agile, React / Keys, React / Framework Comparison, Node.js / Middleware, Node.js / Clustering, SQL / MySQL Query Analysis, SQL / Data Types, React / Mobile Debugging, Behavioral / Team Collaboration, Java / Migration, DevOps / Debugging, Performance / N+1, Redis / Operations, React / Routing, React / Best Practices, React / State, React / Modules, Java / Streams, Java / Functional Programming, Java / JVM, Node.js / Modules, Node.js / Security, Python / Advanced Python, Python / Flask, Python / Security, Python / OOP, DSA / Strings, DSA / Sorting, Security / OWASP, Security / Access Control, Security / Authentication, Security / Transport Security, SQL / Joins, SQL / Transactions, SQL / Data Cleaning, SQL / Basics, MongoDB / Use Cases, MongoDB / Aggregation, MongoDB / Data Modeling, TypeScript / Types, TypeScript / Best Practices, Security / Auth, Architecture / Design Principles, React / Forms, React / Context, React / Error Handling, Java / Spring Cloud, Java / Spring Batch, Java / Database, Web / Real-time, Behavioral / Business Analysis, Business Analysis / Requirements, Business Analysis / Requirements Gathering, Business Analysis / Analysis, Business Analysis / Documentation, Web / Security, React / DOM, Security / SQL Injection, Security / Web Security, DSA / Graph, DSA / Data Structures, Java / Modern Java, Java / Collections, Architecture / REST API. Reported by engineers who went through the TCS process.

Questions Interview GuidesInterview Guides
167 questions
4785 engineers asked
7086 upvotes

Domain (7)

TCS Medium Technical round Java

Explain the difference between HashMap and ConcurrentHashMap in Java. When would you use each? Describe segment locking in Java 7 vs the CAS-based approach in Java 8+, and why you should never use HashMap in a multi-threaded context.

↑ 51 upvotes · 52 engineers asked this · SDE2
TCS Medium Technical round JavaSpring Boot

How do you handle transactions in Spring Boot? Explain the @Transactional annotation, propagation levels (REQUIRED, REQUIRES_NEW, NESTED), isolation levels, and how Spring proxies intercept methods — including why self-invocation bypasses the proxy.

↑ 41 upvotes · 43 engineers asked this · SDE2
TCS Medium Technical round Java

What is the difference between fail-fast and fail-safe iterators in Java Collections? Give examples of collections that use each, explain the ConcurrentModificationException, and show how to safely remove elements during iteration.

↑ 76 upvotes · 29 engineers asked this · SDE2
TCS Medium Technical round MySQLPostgreSQL

Write a SQL query to find the second highest salary from an Employee table. Show at least two approaches: using LIMIT/OFFSET, using a subquery with MAX, and using DENSE_RANK(). Discuss which is most efficient and why.

↑ 55 upvotes · 58 engineers asked this · SDE2
TCS Medium Technical round JavaSpring Boot

What are the SOLID principles? Explain each with a real-world Java example. Then describe a scenario where rigidly following SOLID leads to over-engineering, and how you balance pragmatism with good design.

↑ 93 upvotes · 36 engineers asked this · SDE2
TCS Medium Technical round Java

Explain the difference between ArrayList and LinkedList in Java. For a TCS banking project, you need to insert records at the front of a list frequently. Which would you choose and why?

↑ 55 upvotes · 34 engineers asked this · SDE1
TCS Medium Technical round JavaSpring Boot

Explain Spring Boot auto-configuration. How does @SpringBootApplication work under the hood? What is the difference between @Component, @Service, @Repository, and @Controller in Spring?

↑ 61 upvotes · 39 engineers asked this · SDE2

System Design (2)

TCS Medium System Design round JavaSpring BootREST

Design a REST API for an e-commerce cart system. Define the endpoints (add item, remove item, get cart, checkout), explain authentication with JWT, handle race conditions on inventory, and discuss idempotency for the checkout endpoint.

↑ 46 upvotes · 47 engineers asked this · SDE2
TCS Medium System Design round JavaSpring BootMySQL

Design a library management system with online book reservation. Students can search, reserve, and borrow books. Librarians can manage inventory. Cover the database schema, REST APIs, and how you handle concurrent reservations of the last copy.

↑ 54 upvotes · 33 engineers asked this · SDE2

Behavioral (1)

TCS Medium HR round

Tell me about a time you worked in a large team and had to coordinate your work with multiple developers. How did you avoid merge conflicts and integration issues?

↑ 47 upvotes · 28 engineers asked this · SDE2

DSA / Arrays (2)

TCS Medium Technical round Java

Write a Java program to rotate a matrix 90 degrees clockwise in-place. Explain the transpose-then-reverse approach and why it is O(n2) time with O(1) extra space.

↑ 49 upvotes · 30 engineers asked this · SDE1
TCS Easy Technical round 1-4 years

Given an array of integers, find two numbers that sum to a target. Optimize for O(n) time and O(n) space.

↑ 54 upvotes · 22 engineers asked this · SDE2

React / Strict Mode (1)

TCS Medium Technical round 2-4 years

After a React upgrade from v17 to v18, your useEffect fires twice in development even though it wasn't before. Several API calls are duplicated. A junior dev asks you to 'just add a flag'. What's the real explanation and the correct fix?

↑ 56 upvotes · 24 engineers asked this · SDE2

React / Browser Compatibility (1)

TCS Medium Technical round 2-5 years

You deploy a React app and users report a blank white screen on IE11. Your CI/CD passes. What's happening and how do you fix it?

↑ 61 upvotes · 29 engineers asked this · SDE2

React / Cross-browser (1)

TCS Hard Technical round 3-6 years

A product manager reports that your React app works fine in Chrome but crashes on Safari iOS 15. You cannot reproduce it locally. How do you debug this?

↑ 64 upvotes · 32 engineers asked this · SDE2

React / State Management (3)

TCS Medium System Design round 2-4 years

Your React component tree is 8 levels deep. A state change at level 1 needs to reach a component at level 8. Without Redux or Context, you're prop drilling through 6 intermediate components. What are your options?

↑ 66 upvotes · 34 engineers asked this · SDE2
TCS Medium Screening round 3-6 years

A developer says 'I never need Redux because Context API can do everything Redux does.' Is this true?

↑ 10 upvotes · 28 engineers asked this · SDE2
TCS Medium Technical round 2-5 years

Your React application shows 'Cannot update a component from inside the function body of a different component.' What causes this?

↑ 14 upvotes · 22 engineers asked this · SDE2

React / Migration (1)

TCS Hard System Design round 5-8 years

Your team needs to migrate a large class component codebase to hooks. A senior dev says 'just convert everything to hooks.' What risks does this carry and how would you approach the migration safely?

↑ 69 upvotes · 37 engineers asked this · SDE2

Node.js / Performance (2)

TCS Hard Technical round 3-6 years

Your Express.js API endpoint returns data in 80ms locally but 800ms in production. Both use the same database. What are the likely causes and how do you systematically investigate?

↑ 74 upvotes · 42 engineers asked this · SDE2
TCS Medium Scenario round 2-5 years

Your Express app serves API and static files. Under load, static file serving consumes most of CPU. How do you fix this?

↑ 33 upvotes · 51 engineers asked this · SDE2

Node.js / Streams (1)

TCS Hard Scenario round 3-6 years

You need to process 100,000 CSV rows in Node.js without blocking the event loop and without running out of memory. The file is 2GB. How do you implement this?

↑ 75 upvotes · 43 engineers asked this · SDE2

Node.js / Error Handling (2)

TCS Medium Scenario round 2-5 years

Your Node.js API uses async/await throughout. A developer reports that errors thrown in async route handlers are causing the process to crash with 'UnhandledPromiseRejectionWarning'. What's the architectural fix?

↑ 80 upvotes · 48 engineers asked this · SDE2
TCS Medium Screening round 2-5 years

What is Node.js's unhandledRejection event? How does it behave differently in Node 15+ vs earlier versions?

↑ 29 upvotes · 47 engineers asked this · SDE2

SQL / Query Planning (2)

TCS Hard Technical round 4-7 years

You run EXPLAIN ANALYZE on a query joining 4 tables. It shows 'Hash Join' with 'rows=1 actual rows=50000'. What does this tell you and what's your fix?

↑ 5 upvotes · 3 engineers asked this · SDE2
TCS Medium Technical round 2-5 years

Your PostgreSQL query plan shows 'Seq Scan' on a small 1000-row table despite having an index. Why might Postgres choose not to use the index?

↑ 83 upvotes · 41 engineers asked this · SDE2

SQL / Indexing (3)

TCS Hard Technical round 3-6 years

Your application has this query pattern: SELECT * FROM orders WHERE status='pending' running every 5 seconds. Table has 50M rows, 99.9% of orders are 'completed'. An index on status exists. EXPLAIN shows it's still doing a table scan. Why?

↑ 7 upvotes · 5 engineers asked this · SDE2
TCS Medium Technical round 2-5 years

A developer writes SELECT * FROM users WHERE email LIKE '%@gmail.com'. It's slow despite an index on email. Why? How would you make this fast while keeping the same search capability?

↑ 14 upvotes · 12 engineers asked this · SDE2
TCS Medium Screening round 1-4 years

A developer creates an index on every column 'to make queries faster.' Why is this wrong and what's the actual impact?

↑ 50 upvotes · 28 engineers asked this · SDE2

SQL / MySQL (1)

TCS Hard Technical round 3-6 years

You have a MySQL query with GROUP BY that was fast on 1 million rows and is now slow on 50 million. EXPLAIN shows 'Using filesort' and 'Using temporary'. What does this mean and how do you fix it?

↑ 9 upvotes · 7 engineers asked this · SDE2

SQL / Advanced SQL (1)

TCS Hard Technical round 3-6 years

You need to find duplicate records in a table of 10 million rows based on email, phone, and name (any two matching means duplicate). Write the SQL and explain the performance considerations.

↑ 11 upvotes · 9 engineers asked this · SDE2

SQL / Maintenance (1)

TCS Hard Scenario round 3-6 years

You're asked to delete 10 million old log records from a 50M row table. A simple DELETE WHERE created_at < '2024-01-01' locks the table for hours. How do you do this safely in production?

↑ 13 upvotes · 11 engineers asked this · SDE2

SQL / Database Architecture (1)

TCS Hard Scenario round 4-8 years

Your OLTP database is being used for reporting queries that scan millions of rows, causing locks that block transactional queries. You cannot add more hardware immediately. What do you do today?

↑ 16 upvotes · 14 engineers asked this · SDE2

Java / Spring Transactions (2)

TCS Hard Technical round 3-6 years

You have a Spring Boot application where @Transactional is not working — changes are not being rolled back on exceptions. You've verified the exception is a RuntimeException. What are the possible causes?

↑ 27 upvotes · 25 engineers asked this · SDE2
TCS Hard Screening round 3-6 years

You call a @Transactional service method from another @Transactional method in the same class. What transaction behavior do you get, and why?

↑ 22 upvotes · 50 engineers asked this · SDE2

Java / Connection Pool (1)

TCS Hard Technical round 3-7 years

Your Spring Boot application starts fine but after 2 hours of production traffic, all requests start returning HTTP 500 with 'Unable to acquire JDBC Connection'. Memory and CPU look normal. What's happening?

↑ 28 upvotes · 26 engineers asked this · SDE2

Java / Concurrency (1)

TCS Hard Technical round 3-6 years

You're seeing ConcurrentModificationException in production but not in tests. The code iterates over a HashMap inside a method that looks safe. What are the possible causes in a multi-threaded environment?

↑ 30 upvotes · 28 engineers asked this · SDE2

Java / Performance (2)

TCS Hard Scenario round 3-6 years

Your Spring Boot microservice processes 10,000 HTTP requests per minute. You add a feature that makes one additional database call per request. Response time jumps from 50ms to 800ms. Explain the performance model and fix.

↑ 32 upvotes · 30 engineers asked this · SDE2
TCS Medium Scenario round 3-6 years

Your Spring Boot startup time is 45 seconds with 200 beans. How do you reduce it?

↑ 24 upvotes · 32 engineers asked this · SDE2

Java / Spring Async (1)

TCS Medium Technical round 2-5 years

Your application uses @Async in Spring Boot but tasks are dropping silently. No exceptions are logged. The async methods return void. How do you debug and fix this?

↑ 34 upvotes · 32 engineers asked this · SDE2

Java / Design Patterns (1)

TCS Hard System Design round 4-7 years

You have a Java application with a class hierarchy 10 levels deep using inheritance. New requirements keep breaking existing behavior. A senior architect says 'prefer composition over inheritance'. Refactor this without changing the external API.

↑ 35 upvotes · 33 engineers asked this · SDE2

Python / Django ORM (1)

TCS Medium Technical round 2-5 years

A Django application using ORM makes 1 query per user in a list view. When the list has 500 users, the page makes 501 queries (1 for user list + 1 per user for their profile). Fix this with minimal code changes.

↑ 40 upvotes · 38 engineers asked this · SDE2

DevOps / Docker (3)

TCS Medium Scenario round 2-5 years

Your CI/CD pipeline builds a Docker image on every commit. Build time is 18 minutes. 15 minutes is just npm install. How do you reduce this without caching all npm packages globally?

↑ 50 upvotes · 48 engineers asked this · SDE2
TCS Medium Technical round 2-5 years

Your Docker container works on developer machines but fails in production with 'Permission denied' errors accessing /data volume. All developers use Mac, production runs on Linux. What's the issue?

↑ 54 upvotes · 52 engineers asked this · SDE2
TCS Medium Screening round 2-5 years

Explain Docker layer caching. Why do developers often put COPY . . before RUN npm install (wrong) and how to fix it?

↑ 81 upvotes · 49 engineers asked this · SDE2

Security / Information Disclosure (1)

TCS Medium Screening round 2-5 years

Your API returns different error messages for valid vs invalid usernames during login (e.g., 'Wrong password' vs 'User not found'). Why is this a security vulnerability and how do you fix it?

↑ 67 upvotes · 15 engineers asked this · SDE2

Security / Cryptography (2)

TCS Hard Screening round 2-5 years

Your company stores user passwords as MD5 hashes. A developer says 'MD5 is fine because we also add a salt.' Is he right? Explain the actual risk and the correct solution.

↑ 68 upvotes · 16 engineers asked this · SDE2
TCS Medium Screening round 2-5 years

What is the difference between symmetric and asymmetric encryption? When would you use each in a web application?

↑ 25 upvotes · 33 engineers asked this · SDE2

Behavioral / Technical Debt (1)

TCS Medium HR round 3-6 years

You join a team and find the codebase has no tests, no documentation, and deploys manually via FTP. You're asked to build a new feature. How do you approach this?

↑ 72 upvotes · 20 engineers asked this · SDE2

DSA / Stack (2)

TCS Easy Technical round 1-3 years

Implement a function that checks if a string of brackets is valid. Brackets: (), [], {}. Must handle nested brackets.

↑ 84 upvotes · 32 engineers asked this · SDE1
TCS Easy Technical round 1-4 years

Given a string with brackets, check if it's valid. Valid: every open bracket has a matching close bracket in correct order.

↑ 61 upvotes · 29 engineers asked this · SDE2

DSA / Sliding Window (1)

TCS Medium Technical round 2-4 years

Given a string, find the length of the longest substring without repeating characters. 'abcabcbb' → 3 ('abc').

↑ 6 upvotes · 34 engineers asked this · SDE2

React / Code Splitting (2)

TCS Medium Scenario round 2-4 years

You have a React component that renders a chart. The chart library is 500KB. It's only shown in a modal that 10% of users ever open. How do you optimize the initial load?

↑ 14 upvotes · 42 engineers asked this · SDE2
TCS Medium Screening round 2-5 years

Explain how Suspense and lazy loading work together in React for code splitting.

↑ 75 upvotes · 23 engineers asked this · SDE2

React / Hooks (4)

TCS Medium Technical round 2-5 years

You're using useReducer for complex form state. The reducer is being called twice in development. Is this a bug?

↑ 18 upvotes · 46 engineers asked this · SDE2
TCS Medium Screening round 2-5 years

How does React's useCallback differ from useMemo? A developer uses useCallback everywhere to 'optimize performance.' Is this correct?

↑ 79 upvotes · 17 engineers asked this · SDE2
TCS Medium Technical round 2-4 years

A developer puts async code inside useEffect by returning an async arrow function: useEffect(() => async () => {...}). Why is this wrong?

↑ 84 upvotes · 22 engineers asked this · SDE2
TCS Easy Screening round 1-3 years

What is the difference between useEffect with no dependency array, empty array, and with dependencies?

↑ 78 upvotes · 26 engineers asked this · SDE1

Java / Spring Boot (7)

TCS Medium Screening round 1-4 years

Explain the difference between @Component, @Service, @Repository, and @Controller in Spring. Are they interchangeable?

↑ 21 upvotes · 49 engineers asked this · SDE2
TCS Hard Technical round 3-5 years

Your Spring Boot application beans form a circular dependency: A depends on B, B depends on A. It fails at startup. How do you resolve this without @Lazy?

↑ 26 upvotes · 4 engineers asked this · SDE2
TCS Medium System Design round 3-6 years

You have a Spring Boot service that reads from a config file. In production, changing the config requires a restart. Implement dynamic config refresh without restart.

↑ 37 upvotes · 25 engineers asked this · SDE2
TCS Hard Scenario round 3-6 years

Your Spring Boot app is hitting 429 rate limit errors from an external API. Implement a solution.

↑ 18 upvotes · 36 engineers asked this · SDE2
TCS Medium System Design round 2-5 years

You're implementing a REST API with Spring Boot. How do you handle validation and return proper error responses without try-catch in every controller?

↑ 22 upvotes · 40 engineers asked this · SDE2
TCS Hard Screening round 3-6 years

Explain how Spring Boot auto-configuration works. How does it know which beans to create?

↑ 80 upvotes · 28 engineers asked this · SDE2
TCS Medium Screening round 3-6 years

What is Spring Boot Actuator? What security risks does it introduce and how do you mitigate them?

↑ 81 upvotes · 29 engineers asked this · SDE2

Java / Threading (1)

TCS Hard Scenario round 2-5 years

Your Java application creates a new Thread inside a loop that processes 10,000 items. Each thread makes a database call. Why is this a bad design and how do you fix it?

↑ 23 upvotes · 51 engineers asked this · SDE2

Java / Optional (1)

TCS Medium Technical round 2-4 years

Explain Java's Optional. A code review shows: Optional.get() called without isPresent() check. What's the problem and what's the idiomatic fix?

↑ 25 upvotes · 3 engineers asked this · SDE2

Java / Exception Handling (3)

TCS Medium Screening round 1-4 years

Explain the difference between checked and unchecked exceptions in Java. Why do some frameworks (Spring, Lombok) convert checked to unchecked?

↑ 28 upvotes · 6 engineers asked this · SDE2
TCS Medium Screening round 2-5 years

Explain how Java's try-with-resources works. What happens if both the try block and close() throw exceptions?

↑ 21 upvotes · 39 engineers asked this · SDE2
TCS Medium Screening round 2-4 years

Explain Java's try-catch-finally execution order. What happens when both catch and finally throw exceptions?

↑ 35 upvotes · 43 engineers asked this · SDE2

Java / Memory (2)

TCS Hard Technical round 3-6 years

You have a Java service that processes files. After processing 100 files, you get OutOfMemoryError: GC Overhead Limit Exceeded. Your code closes all streams. What else could cause this?

↑ 29 upvotes · 7 engineers asked this · SDE2
TCS Hard Technical round 3-7 years

Your Java app's heap dump shows hundreds of thousands of HashMap$Entry objects. What are the likely causes?

↑ 15 upvotes · 33 engineers asked this · SDE2

Java / Core Java (2)

TCS Medium Screening round 1-3 years

Explain why String is immutable in Java. What problem would occur if String were mutable? Give a concrete security example.

↑ 30 upvotes · 8 engineers asked this · SDE1
TCS Medium Screening round 2-5 years

Explain differences between abstract class and interface in Java 8+. With default methods in interfaces, when would you still choose abstract class?

↑ 14 upvotes · 32 engineers asked this · SDE2

Java / Spring AOP (1)

TCS Medium Scenario round 3-6 years

You have a microservice with 50 REST endpoints built with Spring Boot. A new requirement says every request must log user ID, request ID, and duration. You cannot modify 50 controllers. How do you implement this?

↑ 31 upvotes · 9 engineers asked this · SDE2

Java / Hibernate (1)

TCS Hard Technical round 3-6 years

Your Java application uses Hibernate. You notice N+1 queries when loading a list of entities with a @OneToMany relationship. Fix this without changing the database schema.

↑ 32 upvotes · 10 engineers asked this · SDE2

Java / Generics (1)

TCS Medium Technical round 1-3 years

A developer uses List<Object> to store mixed types and casts on retrieval. What are the problems and how would you fix this with Java generics?

↑ 34 upvotes · 12 engineers asked this · SDE1

Python / Deployment (1)

TCS Hard Technical round 3-6 years

Your Python service runs in Docker. On developer machines (Mac M1) it works fine. In production (Linux x86) it crashes with a C extension error. What's happening and how do you fix it?

↑ 37 upvotes · 15 engineers asked this · SDE2

Python / Core Python (3)

TCS Medium Screening round 2-4 years

Explain the difference between deepcopy and shallow copy in Python. Give a scenario where using shallow copy caused a bug.

↑ 38 upvotes · 16 engineers asked this · SDE2
TCS Medium Screening round 1-3 years

Explain the difference between __repr__ and __str__. When is each called? Write a class where they return different things.

↑ 44 upvotes · 22 engineers asked this · SDE1
TCS Medium Technical round 2-4 years

What are Python generators and when would you use them over lists? Implement a Fibonacci generator.

↑ 43 upvotes · 11 engineers asked this · SDE2

SQL / Window Functions (4)

TCS Medium Technical round 1-4 years

Write a query to find the second highest salary from an employees table. What if there are multiple employees with the highest salary?

↑ 45 upvotes · 23 engineers asked this · SDE2
TCS Medium Screening round 2-5 years

Explain window functions with an example. How is RANK() different from DENSE_RANK() and ROW_NUMBER()?

↑ 49 upvotes · 27 engineers asked this · SDE2
TCS Medium Technical round 2-5 years

Write a SQL query to find the second highest salary from an Employees table without using LIMIT/TOP or subqueries.

↑ 7 upvotes · 5 engineers asked this · SDE2
TCS Medium Screening round 2-5 years

Explain the difference between RANK(), DENSE_RANK(), and ROW_NUMBER() window functions.

↑ 18 upvotes · 16 engineers asked this · SDE2

SQL / Set Operations (1)

TCS Easy Screening round 1-3 years

Explain the difference between UNION and UNION ALL. In what scenario does UNION ALL perform significantly better?

↑ 47 upvotes · 25 engineers asked this · SDE1

Security / CORS (1)

TCS Medium Screening round 2-5 years

Explain CORS. A developer disables CORS entirely with Access-Control-Allow-Origin: * on your API. Why is this a security risk for some endpoints?

↑ 76 upvotes · 4 engineers asked this · SDE2

TypeScript / Migration (1)

TCS Hard System Design round 4-8 years

You're migrating a large JavaScript codebase to TypeScript. You have 500 files. What's your migration strategy to avoid a big-bang rewrite?

↑ 7 upvotes · 15 engineers asked this · SDE2

Java / API Versioning (1)

TCS Hard System Design round 3-7 years

Your Spring Boot service exposes 50 REST endpoints. How do you implement versioning so old clients using /v1 still work while new clients use /v2?

↑ 15 upvotes · 23 engineers asked this · SDE2

Java / Spring Boot Internals (1)

TCS Hard Screening round 3-6 years

Explain Spring Boot auto-configuration. How does @ConditionalOnClass work? Write a scenario where it prevents a bean from being created.

↑ 16 upvotes · 24 engineers asked this · SDE2

Java / Scheduling (1)

TCS Hard Scenario round 3-6 years

Your Spring Boot app has 20 @Scheduled tasks. In a multi-instance deployment, all 10 instances run every scheduled task simultaneously, causing duplicate processing. How do you fix this?

↑ 17 upvotes · 25 engineers asked this · SDE2

Java / Spring Security (2)

TCS Hard Screening round 3-7 years

Explain Spring Security's filter chain. What's the order of filters and why does it matter?

↑ 18 upvotes · 26 engineers asked this · SDE2
TCS Hard System Design round 3-6 years

What is Spring Security's filter chain? How would you implement JWT authentication in it?

↑ 5 upvotes · 33 engineers asked this · SDE2

Java / Spring Core (1)

TCS Medium Screening round 2-5 years

What is Spring's ApplicationContext vs BeanFactory? When would you use BeanFactory?

↑ 20 upvotes · 28 engineers asked this · SDE2

Java / Spring MVC (1)

TCS Hard Scenario round 3-6 years

You have a @RestController that takes a large request body (100MB file upload). Server runs out of heap memory when multiple uploads happen simultaneously. Fix this.

↑ 21 upvotes · 29 engineers asked this · SDE2

Java / Spring Scopes (1)

TCS Hard Screening round 3-6 years

Explain what happens when Spring beans have different scopes: @Singleton depends on @Prototype. What's the problem and how do you fix it?

↑ 22 upvotes · 30 engineers asked this · SDE2

Java / Testing (1)

TCS Medium System Design round 3-6 years

Your microservice calls 5 external services. You want to test it in isolation without calling real services. How do you set up testing?

↑ 23 upvotes · 31 engineers asked this · SDE2

DSA / String (1)

TCS Medium Technical round 1-4 years

Implement a function to check if two strings are anagrams of each other. Then solve for: given a string and a pattern, find all anagram substrings.

↑ 32 upvotes · 40 engineers asked this · SDE2

DSA / Bit Manipulation (1)

TCS Easy Technical round 1-3 years

Implement a function to check if a number is a power of 2 without using loops or recursion.

↑ 41 upvotes · 49 engineers asked this · SDE1

Behavioral / Project Management (1)

TCS Hard HR round 3-8 years

You're asked to take over a project where the previous engineer left no documentation and the code is a mess. The deadline is in 3 weeks. How do you approach this?

↑ 50 upvotes · 8 engineers asked this · SDE2

Behavioral / Agile (1)

TCS Medium HR round 1-5 years

Scrum master asks for your estimate on a task. You have no idea how long it will take. Other team members are giving estimates confidently. What do you say?

↑ 53 upvotes · 11 engineers asked this · SDE2

React / Keys (1)

TCS Medium Screening round 2-5 years

Explain how React's key prop affects performance and correctness. Give an example where using array index as key causes a bug.

↑ 62 upvotes · 20 engineers asked this · SDE2

React / Framework Comparison (1)

TCS Medium System Design round 3-6 years

When would you choose React over Vue or Angular for a new project? What are the actual tradeoffs, not just marketing?

↑ 64 upvotes · 22 engineers asked this · SDE2

Node.js / Middleware (1)

TCS Medium Technical round 2-5 years

Your Express API has a middleware that measures response time. You notice async route handlers are reporting incorrect times (too short). Why?

↑ 69 upvotes · 27 engineers asked this · SDE2

Node.js / Clustering (1)

TCS Hard Technical round 3-6 years

Your Node.js app uses the 'cluster' module with 8 workers. A user's session is stored in memory. Requests from the same user hit different workers randomly. What breaks and how do you fix it?

↑ 71 upvotes · 29 engineers asked this · SDE2

SQL / MySQL Query Analysis (1)

TCS Hard Screening round 3-6 years

You run EXPLAIN on a query and see 'Using index condition' vs 'Using where'. What's the difference and which is better?

↑ 76 upvotes · 34 engineers asked this · SDE2

SQL / Data Types (1)

TCS Medium Screening round 2-5 years

Your database has a column with type VARCHAR(255) for email addresses. The column is indexed. Would changing it to VARCHAR(100) improve performance? What about TEXT?

↑ 78 upvotes · 36 engineers asked this · SDE2

React / Mobile Debugging (1)

TCS Hard Scenario round 3-6 years

Your React Native app gets a 1-star review: 'The app crashes every time I open it.' You cannot reproduce it. Logs show nothing. How do you debug this?

↑ 25 upvotes · 13 engineers asked this · SDE2

Behavioral / Team Collaboration (1)

TCS Medium HR round 1-5 years

You're mid-feature and your tech lead pushes a breaking API change to a shared internal library. Your branch is now broken. Team meeting in 2 hours. What do you do?

↑ 26 upvotes · 14 engineers asked this · SDE2

Java / Migration (1)

TCS Hard HR round 5-9 years

You're asked to estimate migrating a 10-year-old codebase from Java 8 to Java 17. Your manager wants the number by end of day. The codebase has 500,000 lines of code. What do you do?

↑ 29 upvotes · 17 engineers asked this · Staff

DevOps / Debugging (1)

TCS Medium Scenario round 2-6 years

Your API suddenly starts returning 404 for an endpoint that worked yesterday. No code was deployed. What do you investigate?

↑ 30 upvotes · 18 engineers asked this · SDE2

Performance / N+1 (1)

TCS Hard Scenario round 3-6 years

You're building a feature that requires reading from a database 1000 times per request (for each item in a list). Batching is not possible due to the library you must use. What do you do?

↑ 40 upvotes · 28 engineers asked this · SDE2

Redis / Operations (1)

TCS Hard Technical round 2-5 years

Your application uses Redis KEYS * command in production to list all cache keys. The application hangs for several seconds periodically. Why?

↑ 47 upvotes · 35 engineers asked this · SDE2

React / Routing (1)

TCS Medium Technical round 2-5 years

Your React app uses React Router. Users report the browser back button doesn't work after programmatic navigation. What are the likely causes?

↑ 81 upvotes · 19 engineers asked this · SDE2

React / Best Practices (1)

TCS Medium Screening round 2-5 years

What is React.StrictMode and what bugs does it help catch?

↑ 83 upvotes · 21 engineers asked this · SDE2

React / State (1)

TCS Medium Screening round 2-4 years

What happens to React component state when you conditionally render it: {show && <Counter />}. User clicks 3 times. show=false, then show=true. What's the counter value?

↑ 5 upvotes · 23 engineers asked this · SDE2

React / Modules (1)

TCS Easy Screening round 1-3 years

What is the difference between var _default_ = and named exports in React? What's the impact on tree shaking?

↑ 7 upvotes · 25 engineers asked this · SDE1

Java / Streams (1)

TCS Medium Technical round 2-5 years

Write a Java 8 Stream pipeline: filter employees earning >50K, group by department, compute average salary per department, sorted by average descending.

↑ 16 upvotes · 34 engineers asked this · SDE2

Java / Functional Programming (1)

TCS Medium Screening round 2-5 years

What are functional interfaces in Java 8? List the four main ones and their use cases.

↑ 17 upvotes · 35 engineers asked this · SDE2

Java / JVM (1)

TCS Hard Screening round 4-8 years

What is Java's ClassLoader hierarchy and when does it cause ClassCastException across classloaders?

↑ 20 upvotes · 38 engineers asked this · SDE2

Node.js / Modules (1)

TCS Medium Screening round 2-5 years

What is the difference between require() and ES module import in Node.js? What problems arise when mixing them?

↑ 25 upvotes · 43 engineers asked this · SDE2

Node.js / Security (1)

TCS Hard Technical round 2-5 years

A developer has written res.send(eval(req.body.expression)) in your Express app. What are all the problems?

↑ 28 upvotes · 46 engineers asked this · SDE2

Python / Advanced Python (1)

TCS Medium Technical round 2-5 years

Write a Python context manager for a database transaction that commits on success and rolls back on exception.

↑ 34 upvotes · 52 engineers asked this · SDE2

Python / Flask (1)

TCS Medium Technical round 2-5 years

Your Flask API crashes with 'RuntimeError: Working outside of application context.' When does this happen?

↑ 35 upvotes · 3 engineers asked this · SDE2

Python / Security (1)

TCS Medium Technical round 2-5 years

Your Python scraper fails with 'SSL: CERTIFICATE_VERIFY_FAILED'. A colleague suggests verify=False. Why is that dangerous and what's the correct fix?

↑ 39 upvotes · 7 engineers asked this · SDE2

Python / OOP (1)

TCS Medium Screening round 1-4 years

What is the difference between @staticmethod and @classmethod in Python? Give use cases for each.

↑ 41 upvotes · 9 engineers asked this · SDE2

DSA / Strings (2)

TCS Easy Technical round 1-3 years

Write a function that checks if two strings are anagrams of each other. Handle Unicode characters.

↑ 58 upvotes · 26 engineers asked this · SDE1
TCS Medium Technical round 2-5 years

Write a function to validate if a given string is a valid IP address (both IPv4 and IPv6).

↑ 30 upvotes · 38 engineers asked this · SDE2

DSA / Sorting (2)

TCS Medium Technical round 2-5 years

Implement merge sort and explain its advantages over quicksort.

↑ 60 upvotes · 28 engineers asked this · SDE2
TCS Medium Screening round 2-5 years

How does quicksort choose a pivot and what makes it O(n²) in the worst case?

↑ 31 upvotes · 39 engineers asked this · SDE2

Security / OWASP (1)

TCS Hard Screening round 3-7 years

Explain OWASP Top 10 in 2023. Pick 3 and explain how to defend against them with code examples.

↑ 70 upvotes · 38 engineers asked this · SDE2

Security / Access Control (1)

TCS Medium Technical round 2-5 years

A user reports they can see another user's data by changing the ID in the URL: /api/orders/123 → /api/orders/124. What vulnerability is this?

↑ 71 upvotes · 39 engineers asked this · SDE2

Security / Authentication (1)

TCS Medium Scenario round 2-5 years

Your application logs show someone is trying thousands of username/password combinations per second. How do you stop this?

↑ 72 upvotes · 40 engineers asked this · SDE2

Security / Transport Security (1)

TCS Medium Screening round 1-4 years

Explain what HTTPS does and does NOT protect against.

↑ 74 upvotes · 42 engineers asked this · SDE2

SQL / Joins (1)

TCS Easy Screening round 1-3 years

Explain the difference between INNER JOIN, LEFT JOIN, and FULL OUTER JOIN. When does the choice affect the result count?

↑ 8 upvotes · 6 engineers asked this · SDE1

SQL / Transactions (1)

TCS Medium Screening round 2-5 years

What are database transactions and ACID properties? Give a real example where violating each property causes data corruption.

↑ 9 upvotes · 7 engineers asked this · SDE2

SQL / Data Cleaning (1)

TCS Medium Technical round 2-5 years

Write a SQL query to detect duplicate rows in a table and delete all but one (keeping the one with the lowest ID).

↑ 12 upvotes · 10 engineers asked this · SDE2

SQL / Basics (1)

TCS Easy Screening round 1-3 years

What is the difference between WHERE and HAVING clauses? Can you use aggregate functions in WHERE?

↑ 17 upvotes · 15 engineers asked this · SDE1

MongoDB / Use Cases (1)

TCS Hard Screening round 3-6 years

Explain when you should NOT use MongoDB and should use a relational database instead.

↑ 51 upvotes · 49 engineers asked this · SDE2

MongoDB / Aggregation (1)

TCS Hard Technical round 3-6 years

What is a MongoDB aggregation pipeline? Write one that joins two collections and computes grouped statistics.

↑ 52 upvotes · 50 engineers asked this · SDE2

MongoDB / Data Modeling (1)

TCS Hard Screening round 3-6 years

How do you model a tree structure (category hierarchy) in MongoDB? Compare parent-reference, child-reference, and materialized path.

↑ 54 upvotes · 52 engineers asked this · SDE2

TypeScript / Types (1)

TCS Medium Screening round 2-5 years

What is the difference between TypeScript's interface and type alias? When would you use each?

↑ 56 upvotes · 4 engineers asked this · SDE2

TypeScript / Best Practices (1)

TCS Medium Screening round 2-5 years

Your TypeScript codebase has many 'as any' casts. A new developer says 'it's just to make the code compile.' What's the real cost?

↑ 58 upvotes · 6 engineers asked this · SDE2

Security / Auth (1)

TCS Medium Screening round 2-5 years

What is the difference between authentication and authorization? Give examples of getting each wrong.

↑ 63 upvotes · 11 engineers asked this · SDE2

Architecture / Design Principles (1)

TCS Medium Screening round 2-6 years

Explain the SOLID principles in software design. Give a real code example of violating Single Responsibility Principle.

↑ 65 upvotes · 13 engineers asked this · SDE2

React / Forms (1)

TCS Easy Screening round 1-3 years

What is the difference between controlled and uncontrolled components? When would you choose uncontrolled?

↑ 74 upvotes · 22 engineers asked this · SDE1

React / Context (1)

TCS Medium Screening round 2-5 years

Explain the React context API pattern for theming. What is the pitfall when the context value is an object?

↑ 76 upvotes · 24 engineers asked this · SDE2

React / Error Handling (1)

TCS Medium Screening round 2-5 years

What are Error Boundaries in React and why can't they catch errors in event handlers?

↑ 77 upvotes · 25 engineers asked this · SDE2

Java / Spring Cloud (1)

TCS Medium Screening round 3-6 years

Explain service discovery in microservices. How does Eureka work with Spring Cloud?

↑ 84 upvotes · 32 engineers asked this · SDE2

Java / Spring Batch (1)

TCS Hard Screening round 4-7 years

What is Spring Batch? How does it handle restartable jobs that fail midway through processing 1 million records?

↑ 7 upvotes · 35 engineers asked this · SDE2

Java / Database (1)

TCS Hard Screening round 3-6 years

Explain how Spring Boot handles connection pooling with HikariCP. What happens when the pool is exhausted?

↑ 8 upvotes · 36 engineers asked this · SDE2

Web / Real-time (1)

TCS Medium Screening round 3-6 years

Explain the difference between long-polling, WebSocket, and Server-Sent Events (SSE) for real-time features.

↑ 33 upvotes · 11 engineers asked this · SDE2

Behavioral / Business Analysis (1)

TCS Medium HR round 1-5 years

You're a new BA joining a project that's 6 months in. How do you quickly get up to speed without disrupting the team?

↑ 66 upvotes · 44 engineers asked this · SDE2

Business Analysis / Requirements (2)

TCS Medium Screening round 1-4 years

Explain the difference between functional and non-functional requirements. Give 5 examples of each for a banking application.

↑ 67 upvotes · 45 engineers asked this · SDE2
TCS Hard HR round 2-5 years

A stakeholder shows you conflicting requirements from two different business units. How do you resolve this?

↑ 71 upvotes · 49 engineers asked this · SDE2

Business Analysis / Requirements Gathering (1)

TCS Hard HR round 2-5 years

You're gathering requirements for a new feature. The client says 'I want something like Amazon's recommendation system.' How do you handle this vague requirement?

↑ 68 upvotes · 46 engineers asked this · SDE2

Business Analysis / Analysis (1)

TCS Medium Screening round 2-5 years

What is a gap analysis and how would you conduct one for a company migrating from an old CRM to Salesforce?

↑ 69 upvotes · 47 engineers asked this · SDE2

Business Analysis / Documentation (1)

TCS Easy Screening round 1-3 years

Explain the difference between a use case diagram and a user story. When would you use each?

↑ 70 upvotes · 48 engineers asked this · SDE1

Web / Security (1)

TCS Medium Screening round 2-5 years

What is CORS and why can't you just 'fix' it by disabling the check in the browser?

↑ 74 upvotes · 52 engineers asked this · SDE2

React / DOM (1)

TCS Medium Screening round 2-5 years

What are React portals and when do you need them?

↑ 12 upvotes · 20 engineers asked this · SDE2

Security / SQL Injection (1)

TCS Medium Scenario round 1-4 years

What is SQL injection and how do you prevent it in a Python Flask app that takes user search input?

↑ 22 upvotes · 30 engineers asked this · SDE2

Security / Web Security (1)

TCS Medium Screening round 2-5 years

How do you prevent clickjacking and what is the X-Frame-Options header?

↑ 26 upvotes · 34 engineers asked this · SDE2

DSA / Graph (1)

TCS Medium Screening round 2-5 years

What is the difference between DFS and BFS? When does each find the optimal solution?

↑ 28 upvotes · 36 engineers asked this · SDE2

DSA / Data Structures (1)

TCS Medium Screening round 2-5 years

Explain the time and space complexity of hash table operations. What happens when load factor is too high?

↑ 29 upvotes · 37 engineers asked this · SDE2

Java / Modern Java (1)

TCS Easy Screening round 2-5 years

Explain Java records (Java 16+). What problems do they solve compared to regular classes?

↑ 33 upvotes · 41 engineers asked this · SDE2

Java / Collections (1)

TCS Easy Screening round 1-3 years

What is the difference between ArrayList and LinkedList performance? When would you ever choose LinkedList?

↑ 36 upvotes · 44 engineers asked this · SDE1

Architecture / REST API (1)

TCS Easy Screening round 1-4 years

A developer asks: 'Should I use PUT or PATCH for updating a resource?' What's the correct answer?

↑ 42 upvotes · 50 engineers asked this · SDE2

Practice these questions with AI feedback

Get instant grading on your answers, identify your weak areas, and generate a personalised 14-day study plan — all free.

Build my study plan →

TCS interview guides by role

TCS SDE2 Guide TCS SDE1 Guide

TCS questions by technology

TCS Java TCS Spring Boot

More companies

Amazon Google Microsoft Flipkart Swiggy Meta Apple Netflix Uber Airbnb Stripe Razorpay PhonePe Paytm Zomato Salesforce Oracle Adobe LinkedIn Atlassian Accenture Deloitte Wipro Infosys Capgemini PayU General Anthropic OpenAI TikTok JPMorgan Walmart Spotify DoorDash Goldman Sachs Revolut Canva Capital One Lyft SAP Siemens Shopify Grab Cognizant LTIMindtree Myntra Hotstar Twitter Snowflake

Frequently asked questions

Explain the difference between HashMap and ConcurrentHashMap in Java. When would you use each? Describe segment locking in Java 7 vs the CAS-based approach in Java 8+, and why you should never use HashMap in a multi-threaded context.
Explain the difference between HashMap and ConcurrentHashMap in Java. When would you use each? Describe segment locking in Java 7 vs the CAS-based approach in Java 8+, and why you should never use HashMap in a multi-threaded context.
How do you handle transactions in Spring Boot? Explain the @Transactional annotation, propagation levels (REQUIRED, REQUIRES_NEW, NESTED), isolation levels, and how Spring proxies intercept methods — including why self-invocation bypasses the proxy.
How do you handle transactions in Spring Boot? Explain the @Transactional annotation, propagation levels (REQUIRED, REQUIRES_NEW, NESTED), isolation levels, and how Spring proxies intercept methods — including why self-invocation bypasses the proxy.
Design a REST API for an e-commerce cart system. Define the endpoints (add item, remove item, get cart, checkout), explain authentication with JWT, handle race conditions on inventory, and discuss idempotency for the checkout endpoint.
Design a REST API for an e-commerce cart system. Define the endpoints (add item, remove item, get cart, checkout), explain authentication with JWT, handle race conditions on inventory, and discuss idempotency for the checkout endpoint.
What is the difference between fail-fast and fail-safe iterators in Java Collections? Give examples of collections that use each, explain the ConcurrentModificationException, and show how to safely remove elements during iteration.
What is the difference between fail-fast and fail-safe iterators in Java Collections? Give examples of collections that use each, explain the ConcurrentModificationException, and show how to safely remove elements during iteration.
Write a SQL query to find the second highest salary from an Employee table. Show at least two approaches: using LIMIT/OFFSET, using a subquery with MAX, and using DENSE_RANK(). Discuss which is most efficient and why.
Write a SQL query to find the second highest salary from an Employee table. Show at least two approaches: using LIMIT/OFFSET, using a subquery with MAX, and using DENSE_RANK(). Discuss which is most efficient and why.