What distinguishes a strong Java assessment?
Trivia can verify vocabulary. It rarely establishes whether an engineer can diagnose production behavior. A better question gives a concrete situation, asks for the underlying mechanism, and specifies what evidence counts as a strong answer. Use a mix of junior, intermediate and senior scenarios matched to the role; do not assume a single fixed test predicts job performance.
10 Java assessment questions with scoring evidence
Mutable HashSet keys
A mutable object is inserted into a HashSet, then a field used by equals and hashCode changes. Why may contains fail?
Look for: hash bucket selection changes; hash/equality stability is required while stored; avoid mutable key fields. Watch for: claiming the set automatically rehashes the object.
ArrayList versus LinkedList
A service frequently indexes into a list and appends records. Which Java collection would you start with, and why?
Look for: indexed access, locality, amortized append, memory overhead; context-dependent trade-off. Watch for: choosing LinkedList because it “always inserts faster.”
Immutability with a List
Design an immutable Person holding a name and a list of phone numbers. How do you prevent callers from modifying state?
Look for: final fields, defensive copy in constructor, immutable view or copy in getter; element mutability caveat. Watch for: returning a modifiable original list.
Recover or propagate?
A repository method fails during a database operation. When should the service catch an exception, and when should it let the caller handle it?
Look for: meaningful local recovery, adding context, transaction rollback, avoiding swallowed exceptions. Watch for: blanket catch-and-ignore.
Why wait in a while loop?
Why does a consumer waiting on an empty queue use while (queue.isEmpty()) wait() instead of if?
Look for: spurious wakeups, multiple consumers racing to consume after notification, rechecking under the lock. Watch for: assuming a notification guarantees the condition remains true.
Lock-order deadlock
Thread A holds lock X and waits for Y while thread B holds Y and waits for X. Explain the failure and propose a robust preventive rule.
Look for: circular wait and globally consistent lock acquisition order; alternatives such as timed attempts where suitable. Watch for: saying synchronized methods prevent deadlocks.
Inventory race across instances
Two Spring Boot instances both read stock = 1 and attempt to sell the item. What database-side approach permits only one success?
Look for: atomic conditional update (UPDATE ... SET stock=stock-1 WHERE id=? AND stock>0) and affected-row check, or appropriate locking; transactions. Watch for: relying only on Java synchronized across instances.
LEFT JOIN filter trap
A query must retain customers with no orders, but a filter on the order table in WHERE removes them. Explain and fix it.
Look for: NULL-extended rows are filtered by the WHERE predicate; move the condition to the ON clause. Watch for: changing to INNER JOIN.
Retries and idempotency
A payment request times out after the payment processor may have succeeded. How should a retry avoid charging twice?
Look for: stable idempotency key, persistent deduplication, atomic state transition, reconciliation for ambiguous outcomes. Watch for: assuming a timeout means the operation failed.
Virtual threads and throughput
A Java server moves blocking I/O operations to virtual threads. Why might concurrency improve without making CPU-bound tasks faster?
Look for: cheap blocking/waiting, carrier thread utilization, CPU saturation limits, pinning or synchronized blocking caveats. Watch for: claiming virtual threads make each operation execute faster.
An evidence-based scorecard
| Dimension | 0–1: weak evidence | 2: partial | 3: convincing |
|---|---|---|---|
| Technical accuracy | Fundamental mechanism incorrect | Mostly right but imprecise | Correct and qualified |
| Reasoning | Unsupported claim | Some causal explanation | Explains why and when |
| Trade-offs | No limitations | One limitation noted | Context, risk and alternatives |
Use the rubric across a small set of role-relevant questions rather than scoring all ten by default. Include calibration answers and a second human reviewer for consequential borderline decisions. Adjust seniority requirements to the actual job: a backend engineer maintaining distributed payments needs different depth from someone building a small internal tool.
How to administer the assessment
- Pick three to five capabilities from the job description, not from a generic Java syllabus.
- Select questions that expose those capabilities; make time expectations explicit.
- Ask candidates to explain reasoning, and allow more than one technically valid implementation.
- Combine the written evidence with an appropriate coding task or structured interview.
- Audit scores for consistency and check whether results predict useful on-the-job outcomes.
Algonique Company can generate open-ended, 15-question technical assessments and AI-assisted evaluations. It does not replace a runnable coding environment or a hiring manager's review.