1Z0-829 Utilizing Java Object-Oriented Approach • Set 3
1Z0-829 Utilizing Java Object-Oriented Approach Practice Test 3 — 15 questions with explanations. Free, no signup.
A financial services company runs a Java 17 Spring Boot application that processes real-time stock trades. The application uses a class `TradeProcessor` containing a method `void process(Trade trade)`. This method is invoked by multiple threads concurrently. The `Trade` class is immutable and has fields like `String symbol`, `int quantity`, `double price`. The `TradeProcessor` method updates a shared `HashMap<String, Double>` that tracks the average price per symbol. The update logic is: retrieve the current average for the symbol, compute a new average, and put it back. During high-load testing, the average prices are occasionally incorrect. The development team suspects a race condition. Which course of action should be taken to fix the issue with minimal performance impact?
Choose an answer to begin — your selection is scored in the full session.
15 questions · instant feedback and full explanations after every question.