All Swift classes must inherit from which root class?
Swift classes do not require a root class. 80.0%
NSObject 0.0%
@ObjC 0.0%
Root 20.0%
Can enumeration type have methods?
Enumerations can have methods associate with them. 100.0%
Enumerations can have only member values. 0.0%
Considering var index = UInt8.max, which of the following operation results to the value of zero for var index?
index = index &- 1 0.0%
index = index &+ 1 50.0%
index = index &* 1 50.0%
index = index &/ 255 0.0%
Given that we have defined myChar like so : let myChar: Character = "b" Which code segment can be considered a complete Switch statement and will run without any error?
switch myChar { case "a","A": println("The letter A") case "b","B": println("The letter A") } 0.0%
switch myChar { case "a": println("The letter A") } 33.0%
switch myChar { case "a": case "A": println("The letter A") default: println("Not the letter A") } 0.0%
switch myChar { case "a","A": println("The letter A") default: println("Not the letter A") } 66.0%
If we have a class named MyClass with a nested enum called Status, declared like so: class MyClass { enum Status { case On, Off } } How would one indicate that a variable is an enum...
var status: MyClass.Status = .On 50.0%
var status: Status = .On 0.0%
var status: MyClass<Status> = .On 50.0%
var status: MyClass(Status) = .On 0.0%
In context of a Swift subscript, which of the following is correct?
struct MyStruct { var myStr = [String]() subscript (index : Int) -> String{ get{ return myStr[index] } set{ myStr[index] = newValue } } } 33.0%
struct MyStruct { var myStr = [String]() subscript (index : Int) -> Int{ get{ return myStr[index] } set(newValue){ myStr[index] = newValue } } } 66.0%
struct MyStruct { var myStr = [String]() subscript (index : Int) -> String{ get(){ return myStr[index] } set(newValue){ myStr[index] = newValue } } } 0.0%
struct MyStruct { var myStr = [String] subscript (index : Int) -> String{ get(){ return myStr[index] } set(newValue){ myStr[index] = newValue } } } 0.0%
What attribute can be used to allow a protocol to contain optional functions and to be used in ObjC?
objective_bridge 33.0%
ObjC 0.0%
_objc 0.0%
@objc 66.0%
What does a retainCount represent in ARC?
The current number of strong references to an object. 50.0%
The current number of instances of an object. 0.0%
The total number of objects currently being retained in memory. 0.0%
The total number of times an object has been allocated. 50.0%
What is the name of the deinitializer in a Class declaration?
deinit 50.0%
dealloc 50.0%
release 0.0%
What is the name of the Swift language feature that Objective-C Blocks are translated into?
Lambda 0.0%
Callback 50.0%
Closure 50.0%
Selector 0.0%
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?
ExampleSwift.h 0.0%
Example.Swift.h 0.0%
Example+Swift.h 50.0%
Example-Swift.h 50.0%
What is the output of this segment of code ? var x = 0 for index in 1...5 { ++x } println("(x)")
0 0.0%
compile error 0.0%
5 50.0%
4 50.0%
What is the type of Swift Enumerations?
Reference type 50.0%
Class type 0.0%
Collection type 0.0%
Value type 50.0%
What is used to import Objective-C files into Swift?
Objective-C classes are automatically imported. 50.0%
Objective-C classes are imported in the Swift file using the class. 0.0%
Objective-C classes are imported via a Bridging Header. 50.0%
Objective-C classes import themselves by declare @SwiftImportable. 0.0%
What keyword is used to indicate a custom operator that will appear in between two targets, similar to the addition operator in this example? var sum = 10 + 10
@inter 50.0%
between 0.0%
infix 50.0%
@center 0.0%
What type of object are Swift Structures?
Reference Type 50.0%
Memory Type 0.0%
Abstract Type 0.0%
Value Type 50.0%
When declaring an enumeration, multiple member values can appear on a single line, separated by which punctuation mark?
Semi-colon 0.0%
Colon 0.0%
Comma 100.0%
Slash 0.0%
Point 0.0%
Which is the wrong definition of a protocol in Swift?
protocol SomeProtocol { var first: Int{ get } } 50.0%
protocol SomeProtocol { var first: Int{ set } } 50.0%
protocol SomeProtocol { var first: Int { get set } } 0.0%
protocol SomeProtocol { var first: Int { get set } var second: Int { get } } 0.0%
Which is correct for Enumerations?
Enumerations can define initializers. 50.0%
Enumerations cannot conform to protocols. 50.0%
Enumerations cannot conform to protocols. 0.0%
Which is correct regarding Swift enumeration members when they are defined?
Members are assigned a default integer value. 50.0%
Members are assigned a random default integer value. 0.0%
Members are not assigned default integer values. 50.0%
Which is used for down casting?
as! 50.0%
is 0.0%
is? 0.0%
as? 50.0%
Which keyword do you use to declare enumeration?
var 0.0%
enum 100.0%
struct 0.0%
case 0.0%
Which keyword in the context of a Switch statement is required to force the execution of a subsequent case?
fallthrough 50.0%
continue 50.0%
break 0.0%
return 0.0%
Which keyword is used in Swift when we want a property of a class to initialize when it is accessed for the first time?
let 50.0%
var 0.0%
const 0.0%
lazy 50.0%
Which keyword is used on a function in an enumeration to indicate that the function will modify 'self'?
modifier 0.0%
mutating 100.0%
mutable 0.0%
mod 0.0%
mut 0.0%
Which of the following could be used to indicate the Function Type of the following function: func joinStrings(stringOne: String, stringTwo: String) -> String { return stringOne + stringTwo }
func(String, String -> String) 0.0%
(String, String) -> String 100.0%
{String, String} -> String 0.0%
{String, String}(String) 0.0%
Which of the following declares a mutable array in Swift?
var x = [Int] 50.0%
let x = [Int] 0.0%
var x = [Int]() 50.0%
let x = [Int]() 0.0%
Which of the following statements could be used to determine if a given variable is of String type?
if String.hierarchy(unknownVariable) { } 0.0%
if unknownVariable is String { } 100.0%
if unkownVariable: String { } 0.0%
if (String)unknownVariable { } 0.0%
Which of the following structures has both computed and stored properties?
struct Rect { var origin = CGPointZero var center: CGPoint { get { // } set { // } } } 100.0%
struct Rect { var center: CGPoint { get { // } set { // } } } 0.0%
struct Rect { let origin = CGPointZero } 0.0%
struct Rect { var origin = CGPointZero var center: CGPointMake(0,0) } 0.0%
Which of the following types can be used use as raw value types for an enumeration?
Bool 0.0%
Array 0.0%
Int, String, Float 100.0%
Dictionary 0.0%
Which of these could be an appropriate protocol declaration in Swift?
@objc protocol someProtocal { optional var first: Int { get } } 100.0%
@objc protocol someProtocal { optional var first: Int { set } } 0.0%
protocol someProtocal { optional var first: Int { get } } 0.0%
protocol someProtocal { var first: Int { set } } 0.0%
Which of these is a valid definition of a generic function that incorporates inout parameters in Swift?
func swap<T>(inout a: T, inout b: T) { let temp = a a = b b = temp } 100.0%
func swap<U,T>(inout a: U, inout b: T) { let temp = a a = b b = temp } 0.0%
func swap<U,T>( a: U, b: T) { let temp = a a = b b = temp } 0.0%
func swap<T>( a: T, b: T) { let temp = a a = b b = temp } 0.0%
Which of these is a valid syntax for iterating through the keys and values of a dictionary? let dictionary = [keyOne : valueOne, keyTwo : valueTwo]
for (key, value) in dictionary { println("Key: (key) Value: (value)") } 100.0%
for (key, value) in enumerate(dictionary) { println("Key: (key) Value: (value)") } 0.0%
for (key, value) in (dictionary.keys, dictionary.values) { println("Key: (key) Value: (value)") } 0.0%
for (key, value) in dictionary.enumerate() { println("Key: (key) Value: (value)") } 0.0%
Which of these is an appropriate syntax for declaring a function that takes an argument of a generic type?
func genericFunction(argument: T<Generic>) { } 0.0%
func genericFunction<T>(argument) { } 0.0%
generic func genericFunction(argument: T) { } 0.0%
func genericFunction<T>(argument: T) { } 100.0%
Which of these is an appropriate syntax for dispatching a heavy operation to a background thread?
dispatch_async(DISPATCH_QUEUE_PRIORITY_BACKGROUND), { self.heavyOperation() }) 0.0%
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0), { self.heavyOperation() }) 100.0%
DISPATCH_QUEUE_PRIORITY_BACKGROUND({ self.heavyOperation() }) 0.0%
dispatch_async({ self.heavyOperation() }) 0.0%
Which of these is not a valid property declaration in Swift?
final let x = 0 0.0%
final lazy let x = 0 100.0%
final lazy var x = 0 0.0%
final var x = 0 0.0%
Which of these statements is a valid way to extend the capabilities of our theoretical class, MyClass to conform to protocol MyProtocol?
extension MyClass(MyProtocol) { } 0.0%
extension MyClass, prot MyProtocol { } 0.0%
extension MyClass: MyProtocol { } 100.0%
extension MyClass, MyProtocol { } 0.0%
Which one creates a dictionary with a key type of Integer and value of String?
var dict:[Int: String] = ["one":1] 0.0%
var dict: [Int: String] = [1:"one"] 100.0%
var dict: [String: Int] = [1:"one"] 0.0%
var dict = ["one":1] 0.0%
Which one is the correct keyword for defining a constant in Swift?
const 0.0%
contant 0.0%
final 0.0%
let 100.0%
def 0.0%
Which one of the below functions definitions is wrong considering Swift language?
func haveChar(#string: String, character: Character) -> (Bool) 50.0%
func mean(numbers: Double...) -> Double 50.0%
func minMax(array: [Int]) -> (min: Int, max: Int)? 0.0%
func minMax(array: [Int]) -> (min: Int?, max: Int?) 0.0%