Will this piece of code compile ?
let i = 1
if i {
} else {
}
1: for no 0: for yes
Can a programmer add property observers to inherited properties in Swift?
What will be the output of the following Swift code?
var test: Int?
print(test!)
What keyword do you need to use to make Swift switch statements behave like C/C++ switch statements?
What properties can use property observers in Swift?
Which of the following is not allowed in Swift?
When using inheritance in Swift, which of the following is a requirement for a programmer?
What will be the output of the following lines of code?
struct Test {
var x : Int = 0
func mutatingFunction() {
x += 1
}
}
var test = Test()
print(test.x)
What will be the output of the following code?
struct SomeStruct {
let mult: Int
static subscript(i: Int, j: Int) -> Int {
mult * i * j
}
}
var someVal = SomeStruct(mult: 8)
print(someVal[8, 8])
What will be the output of the following Swift code?
struct Test {
var newVar: Int = 0 {
willSet {
print("\(newValue)")
}
didSet {
print("\(oldValue)")
}
}
}
var test = Test(newVar: 20)
test.newVar = 30
OnSite
1 Openings
FullTime
Posted 17 days ago