Bird
0
0

Which of the following pseudocode snippets correctly verifies if the feature toggle betaFeature is active?

easy📝 Conceptual Q3 of 15
Microservices - Configuration and Secrets Management
Which of the following pseudocode snippets correctly verifies if the feature toggle betaFeature is active?
Aif (featureToggle['betaFeature'] == true) { activateBeta(); }
Bif (featureToggle.isEnabled = 'betaFeature') { activateBeta(); }
Cif (featureToggle.isEnabled('betaFeature')) { activateBeta(); }
Dif (featureToggle.isEnabled('betaFeature') == false) { activateBeta(); }
Step-by-Step Solution
Solution:
  1. Step 1: Understand method usage

    The method isEnabled should be called with the feature name as a string argument.
  2. Step 2: Analyze options

    if (featureToggle.isEnabled('betaFeature')) { activateBeta(); } correctly calls isEnabled('betaFeature') and activates the feature if true.
  3. Step 3: Identify incorrect options

    if (featureToggle.isEnabled = 'betaFeature') { activateBeta(); } uses assignment instead of comparison; C uses incorrect syntax; D activates feature when toggle is false.
  4. Final Answer:

    if (featureToggle.isEnabled('betaFeature')) { activateBeta(); } -> Option C
  5. Quick Check:

    Method call with string argument is correct [OK]
Quick Trick: Use method call with string feature name [OK]
Common Mistakes:
  • Using assignment '=' instead of method call
  • Incorrectly accessing toggle as an object property
  • Activating feature when toggle is disabled

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Microservices Quizzes