Swift (iOs) MCQs with answers Page - 14

Here, you will find a collection of MCQ questions on Swift (iOs). Go through these questions to enhance your preparation for upcoming examinations and interviews.

To check the correct answer, simply click the View Answer button provided for each question.

Have your own questions to contribute? Click the button below to share your MCQs with others!

+ Add Question

A

Admin • 828.03K Points
Coach

Q. Which Swift feature allows multiple values to be returned from a function?

  • (A) Array
  • (B) Tuple
  • (C) Dictionary
  • (D) Struct

A

Admin • 828.03K Points
Coach

Q. Which keyword is used to define an extension in Swift?

  • (A) extend
  • (B) extension
  • (C) extends
  • (D) add

A

Admin • 828.03K Points
Coach

Q. How can you declare a variable that cannot be changed after initialization?

  • (A) let name = "Swift"
  • (B) var name = "Swift"
  • (C) static name = "Swift"
  • (D) final name = "Swift"

A

Admin • 828.03K Points
Coach

Q. Which of the following keywords is used to exit a function early?

  • (A) break
  • (B) continue
  • (C) exit
  • (D) return

A

Admin • 828.03K Points
Coach

Q. What is the default access level in Swift?

  • (A) public
  • (B) private
  • (C) internal
  • (D) open

A

Admin • 828.03K Points
Coach

Q. Which of these defines a class in Swift?

  • (A) class MyClass {}
  • (B) Class MyClass {}
  • (C) def class MyClass {}
  • (D) create class MyClass {}

A

Admin • 828.03K Points
Coach

Q. Which keyword is used to declare a computed property?

  • (A) get
  • (B) return
  • (C) computed
  • (D) var with a body

A

Admin • 828.03K Points
Coach

Q. What is the output of the following code?

Code:
let list = [1, 2, 3, 4, 5]
print(list.first)
  • (A) 1
  • (B) [1]
  • (C) Optional(1)
  • (D) Error

A

Admin • 828.03K Points
Coach

Q. What is the result of the following code?

Code:
let numbers = [1, 2, 3]
print(numbers.isEmpty)
  • (A) true
  • (B) false
  • (C) nil
  • (D) Error

A

Admin • 828.03K Points
Coach

Q. Which of the following is used to observe property changes in Swift?

  • (A) onChange
  • (B) didSet
  • (C) observe
  • (D) watch

Add MCQ in this Category

If you want to share an MCQ question in this category, it's a great idea! It will be helpful for many other students using this website.

Share Your MCQ