Bird
0
0

Which of these is true about the type of a variadic parameter inside the function?

easy📝 Conceptual Q2 of 15
Swift - Functions
Which of these is true about the type of a variadic parameter inside the function?
AIt is treated as a single value of the specified type
BIt is treated as an array of the specified type
CIt is treated as a dictionary
DIt is treated as a tuple
Step-by-Step Solution
Solution:
  1. Step 1: Recall how Swift handles variadic parameters

    Inside the function, the variadic parameter behaves like an array of the specified type.
  2. Step 2: Match with options

    Only It is treated as an array of the specified type correctly states it is treated as an array.
  3. Final Answer:

    It is treated as an array of the specified type -> Option B
  4. Quick Check:

    Variadic parameter type = array inside function [OK]
Quick Trick: Variadic parameters act like arrays inside functions [OK]
Common Mistakes:
  • Thinking variadic is a single value
  • Confusing with tuples or dictionaries
  • Assuming variadic is a different collection type

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Swift Quizzes