Swift MCQ Questions & Answers - Mobile Development
Swift MCQs : This section focuses on "Swift" in Mobile Development. These Multiple Choice Questions (MCQ) should be practiced to improve the Swift skills required for various interviews (campus interviews, walk-in interviews, company interviews), placements, entrance exams and other competitive examinations.
1. Which of the following is true about Swift?
A. Swift is an open-source programming language
B. Swift is used in iOS development
C. Swift can be compiled as a dynamic framework
D. All of the above
View Answer
Ans : D
Explanation: All of the above are true about Swift.
2. Swift is an open-source programming language developed by?
A. Google
B. Facebook
C. Apple
D. IBM
View Answer
Ans : C
Explanation: Swift is an open-source programming language developed by Apple platform and expanded to build on Linus
3. What is the meaning of question mark "?" in Swift?
A. used in function declaration
B. used in property declaration
C. used in loop declaration
D. used in parameter declaration
View Answer
Ans : B
Explanation: In Swift, question mark "?" is used in property declaration. It tells the compiler that this property is optional. The property may hold a value or not.
4. How can you make a property optional in Swift?
A. You have to declare a question mark & in the code to make a property optional
B. You have to declare a question mark ? in the code to make a property optional
C. You have to declare a question mark ?? in the code to make a property optional
D. None of the above
View Answer
Ans : C
Explanation: We have to declare a question mark ?? in the code to make a property optional. If a property doesn't have a value, then the symbol ? helps to avoid the runtime error.
5. Which operator specifies a range between two values a and b (a
A. full open range
B. half close range
C. full close range
D. half open range
View Answer
Ans : D
Explanation: Swift supports several types of operators. One of them is Half Open Range operator. The half open range operator specifies a range between two values a and b (a
6. In Swift4, functions can be categorized in __________ types.
A. 1
B. 2
C. 3
D. 4
View Answer
Ans : B
Explanation: In Swift4, functions can be categorized in two types : User Defined Functions and Built-in Functions (Library Functions)
7. A function inside a function is called a nested function in swift?
A. TRUE
B. FALSE
C. Can be true or false
D. Can not say
View Answer
Ans : A
Explanation: True, A function inside a function is called a nested function.
8. ________________ is a hierarchy of objects that obtain the opportunity to respond to the events.
A. Regular Expression
B. Dictionary
C. Responder Chain
D. None of the above
View Answer
Ans : C
Explanation: Responder Chain: Responder Chain is a hierarchy of objects that obtain the opportunity to respond to the events.
9. Enum is also known as Swift Enumeration.
A. Yes
B. No
C. Can be yes or no
D. Can not say
View Answer
Ans : A
Explanation: Yes, Enum is also known as Swift Enumeration. Enum is a data type which contains a set of the related values. It is declared in a class and its values are accessed through the instance members of that class.
10. Constants are declared by using _____ keyword and variables by _______ keyword.
A. var, let
B. let, let
C. var, var
D. let, var
View Answer
Ans : D
Explanation: Constants are declared by using let keyword and variables by var keyword.
11. Which of the following is not a literals in swift?
A. Binary Literals
B. Quad Literals
C. Hexadecimal Literals
D. Decimal Literals
View Answer
Ans : B
Explanation: Quad Literals is not a literals in swift.
12. Numbers with decimal values or fractional components are called?
A. decimal number
B. integer number
C. floating numbers
D. All of the above
View Answer
Ans : C
Explanation: Numbers with decimal values or fractional components are called floating numbers. For example: 1.34 is a floating point number. Floating point types can represent a wider range of values than integer types.
13. Which of the following features of Swift programming language?
A. Swift is very easy to learn and precise to use
B. Automatic memory management
C. Swift follows Objective-C like syntax
D. All of the above
View Answer
Ans : D
Explanation: All of the above are features of Swift programming language.
14. In Swift programming language, single-line comments are started with ___________?
A. single slashes
B. double slashes
C. asterisk
D. hash
View Answer
Ans : B
Explanation: In Swift programming language, single-line comments are started with double slashes
15. _____________ is a process of querying and calling properties
A. Lazy Chaining
B. Swift Chaining
C. Optional Chaining
D. All of the above
View Answer
Ans : C
Explanation: In Swift programming language, Optional Chaining is a process of querying and calling properties. You can chain multiple queries together, but if any link in the chain is nil then, the entire chain fails.
16. How many types of classes in Inheritance in Swift?
A. 1
B. 2
C. 3
D. 4
View Answer
Ans : B
Explanation: There are two types of classes in Inheritance in Swift : Sub class and Super class
17. How many varieties of collection types in Swift?
A. 2
B. 3
C. 4
D. 5
View Answer
Ans : A
Explanation: There are two varieties of collection types in Swift: Array and Dictionary.
18. Which Of The Following Is Incorrect Data Type In SWIFT ?
A. UInt
B. Double
C. Char
D. Optional
View Answer
Ans : C
Explanation: Char Is Incorrect Data Type In SWIFT.
19. Which Of The Following Is Incorrect Value Type Of The Swift?
A. Double
B. Character
C. Enum
D. Class
View Answer
Ans : D
Explanation: Class Is Incorrect Value Type Of The Swift.
20. The class which inherits the properties from other class is called child class or sub class.
A. TRUE
B. FALSE
C. Can be true or false
D. Can not say
View Answer
Ans : A
Explanation: True, The class which inherits the properties from other class is called child class or sub class.
Discussion