Skip to content

Goldman Sachs 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 Goldman Sachs hiring for Java Full Stack with React roles

Goldman Sachs is a global investment banking, securities and asset management firm. Its Bengaluru and Hyderabad offices are major engineering and operations centres supporting trading, risk, compliance and consumer platforms. It hires in India for software engineers, quality engineers, data engineers, quantitative strategists and risk or operations analysts.

For Java Full Stack with React roles, this Goldman Sachs practice set focuses most on React Frontend (5), Collections and Streams (5), REST APIs, Security and Microservices (5), Core Java (4). It has 5 easy, 20 medium, 5 hard questions, so you can start easy and work up to the harder ones.

Company type
Banking & finance
Headquarters
New York, USA
Main India offices
Bengaluru, Hyderabad, Mumbai

Goldman Sachs Java Full Stack with React interview process

  1. Online assessment (coding + quant + aptitude)
  2. Technical round 1 (DSA)
  3. Technical round 2 (design or CS fundamentals)
  4. Hiring manager round
  5. HR or culture round

Typical pattern based on public candidate experiences. Rounds vary by role, team and year.

Solved for Goldman SachsStart 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

How does garbage collection work in modern Java?

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.
02

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.
03

What is a custom hook and why would you write one?

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

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.
05

Implement a simple LRU cache in Java.

Save to ▾
Show answer
class LruCache<K, V> extends LinkedHashMap<K, V> { private final int capacity; LruCache(int capacity) { super(16, 0.75f, true); // true = access order this.capacity = capacity; } @Override protected boolean removeEldestEntry(Map.Entry<K, V> eldest) { return size() > capacity; } } // Not thread-safe: wrap with Collections.synchronizedMap // or use Caffeine in production.
06

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

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.
07

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.
08

What is the circuit breaker pattern and how is it implemented in Spring?

Save to ▾
Show answer
A circuit breaker stops calling a failing downstream service so failures do not cascade. It is closed during normal operation, opens when the failure rate crosses a threshold, returns a fallback immediately while open, and moves to half-open after a wait to test recovery. In Spring Boot it is implemented with Resilience4j using @CircuitBreaker(name = "payment", fallbackMethod = "fallback"), usually combined with timeouts, retries with backoff and bulkheads.
09

Which HTTP methods are safe and which are idempotent?

Save to ▾
Show answer
Safe methods do not change server state: GET, HEAD and OPTIONS. Idempotent methods give the same result if repeated: GET, PUT, DELETE, HEAD and OPTIONS. POST is neither, so retrying a POST can create duplicate orders, which is why payment APIs use an idempotency key header. PATCH is not guaranteed idempotent. Knowing this matters for retries in clients, gateways and message consumers.
10

Use map, filter and reduce to get the total value of in-stock products.

Save to ▾
Show answer
const products = [ { name: 'Pen', price: 20, qty: 10, inStock: true }, { name: 'Bag', price: 900, qty: 0, inStock: false }, { name: 'Book', price: 250, qty: 4, inStock: true }, ]; const total = products .filter(p => p.inStock) .map(p => p.price * p.qty) .reduce((sum, value) => sum + value, 0); console.log(total); // 1200
11

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

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>; }
12

Write a basic CRUD REST controller in Spring Boot.

Save to ▾
Show answer
@RestController @RequestMapping("/api/products") public class ProductController { private final ProductService service; public ProductController(ProductService service) { this.service = service; } @GetMapping("/{id}") public ProductDto get(@PathVariable Long id) { return service.get(id); } @PostMapping public ResponseEntity<ProductDto> create(@Valid @RequestBody ProductRequest req) { ProductDto saved = service.create(req); return ResponseEntity.created(URI.create("/api/products/" + saved.id())).body(saved); } @DeleteMapping("/{id}") @ResponseStatus(HttpStatus.NO_CONTENT) public void delete(@PathVariable Long id) { service.delete(id); } }
13

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.
14

Why is String immutable in Java?

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

When would you use the Context API and when a state library like Redux Toolkit or Zustand?

Save to ▾
Show answer
Context is good for passing low-frequency global values such as theme, language or the logged-in user without prop drilling. Every consumer re-renders when the context value changes, so it is not ideal for fast-changing data. Redux Toolkit or Zustand suit larger shared client state with many updates, selectors and dev tools. Server data like API responses is often best handled by TanStack Query, which adds caching and refetching.
16

What is the difference between a clustered and a non-clustered index?

Save to ▾
Show answer
A clustered index defines the physical order of rows, so the table data itself is stored in the index and there can be only one. In MySQL InnoDB the primary key is the clustered index. A non-clustered or secondary index is a separate structure holding the indexed columns and a pointer, or the primary key in InnoDB, to the row. That is why a short primary key keeps every secondary index smaller.
17

How does HashMap work internally?

Save to ▾
Show answer
HashMap stores entries in an array of buckets. The key's hashCode is spread and masked to find a bucket index. Collisions are kept in a linked list, and since Java 8 a bucket converts to a red-black tree after 8 entries when capacity is at least 64, giving O(log n) worst case. When size exceeds capacity times load factor 0.75, the table doubles and entries are redistributed. get uses hashCode to find the bucket and equals to find the key.
18

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.
19

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.
20

Write a production-friendly Dockerfile for a Spring Boot application.

Save to ▾
Show answer
FROM eclipse-temurin:21-jdk AS build WORKDIR /app COPY . . RUN ./mvnw -q -DskipTests package FROM eclipse-temurin:21-jre WORKDIR /app RUN useradd -r appuser USER appuser COPY --from=build /app/target/*.jar app.jar EXPOSE 8080 ENTRYPOINT ["java", "-XX:MaxRAMPercentage=75", "-jar", "app.jar"] # Multi-stage build keeps the image small; runs as non-root.
21

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.
22

Your team is starting a new React project. Would you use Create React App or something else?

Save to ▾
Show answer
Create React App is deprecated and no longer recommended. For a single-page app backed by a Spring Boot API, Vite is the usual choice because of its fast dev server and optimised builds. If you need server-side rendering, SEO or file-based routing, a framework like Next.js or React Router in framework mode is recommended by the React team. Choose based on SEO needs, hosting and the team's experience.
23

Find the top 3 highest-paid employees in each department.

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

CPU is at 100 percent and requests are hanging. How would you find the cause in a Java application?

Save to ▾
Show answer
Take several thread dumps a few seconds apart using jstack, jcmd Thread.print or the Actuator threaddump endpoint. Threads stuck in the same RUNNABLE frame point to a hot loop or heavy regex, while threads BLOCKED on each other's locks show a deadlock, which jstack reports directly. Match native thread IDs from top -H to the dump. Profilers such as async-profiler or Java Flight Recorder confirm hot methods before you fix the code.
25

Memory usage of a single-page app keeps growing the longer it stays open. What could cause this?

Save to ▾
Show answer
Common causes are event listeners, intervals or WebSocket subscriptions that are never removed when a component unmounts, growing global caches or arrays, and detached DOM nodes still referenced by JavaScript. In React, return cleanup functions from useEffect to remove listeners and clear timers. Use the Chrome DevTools Memory tab with heap snapshots to compare before and after navigation and find retained objects.
26

Paging through a large table with OFFSET becomes very slow on later pages. What is a better approach?

Save to ▾
Show answer
With OFFSET 500000, the database still reads and discards half a million rows. Use keyset or seek pagination instead: remember the last seen sort key and query WHERE (created_at, id) < (:lastDate, :lastId) ORDER BY created_at DESC, id DESC LIMIT 20, backed by a matching index. This is fast at any depth and stable when new rows arrive. The trade-off is no direct jump to page N, which suits infinite scroll and APIs.
27

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.
28

How do you deep clone an object in JavaScript?

Save to ▾
Show answer
const original = { user: { name: 'Asha' }, tags: ['a'], joined: new Date() }; // Modern built-in (handles Date, Map, Set, cycles): const copy = structuredClone(original); // Spread is only a shallow copy: const shallow = { ...original }; shallow.user.name = 'Ravi'; // also changes original.user.name // JSON.parse(JSON.stringify(obj)) loses Dates, functions, // undefined and fails on circular references.
29

How do you store user passwords securely in Spring Boot? Show the code.

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

Find the second highest salary from a list of employees using streams.

Save to ▾
Show answer
Optional<Double> second = employees.stream() .map(Employee::getSalary) .distinct() .sorted(Comparator.reverseOrder()) .skip(1) .findFirst(); second.ifPresentOrElse( s -> System.out.println("Second highest: " + s), () -> System.out.println("Not enough distinct salaries")); // distinct() handles ties at the top salary.

Tips to crack the Goldman Sachs Java Full Stack with React interview

  • Practise probability and quantitative aptitude questions, which commonly appear in Goldman Sachs online assessments.
  • Learn basic financial concepts such as equities, bonds, derivatives and risk, especially for strats and data roles.
  • Prepare clear stories about teamwork and integrity, as Goldman Sachs emphasises its business principles and client focus.
  • 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; Goldman Sachs interviewers usually ask follow-ups on your first answer.

Frequently asked questions

How many rounds are there in the Goldman Sachs Java Full Stack with React interview?

Candidates usually go through 5 stages: Online assessment (coding + quant + aptitude); Technical round 1 (DSA); Technical round 2 (design or CS fundamentals); Hiring manager round; HR or culture 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 Goldman Sachs Java Full Stack with React interview?

This practice set leans on React Frontend (5), Collections and Streams (5), REST APIs, Security and Microservices (5), Core Java (4). Revise those first, then practise explaining one or two of your own projects end to end, because most Goldman Sachs interviewers ask you to walk through real work.

Are these the exact questions asked at Goldman Sachs?

No. These are curated practice questions that match the skills and difficulty usually tested in banking & finance interviews like Goldman Sachs's. They are not a leaked or verified list of past questions.

Where does Goldman Sachs hire Java Full Stack with React professionals in India?

Goldman Sachs has large teams in Bengaluru, Hyderabad, Mumbai. Openings and locations change often, so check the Goldman Sachs careers page and filter by city and experience.

Java Full Stack with React questions for similar companies