Skip to content

Java Full Stack with React Mock Interview: 20 Questions in 50 Minutes

Four rounds that copy a real interview. Answer aloud, then check the model answers.

Mock interview format

  1. Warm-up · 5 minutes — 4 questions
  2. Technical · 20 minutes — 7 questions
  3. Scenario · 15 minutes — 5 questions
  4. HR & behavioural · 10 minutes — 4 questions

Tip: record yourself and listen back. Most people talk too fast and skip the key idea.

Mock progressStart 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

When would you use Flexbox and when CSS Grid?

Save to ▾
Show answer
Flexbox is one-dimensional: it arranges items in a row or a column and is great for navbars, button groups, centring and card rows that wrap. Grid is two-dimensional: it controls rows and columns together, ideal for page layouts, dashboards and galleries with grid-template-areas. They work well together, for example a Grid page layout with Flexbox inside each card. Both reduce the need for floats and positioning hacks.
02

Why are semantic HTML and accessibility important?

Save to ▾
Show answer
Semantic elements like header, nav, main, article, button and label describe meaning, so screen readers, search engines and browsers understand the page. Use a real button instead of a clickable div so keyboard and focus work automatically. Add alt text to images, link labels to inputs, keep heading order logical and ensure enough colour contrast. Accessibility follows WCAG guidelines and improves SEO and usability for everyone.
03

What is Spring Boot and how is it different from the Spring Framework?

Warm-upSpring BootEasy
Save to ▾
Show answer
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.
04

What is the difference between JPA, Hibernate and Spring Data JPA?

Save to ▾
Show answer
JPA, now Jakarta Persistence, is a specification that defines annotations and the EntityManager API for object-relational mapping. Hibernate is the most widely used implementation of that specification and adds extra features. Spring Data JPA is a layer above JPA that generates repository implementations from interfaces, so methods like findByEmail are created automatically. In a Spring Boot app you write against Spring Data, which uses JPA, which is implemented by Hibernate.
05

What is event delegation and why is it useful?

Save to ▾
Show answer
Events bubble up from the target element to its ancestors. With event delegation you attach one listener to a parent, such as a ul, and use event.target.closest('li') to find which child was clicked. This saves memory compared with a listener on every item and automatically works for items added later. It is commonly used for dynamic tables and lists. React uses a similar idea by attaching listeners at the root.
06

What are intermediate and terminal operations in Java Streams?

Save to ▾
Show answer
Intermediate operations such as filter, map, sorted and distinct return a new stream and are lazy; nothing runs until a terminal operation is called. Terminal operations such as collect, forEach, count, reduce and findFirst trigger processing and produce a result. Laziness allows short-circuiting: with findFirst, elements are processed one by one only until a match is found. A stream can be consumed only once.
07

Fetch a list of products from an API and show loading and error states.

TechnicalReact FrontendMedium
Save to ▾
Show answer
function ProductList() { const [products, setProducts] = useState([]); const [loading, setLoading] = useState(true); const [error, setError] = useState(null); useEffect(() => { const controller = new AbortController(); fetch('/api/products', { signal: controller.signal }) .then(res => { if (!res.ok) throw new Error('HTTP ' + res.status); return res.json(); }) .then(data => setProducts(data.content)) .catch(err => { if (err.name !== 'AbortError') setError(err.message); }) .finally(() => setLoading(false)); return () => controller.abort(); }, []); if (loading) return <p>Loading...</p>; if (error) return <p>Error: {error}</p>; return <ul>{products.map(p => <li key={p.id}>{p.name}</li>)}</ul>; }
08

How does garbage collection work in modern Java?

TechnicalCore JavaMedium
Save to ▾
Show answer
The GC frees objects that are no longer reachable from GC roots such as thread stacks and static fields. Most objects die young, so the heap is generational: minor collections clean the young generation often and survivors are promoted. G1 is the default collector since Java 9 and targets predictable pause times by collecting regions. ZGC and Shenandoah offer sub-millisecond pauses for large heaps. Tuning usually starts with -Xmx and choosing the collector, not dozens of flags.
09

Compare HashMap, Hashtable and ConcurrentHashMap.

Save to ▾
Show answer
HashMap is not synchronized and allows one null key and null values. Hashtable is a legacy class where every method is synchronized, so it is slow and allows no nulls. ConcurrentHashMap is the modern thread-safe choice: reads are mostly lock-free, writes lock only a single bucket using CAS and synchronized blocks, and it offers atomic methods such as computeIfAbsent and merge. It also does not allow null keys or values.
10

How do you version a REST API?

Save to ▾
Show answer
The most common approach is URI versioning, like /api/v1/orders and /api/v2/orders, because it is visible and easy to route and cache. Other options are a custom header or the Accept media type. Spring Framework 7 adds first-class API versioning support. Version only for breaking changes; adding optional fields is backward compatible. Keep old versions running for a published deprecation period, and document every version with OpenAPI.
11

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

TechnicalSpring BootMedium
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.
12

A teammate replaced a simple for loop in a performance-critical path with a long stream pipeline. Is this a concern?

Save to ▾
Show answer
Streams are usually fine and readable, and the JIT optimises them well, but in very hot loops they can add allocation, boxing and lambda overhead. Check for boxing with Stream<Integer> instead of IntStream, and for repeated sorting or collecting. Measure with a JMH benchmark or profiler rather than guessing. Keep streams where readability matters and use a plain loop only where profiling proves a real bottleneck.
13

You get ConcurrentModificationException while removing items from a list inside a for-each loop. How do you fix it?

Save to ▾
Show answer
The for-each loop uses a fail-fast iterator, and calling list.remove changes the modification count. Use list.removeIf(item -> item.isExpired()), which is clean and efficient, or use an explicit Iterator and call iterator.remove(). Another option is to collect the items to keep into a new list with a stream filter. If several threads modify the list, use a concurrent collection instead.
14

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

ScenarioJPA and HibernateMedium
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.
15

Your @Transactional method threw an exception but the data was still saved. Why?

ScenarioSpring BootHard
Save to ▾
Show answer
By default Spring rolls back only on unchecked exceptions and Errors, so a checked exception such as IOException commits the transaction. Use @Transactional(rollbackFor = Exception.class) or wrap it in a runtime exception. Other causes are catching the exception inside the method, calling the method from the same class so the proxy is bypassed, a non-public method, or a table engine that does not support transactions such as MyISAM.
16

Under load, requests fail with a connection timeout from HikariCP. What do you check?

ScenarioSQL and DatabasesHard
Save to ▾
Show answer
This means all pool connections are busy. Check for long-running queries, transactions held open during remote calls, and connection leaks from code that never closes resources; set leakDetectionThreshold to find them. Compare maximumPoolSize with the database's max connections across all instances, since a bigger pool is not always better. Monitor Hikari metrics through Actuator, fix slow queries and keep @Transactional boundaries short.
17

Why do you want to become a Java full stack developer?

HR & behaviouralCore JavaEasy
Save to ▾
Show answer
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.
18

How do you keep yourself updated with new Java versions and features?

HR & behaviouralCollections and StreamsEasy
Save to ▾
Show answer
I follow the six-monthly Java release notes and JEP summaries, and I try new features in small jshell experiments or side projects. For example, when Java 21 became LTS I rewrote a small file-processing tool using virtual threads and pattern matching to understand the benefits. I also read Spring release blogs and watch conference talks, and I share short notes with my team so we upgrade with confidence.
19

How do you work with frontend developers and testers on API changes?

Save to ▾
Show answer
I agree on the API contract first using an OpenAPI spec or Swagger UI, so frontend and QA can start in parallel with mock data. I share example requests and error responses, and I tell the team early if a field must change. For example, in my last sprint I gave QA a Postman collection with test cases for every endpoint. This reduced back-and-forth and our feature passed testing on the first cycle.
20

Mentoring: how would you help a junior developer who keeps pushing untested Spring code?

HR & behaviouralSpring BootMedium
Save to ▾
Show answer
Situation: a junior on my team often broke the build with untested changes. Task: help him improve without demotivating him. Action: I paired with him for a few sessions to write JUnit and Mockito tests for his own features, shared a short checklist and set up a CI rule that blocks merges without passing tests. Result: within a month his pull requests passed review faster, and he later helped another new joiner.

Frequently asked questions

How do I use this mock interview?

Set a 50-minute timer, answer every question aloud (or ask a friend to read them), and open answers only after each round. Note every question where your answer missed the key idea.

How often should I take a mock?

Once a week while preparing and once two or three days before a real interview. The question order is fixed, so for fresh practice use the company and experience pages too.