Which keyword do we use to make function arguments mutable in Swift?
What integer literal formats are supported in Swift?
Will an array, a set or a dictionary that a programmer declares be immutable ?
1: For yes
0: For no
2: It depends on the type of assigned storage type.
What will be the output of the following lines of code?
let greatBritishPoundSign = "£"
let price = greatBritishPoundSign + "5000."
print(price)
What will be the output of the following lines of code ?
struct Test {
var newVar : Int = 0{
willSet {
print(" \(newValue)")
}
}
}
var test = Test(newVar: 20)
test.newVar = 30
Which of the following features are exclusive to classes in Swift?
When are extensions used in Swift?
What will be the output of the following lines of code?
enum Beverage: CaseIterable {
case coffee, tea, juice
}
var string = ""
for beverage in Beverage.allCases {
string += String(beverage)
}
print(string)
What will be the output of the following lines of code ?
struct Test {
var someVar : Int = 0
var anotherVar : Int {
get {
return someVar
}
set {
someVar = newValue
}
}
}
var test = Test(someVar: 20)
let valueOfSomeVar = test.anotherVar; print(valueOfSomeVar)
What will be the output of the following lines of code ?
var array = [String]()
for i in 1...3 {
array.append("#String + \(i)#")
}
for i in array {
print(i)
}
The options are :
1. #String + 1#
#String + 2#
#String + 3#
2. String + 1 String + 2 String +3
3. String + 1
String + 2
String + 3
4. None of the above.