Answer each question in your own words first, then compare. Interviewers care more about clear thinking than memorized lines.
Q1. What is the difference between let and var?
let declares a constant that cannot change after it is set. var declares a variable that can change. Prefer let by default; it makes code safer and easier to reason about.
Q2. What is type inference?
Swift works out a value's type from the value you give it, so let n = 5 is an Int. You can still write the type yourself, like let n: Double = 5.
Q3. What is an optional?
An optional is a type that either holds a value or is nil, written like String?. It forces you to handle missing values instead of crashing on null.
Q4. How do you safely unwrap an optional?
Use if let, guard let, optional chaining (a?.b) or the nil-coalescing operator (??). Avoid force unwrapping with ! unless you are sure the value exists.
Q5. What is the difference between if let and guard let?
if let makes the unwrapped value available inside its block. guard let makes it available for the rest of the scope and requires an early exit in its else branch, which keeps code flat and readable.
Q6. What is the difference between a struct and a class?
Structs are value types: assigning copies them. Classes are reference types: assigning shares one instance. Only classes support inheritance and deinit. Prefer structs unless you need shared identity or inheritance.
Q7. What does mutating mean?
A struct method that changes the struct's own properties must be marked mutating, because it replaces the value.
Q8. What is an enum with associated values?
Each case can carry extra data, such as case failure(String). You read the data with switch and pattern matching.
Q9. What is a protocol?
A protocol defines a set of requirements (methods and properties) that a type promises to provide. Structs, classes and enums can all conform to protocols.
Q10. What is an extension?
An extension adds new functionality, such as methods or computed properties, to an existing type, including types you do not own. Extensions cannot add stored properties.
Q11. What is a closure?
A closure is a block of code you can store and pass around, and it can capture values from its surroundings. Example: numbers.map { $0 * 2 }.
Q12. What is the difference between map, filter and reduce?
map transforms each element. filter keeps elements that pass a test. reduce combines all elements into a single value.
Q13. What is an array vs a set vs a dictionary?
An array is ordered and allows duplicates. A set is unordered with unique elements. A dictionary stores key-value pairs with unique keys.
Q14. How does error handling work in Swift?
A function marked throws can throw values that conform to Error. The caller uses try inside do { } catch { }, or try? to get an optional result.
Q15. What is Codable?
A shortcut for Encodable and Decodable. If your properties are Codable, Swift can convert your type to and from formats such as JSON with little code.
Q16. What is ARC?
Automatic Reference Counting frees a class instance when no strong references to it remain. You avoid leaks by preventing strong reference cycles.
Q17. What is the difference between weak and unowned?
Both avoid strong cycles. weak is optional and becomes nil when the object is freed. unowned is not optional and crashes if you use it after the object is gone.
Q18. What does final do?
It stops a class, method or property from being subclassed or overridden. It communicates intent and can help the compiler optimize.
Q19. What is the difference between == and ===?
== compares values using Equatable. === checks whether two class references point to the same instance.
Q20. What is a computed property?
A property that calculates its value each time you read it instead of storing it. It can also have a setter.
Tips
- Write small code samples while you explain
- Say why, not only what
- If you do not know, explain how you would find out
Conclusion
These 20 questions cover the core language. If you can explain each one with a tiny example, you are ready for most entry-level rounds.

