Question
Could someone please help me answer some Swift programming questions? Thanks, I will thumbs up. When a Double is initialized with a String a failable
Could someone please help me answer some Swift programming questions? Thanks, I will thumbs up.
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")
Double |
Double! |
Double? |
String |
String? |
Void
Question 13 Given the following Swift function: func find(pattern: String, in info: String) -> Int? { // code } Which of the following is the correct way to call the function?
|
Question 28
The === operator in Swift is used to do which of the following?
To test if two variables hold the same value. |
To test if two variables refer to the same instance of a class. |
To test if two instances have the same methods. |
To test if a type and optional type refer to the same value. |
Question 29
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?
circle["width"] = 10.0 |
circle.setWidth(10.0) |
circle.width = 10.0 |
circle->width = 10.0 |
Question 30
Given:
struct Circle { var x = 0.0, y = 0.0, width = 0.0 } let circle = Circle()
Is the following allowed?
circle.x = 12.3
Yes |
No |
Question 35
Structure instances are always passed by value and class instances are always passed by reference in Swift.
True |
False |
Question 36
What are functions defined in a class called?
activities |
characteristics |
methods |
optionals |
properties |
Question 37
In Swift, what is a computed property in a class?
A method called on an object that changes a property. |
A property based on a calculation or logic when it is set or retrieved. |
A property contained in a constant or variable. |
All properties are computed properties in Swift. |
Question 38
What is a way in Swift to add initializers, computed properties, methods, and subscripts to an existing class without needing to create a subclass or edit the existing class?
class alias |
extensions |
partial class definitions |
protocols |
Question 39
Which kind of inheritance does Swift support for classes?
multiple inheritance |
single inheritance |
Question 40
Which kind of Swift collection is represented in the code below?
var measurement: [String: Double] = ["pressure": 21.4, "temperature": 374.3, "volume": 41.2]
Array |
Dictionary |
Set |
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started