Olete.in
Articles
Mock Tests
🧪 Swift (programming language) MCQ Quiz Hub
Swift Multiple Choice Questions and Answers Set 2
Choose a topic to test your knowledge and improve your Swift (programming language) skills
1. Which among the following is true with respect to enum's raw values in Swift? S1: Integer raw values are assumed to start at 0 S2: Integer raw values increase monotonically S3: Raw-valued enum automatically conforms to RawRepresentable S4: String raw values cant be synthesized automatically
S1,S2 and S3
S2 only
S2,S3 and S4
S1, S3 and S4
2. Which keyword enables a method of a struct to change the value of the struct itself in swift?
mut
mutating
mutable
Nsmut
3. Which is false with respect to structs in swift?
Structures can adopt protocols
structures are passed through copying
Structs can be inherited
Structures can be compared using identity operator
4. When can mutating methods be used in structs?
Inside variables
Inside constants
When let keyword is used
All of the above
5. Which of the following throws error in swift with respect to structs?
class MyView: NSView { }
struct MyInt: Int { }
struct Vector: Hashable { ... }
None of the above
6. Which of the following is true about Swift?
Swift is an open-source programming language
Swift is used in iOS development
Swift can be compiled as a dynamic framework
All of the above
7. Swift is an open-source programming language developed by?
Google
Facebook
Apple
IBM
8. What is the meaning of question mark "?" in Swift?
used in function declaration
used in property declaration
used in loop declaration
used in parameter declaration
9. How can you make a property optional in Swift?
You have to declare a question mark & in the code to make a property optional
You have to declare a question mark ? in the code to make a property optional
You have to declare a question mark ?? in the code to make a property optional
None of the above
10. Which operator specifies a range between two values a and b (a
full open range
half close range
full close range
half open range
11. In Swift4, functions can be categorized in __________ types.
1
2
3
4
12. A function inside a function is called a nested function in swift?
True
False
Can be true or false
Can not say
13. __________ is a hierarchy of objects that obtain the opportunity to respond to the events.
Regular Expression
Dictionary
Responder Chain
None of the above
14. Enum is also known as Swift Enumeration.
Yes
No
Can be yes or no
Can not say
15. Constants are declared by using _____ keyword and variables by _______ keyword.
var, let
let, let
var, var
let, var
16. Numbers with decimal values or fractional components are called?
decimal number
integer number
floating numbers
None of the above
17. ____________ is a process of querying and calling properties
Lazy Chaining
Swift Chaining
Optional Chaining
All of the above
18. Which Of The Following Is Incorrect Data Type In SWIFT ?
UInt
Double
Char
Optional
19. The class which inherits the properties from other class is called child class or sub class.
TRUE
FALSE
Can be true or false
Can not say
20. Who is introduced Swift?
Chris Lattner
Vikram Adve
Steve Jobs
Tanya Lattner
21. When Swift was initially Released?
June 2, 2012
June 2, 2013
June 2, 2014
June 2, 2015
22. What are the features of Swift Programming?
Arrays and integers are checked for overflow
It eliminates the classes that are in an unsafe mode
Switch function can be used instead of using “if” statement
All of the above
23. Which Of The Following Framework Is Not Used In IOS?
AppKit Framework
UIKit Framework
Foundation Framework
CoreMotion Framework
24. Which command is used to turn the switch on?
toggle( )
toggleSwitch( )
onSwitch( )
activateSwitch( )
25. What is swift playground?
Is a algorithmic designer tools
Advanced tool to create applications
A tool Used to write a pseudo code for any program
Powerful programming language created by Apple
26. What is the meaning of question mark "?" in Swift?
used in loop declaration
used in function declaration
used in property declaration
used in parameter declaration
27. The expression that creates a closure in Swift is called ____ in other languages it is also called a Lambda or Anonymous Function.
Control
Defined
Parameter
Closure Expression
28. Given : var stringValue:String = "Somthing". What is the result of stringValue = nil?
stringValue == nil B) C)
stringValue == "Somthing"
the compiler won't allow it
None of the above
29. Numbers with decimal values or fractional components are called?
integer number
floating numbers
decimal number
All of the above
30. In Swift programming language, single-line comments are started with _______?
Hash
Asterisk
Single Slashes
Double Slashes
31. Constants are declared by using _____ keyword and variables by _______ keyword.
let, var
let, let
var, let
var, var
32. ________ is a process of querying and All of the abovecalling properties
Swift Chaining
Optional Chaining
Lazy Chaining
All of the above
33. The IDE Used In Swift Is______
Ld
Xcode
Gas
Swiftc
34. What are the advantages of Swift?
Swift is safe
Swift is fast
Swift is open source
All of these
35. What's are the new features in Swift 4.0?
Faster, easier to use Strings that retain Unicode correctness
Smart key paths for type-safe, efficient, extensible key value coding for Swift types
Added some enhancements to creating dictionary and Set types
All of the above
36. Given : var stringValue:String = "Justin Gif. What is the result of stringValue = nil?
stringValue == nil
stringValue == Justin Gif"
the compiler won't allow it
None
37. What are the collection types in Swift?
Swift is which type of language?
object-oriented programming language
type safe language
All of the above
38. IOS Stands For ?
Internetwork Operating System
IPhone Operating System
Internet Operating System
None Of Them
39. To Create Mutable Object __ Is Used
Let
Var
Both A&B
None
40. Which Of The Following IOS Frameworks Is A Commonly Used Third Party Library?
AVFoundation.framework
Audiotoolbox.framework
AFNetwork.framework
Audiotoolbox.framework
Submit