Skip to content

Swift MCQ Questions

0
Answered
0
Correct
0%
Accuracy
Q51 Easy

What is the value of val after this code is executed? let i = 5; let val = i * 6.0

Q52 Easy

What is the type of value1 in this code? let value1 = "\("test".count)"

Q53 Easy

What is wrong with this code? for (key, value) in [1: "one", 2: "two"]{print(key, value)}

Q54 Easy

What is the value of test after this code executes? let vt = (name: "ABC", val: 5) let test = vt.0

Q55 Easy

What is the name of the Xcode generated header file used to import Swift classes into an Objective-C Class given a product module named Example?

Q56 Easy

What is the correct way to add a value to this array? var strings = [1, 2, 3]

Q57 Easy

What is the correct way to import an Objective-C class into bridging header file?

Q58 Easy

What is the correct way to declare Decomposed Tuple?

Q59 Easy

What is the type of Swift Enumerations?

Q60 Easy

What is the type of this function? func add(a: Int, b: Int) -> Int { return a+b }

Q61 Easy

What is used to import Objective-C files into Swift?

Q62 Easy

What is a mutating instance method in Swift?

Q63 Easy

What is the raw/underlying type of this enum? enum Direction {case north, south, east, west}

Q64 Easy

What is the type of vals in this code? let vals = ["a", 1, "Hi"]

Q65 Easy

What is this code an example of? let val = 5; print("value is: \(val)")

Q66 Easy

What is the difference between let and var in swift? let x = 10 var x = 10

Q67 Easy

What is wrong with this code? Let val = 5.0 + 10

Report a mistake

What's wrong?