Swift - FunctionsWhich of these is true about the type of a variadic parameter inside the function?AIt is treated as a single value of the specified typeBIt is treated as an array of the specified typeCIt is treated as a dictionaryDIt is treated as a tupleCheck Answer
Step-by-Step SolutionSolution:Step 1: Recall how Swift handles variadic parametersInside the function, the variadic parameter behaves like an array of the specified type.Step 2: Match with optionsOnly It is treated as an array of the specified type correctly states it is treated as an array.Final Answer:It is treated as an array of the specified type -> Option BQuick 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 valueConfusing with tuples or dictionariesAssuming variadic is a different collection type
Master "Functions" in Swift9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepVisualTryChallengeProjectRecallTime
More Swift Quizzes Collections - Set algebra (union, intersection, difference) - Quiz 1easy Collections - Set creation and operations - Quiz 6medium Control Flow - Switch must be exhaustive - Quiz 10hard Control Flow - If and if-else statements - Quiz 1easy Control Flow - Switch must be exhaustive - Quiz 11easy Data Types - Tuples for grouped values - Quiz 15hard Loops - While loop - Quiz 11easy Loops - For-in loop with collections - Quiz 8hard Operators and Expressions - Ternary conditional operator - Quiz 2easy Variables and Constants - Var for variables (mutable) - Quiz 1easy