Swift(Engineering > Computer Science And Engineering ) Questions and Answers

Question 1. What are the characteristics of Switch in Swift?
  1.    It supports any kind of data, and not only synchronize but also checks for equality
  2.    When a case is matched in switch, the program exists from the switch case and does not continue checking next cases. So you don't need to explicitly break out the switch at the end of case
  3.    Switch statement must be exhaustive, which means that you have to cover all possible values for your variable
  4.    All of the above
Explanation:-
Answer: Option D. -> All of the above





Question 2. What are the features of Swift Programming?
  1.    It eliminates entire classes of unsafe code
  2.    Variables are always initialized before use
  3.    Arrays and integers are checked for overflow
  4.    All of these
Explanation:-
Answer: Option D. -> All of these





Question 3. How do you declare an Iboutlet property?
  1.    IBOutlet var button:UIButton
  2.    var button:UIButton(IBOutlet)
  3.    var button:UIButtonoutlet
  4.    None of the mentioned
Explanation:-
Answer: Option D. -> None of the mentioned





Question 4. What are the control transfer statements used in Swift?
  1.    Continue
  2.    Break
  3.    Fallthrough
  4.    All of these
Explanation:-
Answer: Option D. -> All of these





Question 5. What are the advantages of Swift?
  1.    Swift is safe
  2.    Swift is fast
  3.    Swift is open source
  4.    All of the above
Explanation:-
Answer: Option D. -> All of the above





Question 6. Swift is which type of language?
  1.    scripting language
  2.    object-oriented programming language
  3.    type safe language
  4.    All of the above
Explanation:-
Answer: Option D. -> All of the above





Question 7. What are the collection types in Swift?
  1.    Dictionary and array
  2.    Array and library
  3.    Dictionary and library
  4.    Library, dictionary and array
Explanation:-
Answer: Option A. -> Dictionary and array





Question 8. Given : var stringValue:String = "Justin Gif. What is the result of stringValue = nil?
  1.    stringValue == nil
  2.    stringValue == Justin Gif"
  3.    the compiler won't allow it
  4.    None
Explanation:-
Answer: Option C. -> the compiler won't allow it





Question 9. What type of integer is denoted by "Int8"?
  1.    Open
  2.    Signed
  3.    Unsigned
  4.    Close
Explanation:-
Answer: Option B. -> Signed





Question 10. What's are the new features in Swift 4.0?
  1.    Faster, easier to use Strings that retain Unicode correctness
  2.    Smart key paths for type-safe, efficient, extensible key value coding for Swift types
  3.    Added some enhancements to creating dictionary and Set types
  4.    All of the above
Explanation:-
Answer: Option D. -> All of the above