Bird
0
0

Which of the following is the correct way to check a feature flag in a Spring Boot controller method?

easy📝 Syntax Q12 of 15
Spring Boot - Advanced Patterns
Which of the following is the correct way to check a feature flag in a Spring Boot controller method?
Aif(featureFlagService.isFeatureEnabled("newFeature")) { ... }
Bif(featureFlagService.checkFlag("newFeature")) { ... }
Cif(featureFlagService.enableFeature("newFeature")) { ... }
Dif(featureFlagService.toggleFeature("newFeature")) { ... }
Step-by-Step Solution
Solution:
  1. Step 1: Recall typical method naming for feature flags

    Common method to check if a feature is enabled is named like isFeatureEnabled.
  2. Step 2: Match method name with options

    Only if(featureFlagService.isFeatureEnabled("newFeature")) { ... } uses isFeatureEnabled which clearly indicates checking status.
  3. Final Answer:

    if(featureFlagService.isFeatureEnabled("newFeature")) { ... } -> Option A
  4. Quick Check:

    Check feature flag with isFeatureEnabled() [OK]
Quick Trick: Look for method named isFeatureEnabled() to check flags [OK]
Common Mistakes:
  • Using methods that sound like they change state (enableFeature, toggleFeature)
  • Using incorrect method names not standard in feature flag services

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Spring Boot Quizzes