google.com, pub-8658045329707802, DIRECT, f08c47fec0942fa0
Upwork Test Answers: Get all the correct answers of most recent and possible Upwork Tests A to Z (Updated on Jan, 2016)
Cover Letter Templates: These cover letter samples are not only for Upwork job, but also you will have some idea about your real life job
 
Freelance Profile Overviews: Different Profile samples and overviews of experts, advanced and intermediate level freelancers
For Newbie of Upwork: Upwork Help - How to apply for a job in Upwork with 10 most important articles about Upwork

A to Z View - All Upwork Test Answers

Showing posts with label Swift Test Answer 2019. Show all posts
Showing posts with label Swift Test Answer 2019. Show all posts

Swift Test Answer 2019


1. Which of the following structures has both computed and stored properties?
Answers: • struct Rect { var origin = CGPointZero var center: CGPoint { get { // } set { // } } }

2. Which of these statements declares cityArray as a mutable array?
Answers:
var cityArray = [«Portland»,»San Francisco»,»Cupertino»]

3. Considering var index = UInt8.max, which of the following operation results to the value of zero for var index?
Answers: • index = index &+ 1

4. All Swift classes must inherit from which root class?
Answers: • Swift classes do not require a root class.

5. What does a retainCount represent in ARC?
Answers: • The current number of strong references to an object.


6. Which of these statements is a valid way to extend the capabilities of our theoretical class, MyClass to conform to protocol MyProtocol?
Answers: • extension MyClass: MyProtocol { }

7. What is the name of the Swift language feature that Objective-C Blocks are translated into?
Answers: • Closure

8. Which keyword is used on a function in an enumeration to indicate that the function will modify ‘self’?
Answers: • mutating

9. Which is correct for Enumerations?
Answers: • Enumerations can define initializers.

10. Which one creates a dictionary with a key type of Integer and value of String?
Answers: • var dict: [Int: String] = [1:»one»]

11. Which of these is a valid definition of a generic function that incorporates inout parameters in Swift?
Answers: • func swap<T>(inout a: T, inout b: T) { let temp = a a = b b = temp }

12. Which of these is an appropriate syntax for dispatching a heavy operation to a background thread?
Answers: • dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0), { self.heavyOperation() })

13. Which one is the correct keyword for defining a constant in Swift? ( or To declare a constant in Swift you would use: )
Answers: • let

14. If we have a class named MyClass with a nested enum called Status, declared like so:
class MyClass {
enum Status {
case On, Off
}
}
How would one indicate that a variable is an enum of type Status outside the context of MyClass?
Answers: • var status: MyClass.Status = .On

15. Which of the following could be used to indicate the Function Type of the following function:
func joinStrings(stringOne: String, stringTwo: String) -> String {
return stringOne + stringTwo
}
Answers: • (String, String) -> String