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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!