Skip to content

Java and Spring Boot

Somkiat Puisungnoen edited this page May 19, 2026 · 1 revision

Exam for Java and Spring Boot

1. Project Loom and Virtual Threads, how does the JVM handle a virtual thread that performs a blocking I/O operation ?

  • A. The JVM creates a new platform thread specifically to handle the blocked state
  • B. Virtual threads cannot perform blocking I/O; they must use non-blocking NIO APIs
  • C. The underlying platform thread is blocked until the I/O operation completes
  • D. The virtual thread is unmounted from the platform thread, allowing the platform thread to execute other virtual threads

2. When designing a database for a 'Read-Heavy' system, which strategy is most effective for improving performance ?

  • A. Normalizing the database to the 3rd Normal Form (3NF)
  • B. Removing all indexes to speed up table scans
  • C. Strictly using 'Write-Through' caching only
  • D. Implementing Denormalization and Materialized Views

3. In Spring Transaction management, which Isolation level prevents 'Phantom Reads' ?

  • A. SERIALIZABLE
  • B. REPEATABLE_READ
  • C. READ_UNCOMMITTED
  • D. READ_COMMITTED

4. What is the primary benefit of using GraalVM Native Image for a Spring Boot application ?

  • A. Significantly faster startup time and lower memory footprint
  • B. Improved peak throughput after the JIT compiler warms up
  • C. Ability to use Dynamic Class Loading at runtime
  • D. Automatic conversion of synchronous code to asynchronous code

5. Which Resilience4j pattern is used to prevent a cascade of failures by temporarily stopping requests to a struggling downstream service ?

  • A. Retry
  • B. Bulkhead
  • C. Rate Limiter
  • D. Circuit Breaker

6. How does Spring WebFlux handle concurrency compared to Spring MVC (Tomcat) ?

  • A. It uses one thread per request
  • B. It automatically converts all Java Collections to Streams
  • C. It uses an event-loop model with a small, fixed number of threads to handle many concurrent connections
  • D. It requires a Virtual Thread for every incoming socket connection

7. In a Spring Boot application, how do you handle multiple DataSources properly ?

  • A. Put all database credentials in a single application.properties string separated by commas
  • B. Configure separate @Bean definitions for each DataSource and use @Qualifier to inject them
  • C. Define multiple @Primary beans for each DataSource
  • D. Multiple DataSources are not supported in Spring Boot

8. When processing a file that is significantly larger than the available RAM, which approach is recommended ?

  • A. Increase the JVM heap size to be larger than the file.
  • B. Read the entire file into a List.
  • C. Convert the file to a Base64 string before processing.
  • D. Use Files.lines() or a BufferedReader to process the file line-by-line using a Stream

9. How does Java's 'CompletableFuture' differ from a standard 'Future' ?

  • A. Standard Future is faster than CompletableFuture
  • B. CompletableFuture allows for functional-style callbacks and chaining (e.g., thenApply, thenAccept)
  • C. CompletableFuture cannot be canceled.
  • D. CompletableFuture only works with Virtual Threads

10. Which of the following is a key feature introduced in the Java Stream API for better efficiency ?

  • A. Replacing all loops with recursive functions.
  • B. Lazy evaluation and Short-circuiting
  • C. Eager evaluation of all intermediate operations.
  • D. Automatic conversion of data to JSON

Clone this wiki locally