Bird
0
0

You want to store a user's age, height in meters, full name, and whether they are a student. Which Swift data types should you use for these variables respectively?

hard📝 Application Q15 of 15
iOS Swift - Swift Language Essentials
You want to store a user's age, height in meters, full name, and whether they are a student. Which Swift data types should you use for these variables respectively?
AString, String, Int, Bool
BDouble, Int, Bool, String
CInt, Double, String, Bool
DBool, Int, Double, String
Step-by-Step Solution
Solution:
  1. Step 1: Match each data to its type

    Age is a whole number -> Int, height with decimals -> Double, full name is text -> String, student status true/false -> Bool.
  2. Step 2: Verify option matches order

    Int, Double, String, Bool lists Int, Double, String, Bool in that order, matching the variables correctly.
  3. Final Answer:

    Int, Double, String, Bool -> Option C
  4. Quick Check:

    Whole number, decimal, text, true/false [OK]
Quick Trick: Match data meaning: whole, decimal, text, true/false [OK]
Common Mistakes:
  • Mixing Int and Double
  • Using Bool for text
  • Confusing order of types

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More iOS Swift Quizzes