Swift language interview questions

Optionals, value semantics, protocols, generics, closures, error handling and the modern Swift features interviews test.

8 quick facts

– interview-ready · 23 questions in this topic

– of 23 tried

Saved on this device. Interview-ready means you got it right on two different days. Guesses and hints count for less.

Questions

  1. Optionals and why Swift has themPredict
  2. Value types vs reference typesPredict
  3. Protocols vs abstract classesPick the fix
  4. Closures and capture listsPredict
  5. @escaping vs non-escaping closuresPick the fix
  6. GenericsPick the fix
  7. Associated types and primary associated typesPick the fix
  8. Enums with associated and raw valuesPredict
  1. willSet and didSetPredict
  2. Stored, computed and lazy propertiesPredict
  3. The defer statementPredict
  4. Result and typed throwsPick the fix
  5. inout parametersPredict
  6. Key pathsPick the fix
  7. Opaque types (some) vs existentials (any)Pick the fix
  8. @autoclosurePredict
  9. Copy-on-writePredict
  10. Property wrappersFill the blank
  11. == vs ===Predict
  12. Swift macrosPick the fix
  13. Phantom typesPick the fix
  14. HashableSpot the bug
  15. Noncopyable types (~Copyable)Pick the fix

Practise this topic

Flashcards · 31

Flip, then say if you knew it. Needs JavaScript; every answer is also on its question page.

Quick quiz · 23 questions

One exercise per question, checked as you go. Needs JavaScript.

Mock interview · 4 sets

Timed, out loud, then tick what you covered. Needs JavaScript.

Fix this PR · 1 review

Review a diff like a senior: flag the lines you'd comment on. Needs JavaScript.

Quick facts

Recall the answer first, then tap Show to check.