Swift practice
Every Swift exercise, built from a topic you can open beside it.
68 exercises runs offline
All tracks Python 139 JavaScript 184 TypeScript 76 Go 106 Rust 75 Java 81 Kotlin 66 C++ 92 C# 88 Swift 68 PHP 69 Frontend 82 Backend 139 Architecture and system design 25 DevOps and cloud 15 Data and databases 5 Data science 31 AI and LLM engineering 75 Security 26 Game development 26 Coding in the AI era 101 CS foundations 164
level
swift Quiz new Which statement about the scope of ARC is accurate? How Swift ARC governs class-instance lifetimes, and how strong, weak, and unowned references prevent or create reference cycles. swift Quiz new A cached child may outlive its parent, and callers can handle a missing parent. Which dec… How Swift ARC governs class-instance lifetimes, and how strong, weak, and unowned references prevent or create reference cycles. swift Predict the output new What does this program print? How Swift ARC governs class-instance lifetimes, and how strong, weak, and unowned references prevent or create reference cycles. swift Predict the output new What two Boolean values does this program print? How Swift ARC governs class-instance lifetimes, and how strong, weak, and unowned references prevent or create reference cycles. swift Review AI code new Review generated dashboard binding How Swift ARC governs class-instance lifetimes, and how strong, weak, and unowned references prevent or create reference cycles. swift Spot the bug new Spot the bug in the object cycle How Swift ARC governs class-instance lifetimes, and how strong, weak, and unowned references prevent or create reference cycles. swift Quiz new Which statement about @escaping is accurate? Understand Swift function values, capture timing, escaping rules, capture lists, and autoclosures, and design callbacks with explicit lifetime and concurrency semantics. swift Predict the output new What does this program print? Understand Swift function values, capture timing, escaping rules, capture lists, and autoclosures, and design callbacks with explicit lifetime and concurrency semantics. swift Review AI code new Review generated search handler Understand Swift function values, capture timing, escaping rules, capture lists, and autoclosures, and design callbacks with explicit lifetime and concurrency semantics. swift Spot the bug new Spot the bug in the JobQueue Understand Swift function values, capture timing, escaping rules, capture lists, and autoclosures, and design callbacks with explicit lifetime and concurrency semantics. swift Quiz new Three closures are appended inside for index in 0..<3 and invoked after the loop. Which c… Understand Swift function values, capture timing, escaping rules, capture lists, and autoclosures, and design callbacks with explicit lifetime and concurrency semantics. swift Quiz new A transport model only consumes server responses and must never be emitted. Which conform… Use Swift's type system to encode and decode data, with precise control over key mapping, missing values, and diagnostic error paths. swift Quiz new Which sequence preserves the distinction between an absent key and an explicit JSON null? Use Swift's type system to encode and decode data, with precise control over key mapping, missing values, and diagnostic error paths. swift Predict the output new What does this program print? Use Swift's type system to encode and decode data, with precise control over key mapping, missing values, and diagnostic error paths. swift Review AI code new Review generated order decoder Use Swift's type system to encode and decode data, with precise control over key mapping, missing values, and diagnostic error paths. swift Spot the bug new Spot the bug in the Event decoder Use Swift's type system to encode and decode data, with precise control over key mapping, missing values, and diagnostic error paths. swift Quiz new Which model correctly stores a different server message in every failure value? Model finite Swift states and use exhaustive patterns to extract associated values, filter cases, and handle type evolution safely. swift Quiz new When is @unknown default preferable to an ordinary default? Model finite Swift states and use exhaustive patterns to extract associated values, filter cases, and handle type evolution safely. swift Predict the output new What does this program print? Model finite Swift states and use exhaustive patterns to extract associated values, filter cases, and handle type evolution safely. swift Review AI code new Review generated order-state update Model finite Swift states and use exhaustive patterns to extract associated values, filter cases, and handle type evolution safely. swift Spot the bug new Spot the bug in the .copying branch Model finite Swift states and use exhaustive patterns to extract associated values, filter cases, and handle type evolution safely. swift Quiz new When is try? the most accurate API choice? Model recoverable failure with Error, throw, do-catch, typed throws, and Result while preserving useful information at the right boundary. swift Quiz new What guarantee does throws(ParseError) add to a function declaration? Model recoverable failure with Error, throw, do-catch, typed throws, and Result while preserving useful information at the right boundary. swift Predict the output new What does this program print? Model recoverable failure with Error, throw, do-catch, typed throws, and Result while preserving useful information at the right boundary. swift Review AI code new Review generated order importer Model recoverable failure with Error, throw, do-catch, typed throws, and Result while preserving useful information at the right boundary. swift Spot the bug new Spot the bug in the profile fallback Model recoverable failure with Error, throw, do-catch, typed throws, and Result while preserving useful information at the right boundary. swift Quiz new Which declaration can a Swift extension validly add? Add computed properties, methods, and conformances to existing Swift types without confusing dispatch, storage, or module ownership. swift Predict the output new What does this program print? Add computed properties, methods, and conformances to existing Swift types without confusing dispatch, storage, or module ownership. swift Quiz new What does @retroactive mean on a Swift protocol conformance? Add computed properties, methods, and conformances to existing Swift types without confusing dispatch, storage, or module ownership. swift Review AI code new Review generated customer extensions Add computed properties, methods, and conformances to existing Swift types without confusing dispatch, storage, or module ownership. swift Spot the bug new Spot the bug in the safe subscript Add computed properties, methods, and conformances to existing Swift types without confusing dispatch, storage, or module ownership. swift Quiz new Which statement about var retryCount = 0 is correct? Swift's static types, immutable and mutable bindings, safe conversions, control flow, functions, collections, and value semantics in working programs. swift Quiz new Why does Swift not accept text[0] for a String? Swift's static types, immutable and mutable bindings, safe conversions, control flow, functions, collections, and value semantics in working programs. swift Predict the output new What does this program print? Swift's static types, immutable and mutable bindings, safe conversions, control flow, functions, collections, and value semantics in working programs. swift Review AI code new Review generated check-in summary Swift's static types, immutable and mutable bindings, safe conversions, control flow, functions, collections, and value semantics in working programs. swift Spot the bug new Spot the bug in the region lookup Swift's static types, immutable and mutable bindings, safe conversions, control flow, functions, collections, and value semantics in working programs. swift Predict the output new What does this program print? Use type parameters, constraints, where clauses, and associated types to write reusable Swift while preserving compile-time type relationships. swift Quiz new What does the `Item` in `protocol Catalog<Item>` represent? Use type parameters, constraints, where clauses, and associated types to write reusable Swift while preserving compile-time type relationships. swift Review AI code new Review generated generic store Use type parameters, constraints, where clauses, and associated types to write reusable Swift while preserving compile-time type relationships. swift Quiz new What does `where Left.Element == Right.Element` require? Use type parameters, constraints, where clauses, and associated types to write reusable Swift while preserving compile-time type relationships. swift Spot the bug new Spot the bug in the smallest helper Use type parameters, constraints, where clauses, and associated types to write reusable Swift while preserving compile-time type relationships. swift Quiz new Why does input.flatMap { Int($0) } return Int? instead of Int??? Model missing values in the type system and use binding, chaining, coalescing, transformations, and nested optionals without losing meaning. swift Quiz new Which statement accurately describes String? in Swift? Model missing values in the type system and use binding, chaining, coalescing, transformations, and nested optionals without losing meaning. swift Predict the output new Which three states are printed for these dictionary lookups? Model missing values in the type system and use binding, chaining, coalescing, transformations, and nested optionals without losing meaning. swift Predict the output new What does this program print? Model missing values in the type system and use binding, chaining, coalescing, transformations, and nested optionals without losing meaning. swift Review AI code new Review a generated account importer Model missing values in the type system and use binding, chaining, coalescing, transformations, and nested optionals without losing meaning. swift Spot the bug new Spot the bug in the email lookup Model missing values in the type system and use binding, chaining, coalescing, transformations, and nested optionals without losing meaning. swift Quiz new Which statement is correct in Swift 6 language mode? Understand how Swift property wrappers synthesize storage, wrapped and projected values, and how they affect initialization, copying, Codable, and concurrency. swift Predict the output new What does this program print? Understand how Swift property wrappers synthesize storage, wrapped and projected values, and how they affect initialization, copying, Codable, and concurrency. swift Review AI code new Review a generated JSON setting wrapper Understand how Swift property wrappers synthesize storage, wrapped and projected values, and how they affect initialization, copying, Codable, and concurrency. swift Spot the bug new Spot the bug in Atomic increment Understand how Swift property wrappers synthesize storage, wrapped and projected values, and how they affect initialization, copying, Codable, and concurrency. swift Quiz new For @Rule var score: Int, which synthesized-name description is accurate? Understand how Swift property wrappers synthesize storage, wrapped and projected values, and how they affect initialization, copying, Codable, and concurrency. swift Quiz new Which boundary should hold Circle and Rectangle values in the same array while exposing o… Define capability boundaries with protocols, and understand requirements, conformance, defaults, associated types, some, and any. swift Predict the output new What does this program print? Define capability boundaries with protocols, and understand requirements, conformance, defaults, associated types, some, and any. swift Quiz new What does `var token: String { get }` require from a conforming type? Define capability boundaries with protocols, and understand requirements, conformance, defaults, associated types, some, and any. swift Review AI code new Review a generated processor registry Define capability boundaries with protocols, and understand requirements, conformance, defaults, associated types, some, and any. swift Spot the bug new Spot the bug in the Incrementable protocol Define capability boundaries with protocols, and understand requirements, conformance, defaults, associated types, some, and any. swift Quiz new Who determines the `Item` in a conformance to `protocol Catalog<Item>`? Declare capabilities with Swift protocols, preserve type relationships with generics, and choose associated types, some, and any precisely. swift Quiz new Which form fits a returned value whose implementation chooses one hidden concrete type? Declare capabilities with Swift protocols, preserve type relationships with generics, and choose associated types, some, and any precisely. swift Quiz new Only `sortedValues()` compares a container’s elements. Where should `Element: Comparable`… Declare capabilities with Swift protocols, preserve type relationships with generics, and choose associated types, some, and any precisely. swift Predict the output new What does this program print? Declare capabilities with Swift protocols, preserve type relationships with generics, and choose associated types, some, and any precisely. swift Review AI code new Review a generated generic registry Declare capabilities with Swift protocols, preserve type relationships with generics, and choose associated types, some, and any precisely. swift Spot the bug new Spot the bug in protocol labeling Declare capabilities with Swift protocols, preserve type relationships with generics, and choose associated types, some, and any precisely. swift Quiz new What does let session = Session() guarantee when Session is a class with mutable properti… Choose Swift structures or classes using value semantics, reference identity, initialization, and copy-on-write without accidental shared state. swift Quiz new How should a public library treat a structure’s synthesized memberwise initializer? Choose Swift structures or classes using value semantics, reference identity, initialization, and copy-on-write without accidental shared state. swift Predict the output new What does this program print? Choose Swift structures or classes using value semantics, reference identity, initialization, and copy-on-write without accidental shared state. swift Review AI code new Review generated invoice copy Choose Swift structures or classes using value semantics, reference identity, initialization, and copy-on-write without accidental shared state. swift Spot the bug new Spot the bug in the Counter binding Choose Swift structures or classes using value semantics, reference identity, initialization, and copy-on-write without accidental shared state.
No practice items match these filters.