Bird
0
0

In a microservice, consider this pseudocode:

medium📝 Analysis Q5 of 15
Microservices - CI/CD for Microservices
In a microservice, consider this pseudocode:
if (featureFlags.isEnabled('experimental_ui')) {
  return 'Experimental UI active';
} else {
  return 'Experimental UI inactive';
}

What will be the output if the feature flag experimental_ui is disabled?
ANo output
BExperimental UI active
CError: feature flag not found
DExperimental UI inactive
Step-by-Step Solution
Solution:
  1. Step 1: Understand the condition

    The code checks if the feature flag 'experimental_ui' is enabled.
  2. Step 2: Evaluate the flag state

    If the flag is disabled, the condition evaluates to false.
  3. Step 3: Determine the output

    Since the condition is false, the else branch executes, returning 'Experimental UI inactive'.
  4. Final Answer:

    Experimental UI inactive -> Option D
  5. Quick Check:

    Flag disabled means else branch runs [OK]
Quick Trick: If flag disabled, else branch output runs [OK]
Common Mistakes:
  • Assuming the if branch runs when flag is disabled
  • Confusing enabled with disabled state
  • Expecting an error if flag is off

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Microservices Quizzes