TCS Java Full Stack with React Interview Questions & Answers
Curated interview practice questions with answers. These are practice scenarios, not a verified list of past interview questions.
About TCS hiring for Java Full Stack with React roles
Tata Consultancy Services is a Tata Group company and one of the largest IT services and consulting firms in the world. It delivers application development, testing, cloud, data and analytics services to clients in banking, retail, manufacturing and other industries. In India it hires freshers and experienced staff for software testing, data engineering, BI reporting and analytics roles across its delivery centres.
For Java Full Stack with React roles, this TCS practice set focuses most on Core Java (6), React Frontend (5), Collections and Streams (5), SQL and Databases (4). It has 15 easy, 14 medium, 1 hard questions, so you can start easy and work up to the harder ones.
Company type
IT services
Headquarters
Mumbai, India
Main India offices
Mumbai, Chennai, Pune, Bengaluru, Hyderabad
TCS Java Full Stack with React interview process
TCS NQT online assessment (aptitude + coding)
Technical interview
Managerial round
HR round
Typical pattern based on public candidate experiences. Rounds vary by role, team and year.
Solved for TCSStart practicing
3 QUESTIONS FREESign up to unlock the full question bank and track your progress.Unlock every question and answer, then continue practising company-wise and package-wise.
✓ 3 questions free • Unlock the rest in seconds
01
What is Spring Boot and how is it different from the Spring Framework?
Spring Framework provides dependency injection, MVC, data access and transactions, but traditionally needed a lot of manual configuration and an external server. Spring Boot sits on top of Spring and adds auto-configuration, starter dependencies, an embedded Tomcat, Jetty or Undertow server, externalised configuration and production features like Actuator. You can run an application as a single executable jar with java -jar, which makes it ideal for microservices and containers.
02
How do indexes improve performance, and when can they hurt?
An index, usually a B-tree, lets the database find rows without scanning the whole table, which speeds up WHERE, JOIN and ORDER BY on indexed columns. Indexes cost disk space and slow down INSERT, UPDATE and DELETE because each index must also be updated. They help little on low-selectivity columns like a boolean flag. Functions on the column, such as WHERE LOWER(email) = ?, or a leading wildcard in LIKE also prevent normal index use.
Window functions compute a value over a set of related rows while keeping every row in the result, unlike GROUP BY which collapses rows into one per group. They use the OVER clause with optional PARTITION BY and ORDER BY. Examples are ROW_NUMBER, RANK, DENSE_RANK, LAG, LEAD and running SUM. For instance, you can show each employee with their department's average salary in the same row.
Once created, a String object cannot change. This allows the String pool to safely share literals, makes strings thread-safe without locking, lets hashCode be cached for fast HashMap keys, and protects security-sensitive values like file paths, class names and URLs from being changed after validation. Any operation such as concat or replace returns a new String, which is why heavy modification should use StringBuilder.
07
Why do you want to become a Java full stack developer?
I enjoy building a feature end to end, from the database table to the screen the user clicks. Java and Spring Boot are used widely in Indian banking, product and services companies, so the skills stay in demand, and React lets me build modern interfaces. In my capstone project I built an inventory app with Spring Boot, MySQL and React, and owning the full flow taught me how each layer affects the user experience.
08
When should you use parallel streams and when should you avoid them?
Parallel streams split work across the common ForkJoinPool. They help for CPU-heavy, stateless operations on large in-memory data with cheap splitting, such as ArrayList or arrays. Avoid them for small lists, I/O or database calls, operations with shared mutable state, or inside web servers where the common pool is shared by all requests. Always measure with JMH or real load before and after, because overhead often makes them slower.
09
What is the difference between controlled and uncontrolled components?
In a controlled component, form input values live in React state and change through onChange, so React is the single source of truth, which makes validation and conditional UI easy. In an uncontrolled component, the DOM keeps the value and you read it through a ref when needed, which needs less code and suits simple forms or file inputs. Libraries like React Hook Form use uncontrolled inputs for better performance in large forms.
10
What is the difference between authentication and authorization?
Authentication verifies who the user is, for example by checking a password, OTP or token. Authorization decides what that authenticated user is allowed to do, for example only admins can delete products. In Spring Security, authentication produces an Authentication object with granted authorities, and authorization uses those authorities in URL rules or annotations like @PreAuthorize("hasRole('ADMIN')"). A failed authentication gives 401 and a failed authorization gives 403.
11
Compare monolithic and microservices architecture.
A monolith is one deployable application. It is simpler to build, test and debug, and suits small teams and early products. Microservices split the system into independently deployable services owned by separate teams, such as orders, payments and inventory, each with its own database. They allow independent scaling and releases but add network latency, distributed data, monitoring and deployment complexity. Many teams start with a modular monolith and split only when needed.
ArrayList is backed by a resizable array, giving O(1) random access and good cache locality, and appending is amortised O(1). LinkedList is a doubly linked list with O(1) insertion at known nodes but O(n) access by index and more memory per element. In practice ArrayList is faster for almost all workloads. For queue or stack behaviour, ArrayDeque is usually better than LinkedList.
A promise represents a value that will be available later, handled with then, catch and finally. async/await is syntax built on promises: an async function always returns a promise, and await pauses that function until the promise settles, so asynchronous code reads like synchronous code. Errors are handled with try/catch. Awaiting calls one by one is sequential, so use Promise.all for independent calls to run them in parallel.
14
Using streams, group employees by department and count them.
Map<String, Long> countByDept = employees.stream()
.collect(Collectors.groupingBy(
Employee::getDepartment,
Collectors.counting()));
// Average salary per department:
Map<String, Double> avgSalary = employees.stream()
.collect(Collectors.groupingBy(
Employee::getDepartment,
Collectors.averagingDouble(Employee::getSalary)));
// Use TreeMap::new as the second argument to get sorted keys.
15
How do derived query methods work in Spring Data JPA?
Spring Data parses the method name in a repository interface and builds the query. For example, findByEmailAndActiveTrue(String email) or findTop5ByCategoryOrderByPriceDesc(String category). Supported keywords include And, Or, Between, LessThan, Like, In, IsNull and OrderBy. Return types can be Optional, List, Page or Stream. For complex logic, use @Query with JPQL or native SQL, because very long method names become hard to read.
16
What is the difference between checked and unchecked exceptions?
Checked exceptions extend Exception (but not RuntimeException) and must be caught or declared with throws, for example IOException or SQLException. Unchecked exceptions extend RuntimeException, such as NullPointerException or IllegalArgumentException, and the compiler does not force handling. Use checked exceptions for recoverable conditions the caller should handle, and unchecked ones for programming errors. Spring prefers unchecked exceptions, for example DataAccessException, to keep service code clean.
The heap stores objects and is shared by all threads; it is managed by the garbage collector and split into young and old generations. Each thread has its own stack holding method frames, local variables and references. Metaspace, in native memory since Java 8, stores class metadata. There is also the program counter per thread and the code cache for JIT-compiled code. Stack overflow comes from deep recursion, while OutOfMemoryError usually means heap or metaspace is full.
18
How do you store user passwords securely in Spring Boot? Show the code.
@Bean
PasswordEncoder passwordEncoder() {
return new BCryptPasswordEncoder(12);
}
public void register(RegisterRequest req) {
User user = new User(req.email(), encoder.encode(req.password()));
userRepository.save(user);
}
public boolean checkLogin(String raw, User user) {
return encoder.matches(raw, user.getPasswordHash());
}
// BCrypt adds a random salt and is deliberately slow.
// Never store plain text or use MD5/SHA-1 for passwords.
19
After calling setCount(count + 1), console.log(count) still shows the old value. Why?
State updates are scheduled, not applied immediately. The count variable in the current render is a constant snapshot, so logging right after setState shows the old value; the new value appears in the next render. React also batches multiple updates. When the next state depends on the previous one, use the updater form setCount(c => c + 1), which works correctly even when called several times. Use useEffect to react to the updated value.
A List is an ordered collection that allows duplicates and index access, such as ArrayList. A Set holds unique elements; HashSet has no order, LinkedHashSet keeps insertion order and TreeSet keeps elements sorted. A Map stores key-value pairs with unique keys, such as HashMap or TreeMap, and is not part of the Collection interface. Choose based on whether you need duplicates, ordering or lookup by key.
21
Create a scheduled job that runs every night at 2 AM in Spring Boot.
@SpringBootApplication
@EnableScheduling
public class App { }
@Component
public class CleanupJob {
private final SessionRepository repo;
public CleanupJob(SessionRepository repo) { this.repo = repo; }
@Scheduled(cron = "0 0 2 * * *", zone = "Asia/Kolkata")
public void removeExpiredSessions() {
repo.deleteByExpiresAtBefore(Instant.now());
}
}
// With several instances, use ShedLock so only one runs the job.
22
You need a thread-safe singleton for a configuration loader. How do you implement it?
The simplest safe options are an enum singleton or the holder idiom. With the holder idiom, a private static nested class holds the instance, and the JVM's class loading guarantees lazy, thread-safe initialisation without synchronization. Double-checked locking also works but needs a volatile field. In a Spring application you usually do not write singletons at all, because beans are singleton-scoped by default and the container manages them.
String is immutable, so every change creates a new object. StringBuilder is mutable and fast but not thread-safe, which makes it the default choice for building strings inside a method or loop. StringBuffer is mutable and synchronized, so it is thread-safe but slower, and it is rarely needed today because strings are seldom shared across threads while being built. The compiler already uses optimized concatenation for simple + expressions outside loops.
24
What is a custom hook and why would you write one?
A custom hook is a function whose name starts with use and which calls other hooks, letting you reuse stateful logic across components. Examples are useFetch for loading data, useDebounce for search input and useAuth for the current user. Each component calling the hook gets its own independent state. Custom hooks keep components focused on rendering and make logic easier to test, much like extracting a service in backend code.
25
Write a basic CRUD REST controller in Spring Boot.
SELECT department_id, name, salary
FROM (
SELECT department_id, name, salary,
DENSE_RANK() OVER (
PARTITION BY department_id
ORDER BY salary DESC) AS rnk
FROM employees
) ranked
WHERE rnk <= 3
ORDER BY department_id, rnk;
-- DENSE_RANK keeps ties; use ROW_NUMBER for exactly 3 rows.
WHERE filters individual rows before grouping and cannot use aggregate functions. HAVING filters groups after GROUP BY and can use aggregates like COUNT or SUM. For example, SELECT dept, COUNT(*) FROM employees WHERE active = true GROUP BY dept HAVING COUNT(*) > 10. Put conditions in WHERE whenever possible because filtering earlier reduces the rows the database must group.
I built a job portal using React with Vite, Spring Boot 3, Spring Security with JWT and MySQL. Recruiters could post jobs and candidates could apply and track status. I designed the REST APIs, implemented role-based access, added pagination and search, and used TanStack Query on the frontend. I deployed it with Docker and a CI pipeline. The hardest part was file upload for resumes, which I solved with pre-signed object storage URLs.
30
What is the N+1 select problem and how do you solve it?
It happens when one query loads N parent rows and then each lazy association fires a separate query, giving N+1 queries. For example, listing 100 orders and calling getCustomer on each. Solve it with JOIN FETCH in JPQL, @EntityGraph on the repository method, batch fetching with hibernate.default_batch_fetch_size, or DTO projections that select only the needed columns. Enable SQL logging or a statistics tool in development to catch it early.
Tips to crack the TCS Java Full Stack with React interview
Practise TCS NQT style numerical, verbal and reasoning sections along with two basic coding problems under strict time limits.
Be ready to explain your final-year project, SQL basics and core concepts like OOP, DBMS and software testing life cycle.
Read about TCS service lines such as BFSI and its iON and Ignio platforms to answer why you want to join.
Keep a one-minute story ready for every project on your CV: problem, your part, tools, result.
Practise the hard questions on this page aloud; TCS interviewers usually ask follow-ups on your first answer.
Frequently asked questions
How many rounds are there in the TCS Java Full Stack with React interview?
Candidates usually go through 4 stages: TCS NQT online assessment (aptitude + coding); Technical interview; Managerial round; HR round. The exact rounds change with the role, team, location and your experience, so confirm the process with the recruiter.
Which topics should I prepare for the TCS Java Full Stack with React interview?
This practice set leans on Core Java (6), React Frontend (5), Collections and Streams (5), SQL and Databases (4). Revise those first, then practise explaining one or two of your own projects end to end, because most TCS interviewers ask you to walk through real work.
Are these the exact questions asked at TCS?
No. These are curated practice questions that match the skills and difficulty usually tested in it services interviews like TCS's. They are not a leaked or verified list of past questions.
Where does TCS hire Java Full Stack with React professionals in India?
TCS has large teams in Mumbai, Chennai, Pune, Bengaluru, Hyderabad. Openings and locations change often, so check the TCS careers page and filter by city and experience.
Java Full Stack with React questions for similar companies