Skip to content

Java Full Stack with React Interview Questions in Coimbatore

36 practice questions with answers for Java Full Stack with React interviews in Coimbatore.

Java Full Stack with React jobs in Coimbatore

Coimbatore has a growing IT-services and engineering-services market around TIDEL Park and its SEZs, supported by a large pool of engineering graduates. Many roles are with delivery centres of bigger IT firms.

Below are 36 questions that match the mix of service, product and domain employers hiring java full stack developers in Coimbatore.

Solved for CoimbatoreStart 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

Write a reusable useFetch custom hook.

Save to ▾
Show answer
export function useFetch(url) { const [state, setState] = useState({ data: null, loading: true, error: null }); useEffect(() => { let ignore = false; setState(s => ({ ...s, loading: true })); fetch(url) .then(r => r.ok ? r.json() : Promise.reject(new Error(r.statusText))) .then(data => { if (!ignore) setState({ data, loading: false, error: null }); }) .catch(error => { if (!ignore) setState({ data: null, loading: false, error }); }); return () => { ignore = true; }; }, [url]); return state; } // Usage: const { data, loading, error } = useFetch(`/api/orders/${id}`);
02

What are the options for spring.jpa.hibernate.ddl-auto and which should be used in production?

Save to ▾
Show answer
none does nothing, validate checks that the schema matches entities, update alters tables to add missing columns, create drops and recreates the schema at startup and create-drop also drops it at shutdown. update and create are fine for learning but risky in production because they cannot handle renames or data migrations safely. In production use validate or none, and manage schema changes with Flyway or Liquibase scripts.
03

When should you use useMemo and useCallback?

Save to ▾
Show answer
useMemo caches the result of an expensive calculation until its dependencies change, such as filtering and sorting a big list. useCallback caches a function reference, which matters when passing callbacks to children wrapped in React.memo or used in effect dependencies. Do not wrap everything, because memoization itself has a cost. The React Compiler, released as stable in 2025, can add much of this memoization automatically in supported projects.
04

Implement pagination and sorting for a product list API.

Save to ▾
Show answer
@GetMapping("/api/products") public Page<ProductDto> list( @RequestParam(defaultValue = "0") int page, @RequestParam(defaultValue = "20") int size, @RequestParam(defaultValue = "price") String sort) { Pageable pageable = PageRequest.of(page, Math.min(size, 100), Sort.by(sort).ascending()); return repository.findByActiveTrue(pageable).map(ProductDto::from); } // Repository: Page<Product> findByActiveTrue(Pageable pageable);
05

What is Spring Boot Actuator used for?

Save to ▾
Show answer
Actuator adds production-ready endpoints for monitoring and management, such as /actuator/health, /actuator/info, /actuator/metrics and /actuator/prometheus. Kubernetes uses health liveness and readiness groups for probes. Metrics are collected through Micrometer and can be exported to Prometheus, Datadog or other systems. Only expose the endpoints you need with management.endpoints.web.exposure.include and secure them, because endpoints like env or heapdump can leak sensitive data.
06

You are designing a new feature. When would you choose a relational database and when a NoSQL database?

Save to ▾
Show answer
Choose a relational database like PostgreSQL or MySQL when data is structured, relationships matter and you need transactions and joins, such as orders, payments and inventory. Choose NoSQL when you need a flexible schema or huge horizontal scale for simple access patterns: MongoDB for documents, Redis for caching and sessions, Cassandra for high-write time series and Elasticsearch for search. Many systems use both, with SQL as the source of truth.
07

What is a closure in JavaScript? Give a practical use.

Save to ▾
Show answer
A closure is a function that remembers variables from the scope where it was created, even after that outer function has returned. For example, function counter() { let n = 0; return () => ++n; } returns a function that keeps its own private n. Closures are used for data privacy, function factories, event handlers, debounce and memoization, and React hooks rely on them. Stale closures in effects are a common bug when dependencies are missing.
08

Sort a list of products by category, then by price descending, then by name.

Save to ▾
Show answer
products.sort( Comparator.comparing(Product::getCategory) .thenComparing(Product::getPrice, Comparator.reverseOrder()) .thenComparing(Product::getName)); // Null-safe variant for an optional field: Comparator<Product> byBrand = Comparator.comparing( Product::getBrand, Comparator.nullsLast(Comparator.naturalOrder()));
09

Returning an entity from a REST API causes infinite recursion in JSON. Why, and how do you fix it?

Save to ▾
Show answer
Bidirectional relationships, such as Order having items and each item referencing its order, make Jackson serialise back and forth endlessly, leading to StackOverflowError. The cleanest fix is to return DTOs instead of entities, so you control exactly what is exposed. Quick fixes include @JsonManagedReference with @JsonBackReference or @JsonIgnore on one side. DTOs also stop lazy loading during serialisation and avoid leaking internal fields.
10

Write a query that shows daily sales with a running total for the month.

Save to ▾
Show answer
SELECT order_date, SUM(amount) AS daily_sales, SUM(SUM(amount)) OVER ( ORDER BY order_date ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) AS running_total FROM orders WHERE order_date >= DATE '2026-10-01' AND order_date < DATE '2026-11-01' GROUP BY order_date ORDER BY order_date;
11

Explain the difference between map and flatMap in streams.

Save to ▾
Show answer
map transforms each element into exactly one new element, so a Stream of orders mapped to customer names gives a Stream of String. flatMap transforms each element into a stream and flattens all of them into one stream. For example, orders.stream().flatMap(o -> o.getItems().stream()) gives every item from every order. Optional also has map and flatMap with the same idea.
12

What are the correct and incorrect ways to use Optional?

Save to ▾
Show answer
Use Optional as a return type when a value may be absent, and consume it with map, filter, orElse, orElseGet or orElseThrow. Avoid calling get() without checking, avoid Optional fields in entities or DTOs, avoid Optional parameters and never return null from a method that returns Optional. Prefer orElseGet over orElse when the default is expensive, because orElse always evaluates its argument.
13

Describe a time you disagreed with a teammate during a code review.

Save to ▾
Show answer
Situation: a teammate used nested loops over two large lists to match records. Task: I felt it would be slow at production volume. Action: instead of just rejecting it, I wrote a quick benchmark showing the HashMap-based approach was much faster, and explained it calmly in a call. Result: he agreed, we merged the faster version, and we added a team guideline to back performance comments with data.
14

What causes LazyInitializationException and how do you fix it properly?

Save to ▾
Show answer
It occurs when a lazy association is accessed after the persistence context has closed, for example in a controller or during JSON serialisation outside the transaction. The proper fix is to fetch the data inside the service transaction using JOIN FETCH or @EntityGraph and map it to a DTO. Avoid enabling spring.jpa.open-in-view as a crutch, and avoid switching associations to eager, because both hide performance problems.
15

What is the difference between lazy and eager fetching?

Save to ▾
Show answer
Lazy fetching loads an association only when it is first accessed, using a proxy. Eager fetching loads it immediately with the parent. By default, @OneToMany and @ManyToMany are lazy, while @ManyToOne and @OneToOne are eager. Best practice is to make all associations lazy and fetch what each use case needs with JOIN FETCH or entity graphs, because eager loading often pulls large object graphs and causes extra queries.
16

Write a query to find duplicate email addresses in a users table and delete the extra rows.

Save to ▾
Show answer
-- Find duplicates SELECT email, COUNT(*) AS cnt FROM users GROUP BY email HAVING COUNT(*) > 1; -- Keep the lowest id, delete the rest (MySQL / PostgreSQL) DELETE FROM users u USING users k WHERE u.email = k.email AND u.id > k.id; -- PostgreSQL syntax -- Then add: ALTER TABLE users ADD CONSTRAINT ux_email UNIQUE (email);
17

What does the static keyword mean in Java?

Save to ▾
Show answer
static members belong to the class, not to an instance. A static variable has one copy shared by all objects, a static method can be called without creating an object and cannot use this, and a static block runs once when the class loads. Static nested classes do not hold a reference to the outer object. Common examples are utility methods like Math.max and constants declared as public static final.
18

Write a repository query that loads orders with their items in one query.

Save to ▾
Show answer
public interface OrderRepository extends JpaRepository<Order, Long> { @Query(""" select distinct o from Order o join fetch o.items i where o.customer.id = :customerId """) List<Order> findWithItems(@Param("customerId") Long customerId); @EntityGraph(attributePaths = {"items", "customer"}) Optional<Order> findWithGraphById(Long id); }
19

Write global exception handling for a REST API in Spring Boot.

Save to ▾
Show answer
@RestControllerAdvice public class GlobalExceptionHandler { @ExceptionHandler(ResourceNotFoundException.class) public ProblemDetail handleNotFound(ResourceNotFoundException ex) { return ProblemDetail.forStatusAndDetail(HttpStatus.NOT_FOUND, ex.getMessage()); } @ExceptionHandler(MethodArgumentNotValidException.class) public ProblemDetail handleValidation(MethodArgumentNotValidException ex) { ProblemDetail pd = ProblemDetail.forStatus(HttpStatus.BAD_REQUEST); pd.setProperty("errors", ex.getBindingResult().getFieldErrors() .stream().map(e -> e.getField() + ": " + e.getDefaultMessage()).toList()); return pd; } }
20

What is the difference between controlled and uncontrolled components?

Save to ▾
Show answer
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.
21

What is the biggest full stack project you have built?

Save to ▾
Show answer
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.
22

How do you handle a Git merge conflict when working in a team?

Save to ▾
Show answer
Situation: two of us edited the same service class in parallel branches. Task: merge without losing either change. Action: I pulled the latest main, rebased my branch, opened the conflicted files and resolved them together with my teammate on a quick call, then ran all tests before pushing. Result: the merge was clean. To reduce conflicts, we now keep branches short-lived and pull from main daily.
23

After calling setCount(count + 1), console.log(count) still shows the old value. Why?

Save to ▾
Show answer
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.
24

What is the difference between == and equals() in Java?

Save to ▾
Show answer
The == operator compares references for objects, meaning it checks whether two variables point to the same object in memory. equals() compares logical content when a class overrides it, as String, Integer and most collections do. For example, new String("a") == new String("a") is false but equals() returns true. For primitives, == compares values. Always use equals() for objects and Objects.equals(a, b) to stay null-safe.
25

What bean scopes does Spring support?

Save to ▾
Show answer
singleton is the default: one instance per application context. prototype creates a new instance every time the bean is requested. Web applications also have request, session and application scopes, and websocket scope. Singleton beans must be stateless or thread-safe because many requests share them. If a singleton needs a prototype or request-scoped bean, inject an ObjectProvider or use a scoped proxy so each use gets the correct instance.
26

A search query that used to take milliseconds now takes 10 seconds as data grew. How do you troubleshoot?

Save to ▾
Show answer
Get the exact SQL from logs or the slow query log and run EXPLAIN ANALYZE to see whether it does a full scan, a bad join order or a big sort. Check for missing or unused indexes, functions on indexed columns, implicit type conversions and outdated statistics. Add the right composite index, rewrite the query, select fewer columns and paginate. For text search, use a full-text index or a search engine instead of LIKE '%term%'.
27

Users in different countries see wrong order times. How do you handle dates and time zones in Java?

Core JavaMedium
Save to ▾
Show answer
Store timestamps in UTC using Instant or OffsetDateTime, and map them to TIMESTAMP WITH TIME ZONE or a UTC timestamp column. Convert to the user's zone only when displaying, using ZonedDateTime with ZoneId such as Asia/Kolkata. Avoid java.util.Date and SimpleDateFormat, which are mutable and not thread-safe. Use DateTimeFormatter, send ISO-8601 strings in JSON and set hibernate.jdbc.time_zone to UTC.
28

What changed when moving from Spring Boot 2 to Spring Boot 3?

Save to ▾
Show answer
Spring Boot 3 requires Java 17 or later and is built on Spring Framework 6. The biggest migration task is the switch from javax.* to jakarta.* packages for persistence, validation and servlet APIs. Spring Security 6 removed WebSecurityConfigurerAdapter in favour of SecurityFilterChain beans. Boot 3 also supports GraalVM native images, Micrometer observation and tracing, and from 3.2 the RestClient and virtual thread support.
29

Write code that runs tasks in parallel using ExecutorService and collects results.

Core JavaMedium
Save to ▾
Show answer
ExecutorService pool = Executors.newFixedThreadPool(4); try { List<Callable<Integer>> tasks = List.of( () -> fetchCount("orders"), () -> fetchCount("users")); List<Future<Integer>> results = pool.invokeAll(tasks); for (Future<Integer> f : results) { System.out.println(f.get()); } } finally { pool.shutdown(); } // On Java 21 you can use Executors.newVirtualThreadPerTaskExecutor() // for I/O-bound tasks.
30

What is the difference between checked and unchecked exceptions?

Save to ▾
Show answer
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.
31

Add request validation to a registration API.

Save to ▾
Show answer
public record RegisterRequest( @NotBlank @Size(max = 60) String name, @NotBlank @Email String email, @Pattern(regexp = "^[6-9]\\d{9}$", message = "Invalid mobile") String mobile, @Size(min = 8, max = 64) String password) {} @PostMapping("/api/auth/register") public ResponseEntity<Void> register(@Valid @RequestBody RegisterRequest req) { authService.register(req); return ResponseEntity.status(HttpStatus.CREATED).build(); } // Needs spring-boot-starter-validation. Errors raise // MethodArgumentNotValidException, mapped to 400 by the advice.
32

Your code has frequent NullPointerExceptions from repository lookups. How would you redesign it?

Core JavaMedium
Save to ▾
Show answer
Return Optional from lookup methods so callers must handle the missing case, for example findById(id).orElseThrow(). Validate inputs at the API boundary with Bean Validation, initialise collections to empty lists instead of null and use Objects.requireNonNull in constructors. Java 17 helpful NPE messages show which variable was null, which speeds debugging. Do not use Optional for fields or method parameters; it is meant for return values.
33

Write a record and use pattern matching in a switch expression.

Core JavaMedium
Save to ▾
Show answer
sealed interface Payment permits Card, Upi {} record Card(String number, double amount) implements Payment {} record Upi(String vpa, double amount) implements Payment {} static String describe(Payment p) { return switch (p) { case Card c when c.amount() > 50000 -> "High value card"; case Card c -> "Card ending " + c.number().substring(12); case Upi u -> "UPI to " + u.vpa(); }; } // Sealed types make the switch exhaustive without a default branch (Java 21).
34

Why should we hire you as a Java full stack developer?

Save to ▾
Show answer
I can contribute on both sides of a feature: I have built REST APIs with Spring Boot, JPA and MySQL, and responsive React screens that consume them. I write tests, use Git properly and have deployed my projects with Docker. I also learn quickly; I picked up Spring Security and JWT for my capstone in two weeks. I am looking for a team where I can grow into an engineer who owns features from design to production.
35

Database passwords and API keys are committed in application.properties. How do you fix this?

Save to ▾
Show answer
Remove the secrets from the repository, rotate the exposed credentials immediately, and clean the history if needed. Replace values with placeholders such as ${DB_PASSWORD} and supply them through environment variables, Kubernetes Secrets or a vault like HashiCorp Vault or a cloud secrets manager. Add a pre-commit secret scanner, keep local values in an ignored file, and give each environment its own credentials with least privilege.
36

Your application logs show database deadlock errors during peak hours. How do you resolve them?

Save to ▾
Show answer
A deadlock happens when two transactions lock rows in opposite order and wait for each other; the database kills one. Read the deadlock report, such as SHOW ENGINE INNODB STATUS, to find the statements. Fix by updating rows in a consistent order, keeping transactions short, avoiding user interaction or remote calls inside transactions and adding indexes so updates lock fewer rows. Also add a retry for the deadlock error because occasional ones are normal.

Few big employers listed in Coimbatore?

Many Coimbatore candidates also apply to teams in Chennai and to remote or hybrid roles. Practise the Chennai set as well.

Frequently asked questions

Which companies hire Java Full Stack with React professionals in Coimbatore?

Companies with large offices in Coimbatore include many IT services and product firms. Use their company pages below to practise employer-specific sets.

Are Java Full Stack with React interviews in Coimbatore different from other cities?

The questions depend more on the company than the city. Coimbatore's mix of employers decides the style: Many roles are with delivery centres of bigger IT firms

How do I find Java Full Stack with React jobs in Coimbatore?

Shortlist companies with Coimbatore offices, keep your CV focused on Java Full Stack with React projects, apply on company career pages and job portals with the Coimbatore filter, and practise the questions on this page before each interview.