Red Hat Certified Cloud-native Developer exam Free Sample Questions

Description

Covers externalized configuration and dependency injection, fault tolerance and health checks, Micrometer metrics, JWT-based security, RESTful and reactive services, Panache persistence, and tracing.

12 free sample questions135 in the full practice test

Try simulator

EX378 Sample Questions

  1. Question 1

    Beginner

    Configuration and Dependency Injection · Configuration Profiles

    You are developing a Quarkus microservice that requires different database configurations for development, testing, and production environments. You want to define a property db.url that changes automatically based on the active profile. Which of the following entries in application.properties correctly sets the value for the 'production' profile specifically?

    Answer and explanation

    Correct answer: B

    In Quarkus, profile-specific properties are defined using the syntax %profile.property-key=value. Therefore, %prod.db.url is the correct syntax to target the 'prod' profile. The prefix prod. without the percent sign is interpreted as part of the property name, not a profile selector.

  2. Question 2

    Intermediate

    Configuration and Dependency Injection · Configuration Mapping

    A developer needs to map a complex configuration structure for an external payment provider into a Java object. The configuration includes a provider name, an API key, and a nested object for timeout settings. Which annotation should be applied to the interface to enable type-safe configuration mapping in Quarkus?

    Answer and explanation

    Correct answer: D

    The @ConfigMapping annotation (from SmallRye Config) is the recommended way to map configuration properties to an interface in Quarkus. It supports nested structures and validation. @ConfigProperties is deprecated in favor of @ConfigMapping.

  3. Question 3

    Advanced

    Configuration and Dependency Injection · Custom ConfigSource

    You are implementing a custom ConfigSource to read configuration from a legacy database. You want this source to override values found in application.properties but be overridden by system properties. What is the appropriate ordinal value to return from getOrdinal()?

    Answer and explanation

    Correct answer: C

    In MicroProfile Config, application.properties has a default ordinal of 100 (or 250 in some Quarkus contexts depending on location, but typically 250 for application.properties in Quarkus). System properties have an ordinal of 400. To sit between them, a value like 350 is appropriate. (Note: Standard MP Config has app.properties at 100, Env vars at 300, Sys props at 400. Quarkus defaults application.properties to 250. So 350 overrides application.properties but yields to Sys props).

  4. Question 4

    Beginner

    Configuration and Dependency Injection · Injection

    A developer is injecting an optional configuration property named app.welcome.message into a CDI bean. If the property is not defined in any configuration source, the application should default to "Hello World". Which code snippet correctly achieves this?

    Answer and explanation

    Correct answer: C

    The @ConfigProperty annotation provides a defaultValue attribute. If the property app.welcome.message is missing from all sources, the container will inject the string "Hello World". Using Optional handles missing values but requires extra code to retrieve the default at runtime.

  5. Question 5

    Beginner

    Health Checks · Readiness vs Liveness

    You are creating a custom health check to verify the connectivity of a critical downstream payment gateway. The check should only influence the orchestration platform's decision to route traffic to the pod, not whether to restart it. Which annotation should you use on your HealthCheck implementation?

    Answer and explanation

    Correct answer: C

    The @Readiness annotation indicates that the application is ready to accept traffic. If a readiness check fails, the orchestration platform (like Kubernetes) stops sending traffic to the pod but does not restart it. @Liveness failures trigger a restart.

  6. Question 6

    Intermediate

    Health Checks · Reactive Health

    A developer needs to implement a non-blocking health check in a reactive Quarkus application. The check involves an asynchronous call to a remote service using a Mutiny Uni. Which interface should the bean implement to support this reactive pattern?

    Answer and explanation

    Correct answer: B

    The ReactiveHealthCheck interface (from SmallRye Health) allows implementing health checks that return a Uni . This is essential for non-blocking operations in a reactive stack, preventing the blocking of the event loop during health probes.

Register free for 6 more questions

Or unlock all 135 EX378 questions with explanations, timed mode and flashcards.