Bird
0
0

Consider this Swift code: let userSpending = 150.0 let isPremium = userSpending > 100 print(isPremium) What is the printed output?

medium📝 Predict Output Q5 of 15
iOS Swift - iOS Basics and Setup
Consider this Swift code: let userSpending = 150.0 let isPremium = userSpending > 100 print(isPremium) What is the printed output?
Atrue
Bfalse
C150.0
DError: type mismatch
Step-by-Step Solution
Solution:
  1. Step 1: Evaluate the comparison expression

    150.0 is greater than 100, so isPremium is true.
  2. Step 2: Understand print output

    print(isPremium) outputs true.
  3. Final Answer:

    true -> Option A
  4. Quick Check:

    Comparison result = B [OK]
Quick Trick: Comparison > returns Bool true or false [OK]
Common Mistakes:
  • Confusing numeric value with Boolean
  • Expecting error due to type

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More iOS Swift Quizzes