Challenge - 5 Problems
Feature Flags Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ component_behavior
intermediate2:00remaining
How does a feature flag affect Spring Boot application behavior?
Consider a Spring Boot app with a feature flag controlling a new payment method. What happens when the flag is OFF?
Spring Boot
public boolean isNewPaymentEnabled() {
return featureFlagService.isEnabled("newPayment");
}
if (isNewPaymentEnabled()) {
// use new payment method
} else {
// use old payment method
}Attempts:
2 left
💡 Hint
Think about what the flag controls and what happens when it is false.
✗ Incorrect
When the feature flag is OFF, the app skips the new payment method and uses the old one as fallback.
📝 Syntax
intermediate1:30remaining
Which code snippet correctly checks a feature flag in Spring Boot?
You want to check if a feature flag named "betaFeature" is enabled using a FeatureFlagService. Which option is correct?
Attempts:
2 left
💡 Hint
Look for the common naming pattern for boolean checks in Java.
✗ Incorrect
The method is usually named isEnabled to indicate a boolean check. Other options are invalid method names.
❓ state_output
advanced2:30remaining
What is the output when toggling a feature flag at runtime?
Given a Spring Boot app where a feature flag "darkMode" is initially OFF, what happens if you enable it at runtime and then reload the page?
Spring Boot
boolean darkMode = featureFlagService.isEnabled("darkMode"); System.out.println("Dark mode enabled: " + darkMode);
Attempts:
2 left
💡 Hint
Feature flags can be dynamic if implemented properly.
✗ Incorrect
When the flag is toggled on, the app reads the new value on reload and reflects the change.
🔧 Debug
advanced3:00remaining
Why does the feature flag check always return false?
You wrote this code but the feature flag check always returns false even when enabled:
@Service
public class FeatureFlagService {
private Map flags = Map.of("newUI", false);
public boolean isEnabled(String flag) {
return flags.getOrDefault(flag, false);
}
}
What is the likely cause?
Attempts:
2 left
💡 Hint
Think about how Map.of works in Java.
✗ Incorrect
Map.of creates an immutable map. You cannot update flags later, so the flag stays false.
🧠 Conceptual
expert2:00remaining
What is the main benefit of using feature flags in Spring Boot applications?
Choose the best explanation for why developers use feature flags in Spring Boot projects.
Attempts:
2 left
💡 Hint
Think about how feature flags help with releasing new features safely.
✗ Incorrect
Feature flags let teams enable or disable features dynamically, avoiding full redeploys and reducing risk.