0
0
iOS Swiftmobile~10 mins

Why iOS development targets premium users in iOS Swift - Test Your Understanding

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to print a message about iOS users.

iOS Swift
print("iOS users are often [1] buyers.")
Drag options to blanks, or click blank then click option'
Apremium
Bbudget
Crandom
Dcasual
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing 'budget' because it sounds like a user type.
Selecting 'casual' which does not relate to spending.
2fill in blank
medium

Complete the code to check if a user is premium.

iOS Swift
if user.spending > [1] {
  print("User is premium")
}
Drag options to blanks, or click blank then click option'
A10
B50
C100
D0
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing 0 or 10 which are too low to define premium users.
3fill in blank
hard

Fix the error in the code to identify premium users.

iOS Swift
let isPremium = user.spending [1] 100
if isPremium {
  print("Premium user")
}
Drag options to blanks, or click blank then click option'
A>=
B==
C<
D!=
Attempts:
3 left
💡 Hint
Common Mistakes
Using '==' which only matches exactly 100.
Using '<' which is the opposite of what we want.
4fill in blank
hard

Fill both blanks to create a function that returns true for premium users.

iOS Swift
func isPremiumUser(spending: Int) -> Bool {
  return spending [1] [2]
}
Drag options to blanks, or click blank then click option'
A>=
B<=
C100
D50
Attempts:
3 left
💡 Hint
Common Mistakes
Using '<=' which would mark low spenders as premium.
Using 50 instead of 100 as the threshold.
5fill in blank
hard

Fill all three blanks to create a dictionary filtering premium users.

iOS Swift
let premiumUsers = users.filter { $0.spending [1] [2] }.map { $0.[3] }
Drag options to blanks, or click blank then click option'
A>
B100
Cname
D<
Attempts:
3 left
💡 Hint
Common Mistakes
Using '<' which filters low spenders.
Mapping to wrong property instead of 'name'.