What is the output of this segment of code:var x = 0 for index in 1...5 { ++x } print("(x)")
Correct Answer: 5
Explanation:
Note: This Question is unanswered, help us to find answer for this one
Swift Skill Assessment
Your Skill Level: Poor
Retake Quizzes to improve it
More Swift MCQ Questions
Can Structures be type cast in Swift?
To declare a constant in Swift you would use:
If we have a class named MyClass with a nested enum called Status, declared like so: class MyClass { enum Status { case On, Off } }
What is a mutating instance method in Swift?
Which keyword do you use to define a class?
Compare the below code and what will result? import UIKit var rank:Dictionary = [1:'First', 2: 'Second', 3: 'Third']; rank.updateValue('Forth', forKey: 4);
Problem in following code? import UIKit ; var intVar:Int?=3; intVar = nil; var strVar:String; strVar = nil;
Problem with code? import UIKit let fm = NSFileManager.defaultManager() fm.removeItemAtPath('file.old')
Use the classes defined above to create a new Person instance, and try to access its numberOfRooms property as before?
Output? import UIKit var str1:String?='text1'; var str2:String='text2'; var int1:Int?=111; var int2:Int=222; var array:String[] = [str1, str2, int1, int2]; array=[];