Question
Given the following function: func send(to address: String) { // code } In the code block for the function, what name is used to access
Given the following function:
func send(to address: String) { // code }
In the code block for the function, what name is used to access the String passed to the function?
to
address
send
String
Question 2
Does Swift allow default values to be specified for function parameters?
Yes
No
Question 3
If a function does not return a value, which of the follow is correct?
The return type must be set to nil.
The return type is a Swift optional type.
The return type is omitted from the function declaration.
Question 4
Where does the return type of a function go in Swift?
Before the function name.
To the right of an -> after the function parameter list.
Before the func keyword.
After the { } code block of the function.
Question 5
A Swift function can return more than one value.
True
False
Question 6
Each function parameter can have both an argument label and a parameter name.
True
False
Question 7
Functions in Swift begin with which of the following?
The return type
func
+
The name of the function
Question 8
Given the following function:
func send(to address: String) { // code }
Which of the following is the argument label in the function?
to
address
send
String
Question 9
Which of the following is correct if no argument label is to be specified when calling a Swift function?
Specify no argument label in the function declaration.
Use _ as the argument label in the function declaration.
Make the argument label and the parameter name the same in the function declaration.
An error will be generated at compile time.
Question 10
Given the following function:
func send(to address: String) { // code }
Which of the following is the correct way to call the function?
send(to: "1024 Clarinet Ct, Columbia, MO 65201")
send(address: "1024 Clarinet Ct, Columbia, MO 65201")
send(to address: "1024 Clarinet Ct, Columbia, MO 65201")
send("1024 Clarinet Ct, Columbia, MO 65201")
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