Bird
0
0

Which of the following is the correct syntax to create a typealias for a tuple (Int, String) named PersonInfo?

easy📝 Syntax Q3 of 15
Swift - Data Types
Which of the following is the correct syntax to create a typealias for a tuple (Int, String) named PersonInfo?
Atypealias PersonInfo = (Int, String)
Btypealias PersonInfo (Int, String)
Ctypealias (Int, String) = PersonInfo
Dalias PersonInfo = (Int, String)
Step-by-Step Solution
Solution:
  1. Step 1: Understand tuple typealias syntax

    Tuples can be aliased using the same syntax: typealias Name = (Type1, Type2).
  2. Step 2: Validate options

    Only typealias PersonInfo = (Int, String) uses the correct syntax with typealias and equals sign.
  3. Final Answer:

    typealias PersonInfo = (Int, String) -> Option A
  4. Quick Check:

    Tuple alias syntax = typealias Name = (Types) [OK]
Quick Trick: Use = after typealias, even for tuples [OK]
Common Mistakes:
  • Omitting the equals sign
  • Swapping type and alias name
  • Using 'alias' instead of 'typealias'

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Swift Quizzes