What is Swift?
A programming language
A mobile app development tool
A cloud computing service
A game development engine
Which company developed Swift?
Google
Apple
Microsoft
Amazon
What is the latest version of Swift as of 2023?
Swift 4
Swift 5
Swift 6
Swift 7
What is an optional in Swift?
A variable that is not required
A variable that cannot be changed
A variable that has a default value
A variable that is only used in certain cases
What is a closure in Swift?
A block of code that can be called later
A type of function
An optional variable
A type of loop
What is a protocol in Swift?
A blueprint for methods, properties, and other requirements that suit a particular task or piece of functionality
A type of data structure
A set of predefined functions
A type of loop
What is the difference between a struct and a class in Swift?
Classes are reference types, while structs are value types
Classes cannot have methods, while structs can
Classes are more memory-efficient than structs
Structs are only used in specific cases, while classes are more general-purpose
What is an enum in Swift?
A type that defines a group of related values
A type of loop
A type of function
A type of variable
What is type casting in Swift?
The process of checking and changing the type of an instance
The process of converting a variable to a string
The process of converting a variable to an integer
The process of checking the validity of a variable
What is the difference between a constant and a variable in Swift?
A constant cannot be changed once it is set, while a variable can be changed
A variable cannot be changed once it is set, while a constant can be changed
There is no difference between a constant and a variable in Swift
A constant is used for integers, while a variable is used for strings
What is an extension in Swift?
A way to add functionality to an existing type
A type of loop
A type of function
A way to declare a constant
What is the difference between an implicitly unwrapped optional and a regular optional in Swift?
An implicitly unwrapped optional does not need to be unwrapped, while a regular optional does
A regular optional does not need to be unwrapped, while an implicitly unwrapped optional does
There is no difference between an implicitly unwrapped optional and a regular optional in Swift
An implicitly unwrapped optional can only be used in certain cases, while a regular optional can be used anywhere
What is a guard statement in Swift?
A statement that provides early exit from a function
A statement that declares a variable
A type of loop
A statement that adds functionality to an existing type
What is a tuple in Swift?
A group of values that can be treated as a single entity
A type of loop
A type of function
A way to declare a constant
What is a computed property in Swift?
A property that is computed every time it is accessed, rather than being stored
A property that is stored in memory and can be changed
A type of function
A way to declare a constant
What is a lazy property in Swift?
A property that is only computed when it is accessed for the first time
A property that is computed every time it is accessed, rather than being stored
A property that is stored in memory and can be changed
A way to declare a constant
What is the difference between a protocol and a class in Swift?
A class can be instantiated, while a protocol cannot
A protocol can be instantiated, while a class cannot
There is no difference between a protocol and a class in Swift
A class is used for integers, while a protocol is used for strings
What is the purpose of the 'guard let' statement in Swift?
To safely unwrap an optional value and provide an early exit from a function if the value is nil
To declare a new variable
To add functionality to an existing type
To declare a constant
What is a closure in Swift?
A self-contained block of functionality that can be passed around and used in your code
A type of loop
A type of function
A way to declare a constant
What is the difference between a value type and a reference type in Swift?
A value type is copied when it is passed to a function or assigned to a new variable, while a reference type is not
A reference type is copied when it is passed to a function or assigned to a new variable, while a value type is not
There is no difference between a value type and a reference type in Swift
A value type is used for strings, while a reference type is used for integers
What is a type alias in Swift?
A way to provide an alternate name for an existing type
A type of loop
A type of function
A way to declare a constant
What is the purpose of the 'defer' statement in Swift?
To ensure that a set of statements is executed before a function returns, regardless of whether the function completes successfully or not
To add functionality to an existing type
To declare a new variable
To declare a constant
What is the difference between a struct and a class in Swift?
A struct is a value type, while a class is a reference type
A class is a value type, while a struct is a reference type
There is no difference between a struct and a class in Swift
A struct can be instantiated, while a class cannot
What is a lazy stored property in Swift?
A property that is not initialized until it is accessed for the first time
A property that is only accessible within the same class
A property that is automatically initialized with a default value
A property that cannot be changed once it is set
What is the purpose of the 'mutating' keyword in Swift?
To indicate that a method can modify the properties of a struct or an enum
To declare a new variable
To indicate that a method cannot modify the properties of a struct or an enum
To add functionality to an existing type
What is a computed property in Swift?
A property that does not store a value, but instead provides a getter and/or a setter to retrieve and/or modify the value of other properties or variables
A property that is only accessible within the same class
A property that is automatically initialized with a default value
A property that cannot be changed once it is set
What is an optional in Swift?
A variable or a constant that may or may not have a value
A variable or a constant that always has a value
A type of loop
A type of function
Post a Comment
Post a Comment