Quizzesapplication.properties / YAML — Concept Check
intermediate
spring-boot

application.properties / YAML — Concept Check

Questions on application.properties / YAML. Externalise configuration via key-value properties or structured YAML; Spring Boot resolves values from multiple sources following a strict precedence order.

8 minutes 8 questions Pass at 70%
Time Limit
8 minutes - timer starts when you begin
Change Answers Freely
Revisit and change any answer before submitting
Full Review After Submit
Correct answers and explanations shown for every question
Auto-submit on timeout
Quiz submits automatically when time runs out

Questions in this quiz

8 questions on application.properties / YAML — Concept Check. Work through them here, then start the quiz to answer them and see your score.

  1. 1.A developer sets the active profile to 'prod' using an environment variable, but the application still uses 'dev' settings. What could be the issue?

    • AThe application.properties file has higher precedence.
    • BThe environment variable is misspelled or not set correctly.
    • CThe application.yml file is overriding the environment variable.
    • DThe command-line argument overrides the environment variable.
  2. 2.You notice that your Spring Boot application is using the wrong database URL in production. Which source should you check first for misconfiguration?

    • Aapplication.properties
    • BCommand-line arguments
    • Capplication-prod.properties
    • DEnvironment variables
  3. 3.A Spring Boot application is configured with @ConfigurationProperties but is not picking up the expected properties. What might be wrong?

    • AThe properties are defined in application.yml instead of application.properties.
    • BThe prefix in @ConfigurationProperties is incorrect.
    • CThe properties are not listed in application-{profile}.properties.
    • DThe properties are overridden by default values.
  4. 4.Which of the following has the highest precedence when resolving configuration properties in Spring Boot?

    • ACommand-line arguments
    • Bapplication-{profile}.properties
    • CEnvironment variables
    • Dapplication.properties
  5. 5.A developer uses @Value annotations throughout the codebase. What is a potential downside compared to using @ConfigurationProperties?

    • A@Value does not allow for default values.
    • B@Value does not support type-safe configuration.
    • C@Value cannot be used with environment variables.
    • D@Value has higher precedence than application.properties.
  6. 6.A Spring Boot application is configured with application.properties and application-prod.properties. The active profile is set to 'prod'. Which property source will be used for the server port?

    • Aserver.port from application-prod.properties
    • BEnvironment variable for server.port
    • Cserver.port from application.properties
    • DDefault server.port value
  7. 7.A developer claims that using profiles in Spring Boot can lead to runtime errors if not all properties are defined in every profile. Is this true?

    • ATrue, unless @ConfigurationProperties is used.
    • BTrue, missing properties in profiles cause runtime errors.
    • CFalse, profiles are only for logging purposes.
    • DFalse, Spring Boot will use default values if properties are missing.
  8. 8.In a Spring Boot application, which configuration method allows for environment-specific settings without changing the code?

    • AHardcoding values in application.properties
    • B@ConfigurationProperties
    • CProfiles with application-{profile}.properties
    • D@Value annotations