Swift - Data TypesWhich of the following is the correct syntax to declare a tuple with an Int and a String in Swift?Alet person: (Int, String) = (25, "Alice")Blet person = Int, String = (25, "Alice")Clet person = Int: 25, String: "Alice"Dlet person: Int, String = (25, "Alice")Check Answer
Step-by-Step SolutionSolution:Step 1: Check tuple declaration syntaxCorrect tuple syntax uses parentheses with types inside, then assigns values in parentheses.Step 2: Validate each optionlet person: (Int, String) = (25, "Alice") correctly declares a tuple type and assigns matching values. Others have syntax errors or wrong format.Final Answer:let person: (Int, String) = (25, "Alice") -> Option AQuick Check:Tuple syntax = (Type1, Type2) = (value1, value2) [OK]Quick Trick: Use parentheses for tuple types and values [OK]Common Mistakes:Omitting parentheses around typesTrying to declare types outside tuple parenthesesUsing incorrect colon placement
Master "Data Types" in Swift9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepVisualTryChallengeProjectRecallTime
More Swift Quizzes Control Flow - Switch with where clauses - Quiz 11easy Data Types - Bool type and logical operators - Quiz 7medium Loops - Break and continue behavior - Quiz 7medium Operators and Expressions - Logical operators - Quiz 13medium Operators and Expressions - Ternary conditional operator - Quiz 4medium Operators and Expressions - Range operators (... and ..<) - Quiz 9hard Operators and Expressions - Operator overloading concept - Quiz 8hard Optionals - Multiple optional binding - Quiz 13medium Swift Basics and Runtime - Swift REPL and Playgrounds - Quiz 1easy Variables and Constants - Type inference by the compiler - Quiz 12easy