please help with these swift questions I will thumbs up in rating !!! 1. what is
ID: 3918142 • Letter: P
Question
please help with these swift questions
I will thumbs up in rating !!!
1. what is an IBOutlet
A) It is a variable in a view controller that references a user interface element in Interface Builder.
B)It is a method in a view controller that gets executed when a user interacts with a a user interface element in Interface Builder.
C)It is the memory location of a Storyboard in Interface Builder.
2. When a Double is initialized with a String a failable initializer is called. What type is value in the following line of Swift code?
var value = Double("51.38")
A) Double
B) Double!
C) Double?
D) String
E) String?
F) Void
3. Given the following OuterPlanets enumeration:
enum OuterPlanets: String {
case mars, jupiter, saturn, uranus, neptune
}
What is the rawValue for jupiter?
A) 1
B) 2
C) 5
D) j
E) "jupiter"
F) .jupiter
4. Given:
struct Circle {
var x = 0.0, y = 0.0, width = 0.0
}
var circle = Circle()
Which of the following is used to set the width property of circle to 10.0 in Swift?
A) circle["width"] = 10.0
B) circle.setWidth(10.0)
C) circle.width = 10.0
D) circle->width = 10.0
5. Given:
struct Font {
var name: String
var size: Double
}
Which of the following is the correct line of Swift code for creating an instance of a Font with a name of "times" and a size of 12.0?
A) let font = new Font(name: "times", size: 12.0)
B) let font = Font(name: "times", size: 12.0)
C) let font = Font("times", 12.0)
D) let font = new Font("times", 12.0)
Explanation / Answer
1 . B)It is a method in a view controller that gets executed when a user interacts with a a user interface element in Interface Builder
2. C) Double?
3. F) .jupiter
4. C)
5. B)
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.