Bird
0
0

Why is Swift considered strongly typed even though it supports type inference?

hard📝 Conceptual Q10 of 15
Swift - Data Types
Why is Swift considered strongly typed even though it supports type inference?
ABecause it never requires specifying types explicitly
BBecause it ignores types during compilation
CBecause it always knows the exact type at compile time
DBecause it allows variables to change types dynamically
Step-by-Step Solution
Solution:
  1. Step 1: Understand type inference

    Swift can guess the type from the assigned value without explicit annotation.
  2. Step 2: Recognize strong typing with inference

    Even with inference, Swift knows the exact type at compile time and enforces it.
  3. Final Answer:

    Because it always knows the exact type at compile time -> Option C
  4. Quick Check:

    Type inference still enforces strong typing [OK]
Quick Trick: Inference guesses type but keeps strong typing [OK]
Common Mistakes:
  • Confusing inference with dynamic typing
  • Thinking types are optional or ignored
  • Believing variables can change type after inference

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Swift Quizzes