Swift Quiz # 10

Instructions
Quiz: Swift Quiz # 10
Subject: Basic Swift
Total Questions: 30 MCQs
Time: 30 Minutes

Note

  • Do not refresh the page while taking the test.
  • Results along with correct answers will be shown at the end of the test.
Swift Quiz # 10
Question 1 of 30
00:00
  • Overriding functionality is possible using extension

  • Objective-C class factory methods will change into _____ after importing to Swift

  • Bridging header file will not be compiled due to the following issues:

  • Which is the correct naming scheme for an Objective-C bridging header file into Swift project

  • var tools: Set = ["Screwdriver", "Pliers", "Screwdriver"]

    var tools: Set = ["Screwdriver", "Pliers", "Screwdriver"]

    Which is correct?

  • We can create an array of any type

  • var myVar = 100

    myVar = "Hello World"

    print(varA)

    The output will be

  • print(myStr) What will be the output of the above code snippet in Swift4?

  • var varB = 3.14159ng is the c

    varB is inferred to be of type _____

  • A closure is a function without a name.

  • Can cyclical relationships exist in value types?

  • A sequence of characters surrounded by double quotes is called _____?

  • The following are unordered collection types:

  • Typical range of type Int8 is __

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

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

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

  • Why is dispatchGroup used in certain situations?

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

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

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

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

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

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

  • The Codable protocol is _?

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

  • When a function takes a closure as a parameter, when do you want to mark is as escaping?

  • What describes this line of code? let val = 5

  • DidSet and willSet are examples of _?

  • How many values does vals have after this code is executed? var vals = Set = ["4", "5", "6"] vals.insert("5")

Liked this quiz? Share it with friends:

Swift Skill Assessment

Overall Skill Level-Poor

Your Skill Level: Poor

Retake Quizzes to improve it