Swift

0
Answered
0
Correct
0%
Accuracy
Question 1 Easy Mcq

What is printed to the console when this code is executed? "t".forEach { (char) in; print(char) }

Question 2 Easy Mcq

What is this code an example of? let val = (Double)6

Question 3 Easy Mcq

What is the result of the following code?func potteryBarn (name: String, score: Int) -> String { return "Hello (name)!Your score is (score)." }potteryBarn ("Tom" , 2)

Question 4 Easy Mcq

What is the base class in this code? class LSN : MMM {}

Question 5 Easy Mcq

What is wrong with this code? var x = 5; x = 10.0

Question 6 Easy Mcq

What is true about Memory management in Swift?

Question 7 Easy Mcq

In the below text, what is the name of the class’s only method?Class Square: NamedShape {var sideLength: Doublefunc area() -> Double {return sideLength*sideLength}}

Question 8 Easy Mcq

What is the return value of the type check operator - is ?

Question 9 Easy Mcq

In the below text, what is the property name?class Square: NamedShape {var sideLength: Double func area() -> Double { return sideLength * sideLength }}

Question 10 Easy Mcq

What is the name of the Objective-C Bridging Header given a product module namedExample?

Question 11 Easy Mcq

Which is the wrong definition of a protocol in Swift?

Question 12 Easy Mcq

Which one is correct function definition?

Question 13 Easy Mcq

What is a trailing closure?

Question 14 Easy Mcq

What is Swift ?

Question 15 Easy Mcq

What is the value of y? let x = ["1", "2"].dropFirst() let y = x[0]

Question 16 Easy Mcq

What is wrong with this code? if let s = String.init("some string") { print(s)}

Question 17 Easy Mcq

What is the inferred type of x? let x = ["a", "b", "c"]

Question 18 Easy Mcq

What is the output of this segment of code:var x = 0 for index in 1...5 { ++x } print("(x)")

Question 19 Easy Mcq

Which of these is a valid definition of a generic function that incorporates inoutparameters in Swift?

Question 20 Easy Mcq

What is true of this code? let name: String?

Question 21 Easy Mcq

What is the value of t after this code is executed? let names = ["Larry", "Sven", "Bear"] let t = names.enumerated().first().offset

Question 22 Easy Mcq

What is the correct way to call this function? func myFunc(_ a: Int, b: Int) -> Int {return a + b}

Question 23 Easy Mcq

What is Managing Memory in Swift?

Question 24 Easy Mcq

What is used in Swift to represent any kind of object?

Question 25 Easy Mcq

In the below text, what is the super class name?class Square: NamedShape {var sideLength: Double func area() -> Double { return sideLength * sideLength }}

Question 26 Easy Mcq

What is the type of Swift String, Dictionary, Array?

Question 27 Easy Mcq

In the below text, what is the class name?Class Square: NamedShape {var sideLength: Doublefunc area() -> Double {return sideLength*sideLength}}

Question 28 Easy Mcq

What is the return type of the following code? func nameFunc() -> String { return "Jhon" }

Question 29 Easy Mcq

What is the return type in the following declaration:func potteryBarn (name: String, score: Int) -> String { return "Hello (name)!Your score is (score)." }

Question 30 Easy Mcq

What is the value of test in this code? var test = 1 == 1

Question 31 Easy Mcq

What is the need for having structures?

Question 32 Easy Mcq

What is the name of the following function:func potteryBarn (name: String, score: Int) -> String { return "Hello (name)!Your score is (score)." }

Question 33 Easy Mcq

____ in Swift is implemented with the is and as operators. These two operators provide a simple and expressive way to check the type of a value or cast a value to a different type?

Question 34 Easy Mcq

What is the name of the deinitializer in a Class declaration?

Question 35 Easy Mcq

If a class has a superclass and conforms to multiple protocols, what is the correct order to list their names in the initial definition of the Subclass?

Question 36 Easy Mcq

How can you use a nested type outside of its definition?

Question 37 Easy Mcq

What is the error in this code? let x = 5; guard x == 5 { return }

Question 38 Easy Mcq

What is the type name that represents a character in Swift?

Question 39 Easy Mcq

What is the output when following statement is executed?import UIKitlet filename:String = "test.dat";let write_data:String = "write data";var read_data:String = "read data";if let directory = NSSearchPathForDirectoriesInDomains(NSSearchPathDirectory.DocumentDirectory, NSSearchPathDomainMask.AllDomainsMask, true).first{let pathname = NSURL(fileURLWithPath:directory).URLByAppendingPathComponent(filename);do {trywrite_data.writeToURL(pathname, atomically: false, encoding: N SUTF8StringEncoding) }catch { print(“write error”) }//readingdo{ read_data = try NSString(contentsOfURL: pathname, encoding: NSUTF8StringEncoding) as String } catch{ print(“read error”) } print(read_data) }

Question 40 Easy Mcq

What is the typical byte width of Float data type in Swift?

Question 41 Easy Mcq

Which one of the below functions definitions is wrong considering Swift language?

Question 42 Easy Mcq

extension Int {subscript(var myInt: Int) -> Int {var no1 = 1while myInt > 0 {no1 *= 10--myInt}return (self / no1) % 10}}print(12[0])What is the output?

Question 43 Easy Mcq

What is the name of the Swift language feature that Objective-C Blocks are translatedinto?

Question 44 Easy Mcq

What is the value of numbers in the code below? let numbers = [1,2,3,4,5,6].filter{ $0 % 2 == 0}

Question 45 Easy Mcq

What is the most basic difference between Value and Reference types?

Question 46 Easy Mcq

What is the output when following code is executed? import UIKit import AVFoundation var p: AVAudioPlayer? func func(filename:String) { let url = NSBundle.mainBundle().URLForResource(filename, withExtension: "caf")! do { p = try AVAudioPlayer(contentsOfURL: url) guard let p = p else { return } … … … p.prepareToPlay() p.play() } catch let error as NSError { print(error.description) } }

Question 47 Easy Mcq

What is a muting instance method in Swift?

Question 48 Easy Mcq

What is the value of y? var x: Int? let y = x ?? 5

Question 49 Easy Mcq

What is the output of this segment of code?var x = 0for index in 1...5 {++x}println("\(x)")

Question 50 Easy Mcq

What is the correct way to import Objective-C files into Swift?

Showing 50 of 67 questions