All Swift quizzes
Beginner30 questions45 minutes

Swift Beginner Quiz

Master Swift basics including variables, constants, data types, functions, and control flow

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 Swift?

  • A database system
  • A JavaScript framework
  • An IDE
  • Modern, safe, fast programming language for Apple platforms
Show answer

Answer: Modern, safe, fast programming language for Apple platforms. Swift is Apple's modern programming language for iOS, macOS, watchOS, and tvOS. Type-safe, fast, expressive. Introduced in 2014. Replaces Objective-C.

2. What is the difference between var and let?

  • let is deprecated
  • var is mutable, let is immutable
  • var is faster
  • No difference
Show answer

Answer: var is mutable, let is immutable. var creates mutable variable. let creates immutable constant. Prefer let for safety. Use var only when value needs to change. Immutability is encouraged.

3. How do you declare a variable?

  • Both a and b
  • var name: Type = value
  • variable name = value
  • let name = value (for constants)
Show answer

Answer: Both a and b. var age: Int = 25 for mutable. let name = "John" for immutable. Type inference: let count = 5. Explicit type: var price: Double = 9.99. Both are valid.

Frequently asked questions

How many questions are in this Swift quiz?+

30 questions, with a 45-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 beginner quiz aimed at?+

Master Swift basics including variables, constants, data types, functions, and control flow

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, 45 minutes. Free, no sign-up.

Start now