Bird
0
0

Given the code snippet applying the YAGNI principle:

easy📝 Analysis Q4 of 15
Software Engineering - Fundamentals
Given the code snippet applying the YAGNI principle:
features = []
if False:
    features.append('Extra feature')
print(features)

What will be the output?
A['Extra feature']
BNone
CError: features not defined
D[]
Step-by-Step Solution
Solution:
  1. Step 1: Analyze the condition

    The if condition is False, so the append statement does not execute.
  2. Step 2: Check the features list content

    Since nothing is added, features remains an empty list.
  3. Final Answer:

    [] -> Option D
  4. Quick Check:

    YAGNI avoids unused features = empty list [OK]
Quick Trick: YAGNI means don't add unused features [OK]
Common Mistakes:
  • Assuming feature is added despite False condition
  • Confusing empty list with None
  • Expecting error due to condition

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Software Engineering Quizzes