All Swift quizzes
Intermediate30 questions60 minutes

Swift Intermediate Quiz

Explore classes, structs, protocols, optionals, error handling, and collections

Start the quiz

Sample questions from this quiz

A preview of the style and depth. Try each one, then reveal the answer — or skip straight to the timed quiz.

1. What is a protocol?

  • All of the above
  • Interface
  • Contract
  • Blueprint of methods and properties
Show answer

Answer: All of the above. Protocol defines requirements: protocol Drawable { func draw() }. Types conform: class Circle: Drawable. Multiple protocols. Protocol-oriented programming. Core Swift paradigm.

2. What is protocol-oriented programming?

  • Interface programming
  • Protocol design
  • Design paradigm using protocols over inheritance
  • Contract coding
Show answer

Answer: Design paradigm using protocols over inheritance. POP uses protocols and extensions. Composition over inheritance. Protocol extensions provide default implementations. Value types with protocol conformance. Swift philosophy.

3. What is extension?

  • Augmentation
  • Type extension
  • Feature addition
  • Adds functionality to existing types
Show answer

Answer: Adds functionality to existing types. Extensions add functionality: extension String { func reversed() -> String }. No subclassing needed. Retroactive modeling. Protocol conformance. Very powerful feature.

Frequently asked questions

How many questions are in this Swift quiz?+

30 questions, with a 60-minute time limit. Every question includes a written explanation of the correct answer.

Is this Swift quiz free?+

Yes. Every quiz on CodexQuizz is free and needs no account. You only enter a name if you choose to post your score to the leaderboard.

What level is the intermediate quiz aimed at?+

Explore classes, structs, protocols, optionals, error handling, and collections

Can I use this to prepare for a Swift interview?+

Yes. The questions cover the topics that come up in Swift technical screens, and the explanations are written so that a wrong answer still teaches you the underlying concept.

Ready to test your Swift?

30 questions, 60 minutes. Free, no sign-up.

Start now