Apple Swift Development II - Unit 3 - Vocats Test

Apple Swift Development II - Unit 3 - Vocats Test

9th - 12th Grade

22 Qs

quiz-placeholder

Similar activities

PROGDAS #1

PROGDAS #1

10th Grade

20 Qs

Q3-1 Quiz Review

Q3-1 Quiz Review

11th Grade

20 Qs

Python list, if

Python list, if

6th - 12th Grade

20 Qs

Array

Array

10th - 12th Grade

20 Qs

Basics Python

Basics Python

8th - 10th Grade

20 Qs

FCS Fall Collective review

FCS Fall Collective review

9th - 10th Grade

21 Qs

Python basic

Python basic

9th Grade

21 Qs

JavaScript - FR

JavaScript - FR

10th Grade

22 Qs

Apple Swift Development II - Unit 3 - Vocats Test

Apple Swift Development II - Unit 3 - Vocats Test

Assessment

Quiz

Computers

9th - 12th Grade

Hard

Used 8+ times

FREE Resource

22 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

If a variable can be set to any given structure, what is the variable’s type?

Any

as

anyObject

is

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

When is it appropriate to use the as! Operator?

When you need to convert a value to an Any type

When you need to downcast from one type to another, on the condition that the type is valid

When you need to downcast from one type to another and you can guarantee the type is valid

When you need to unwrap an optional

3.

MULTIPLE SELECT QUESTION

30 sec • 1 pt

When you conditionally downcast from one type to another and store the value in a constant, which combination of keywords is used? Select all that apply.

as!

as?

if let

is

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the result of the following block of code?


let sum = 99

func computSum(scores: [Int]) -> Int {

var sum = 0

for score in scores {

sum += score

}

return sum

}

computeSum(scores: [70, 30, 9])

0

00

109

Compiler error; sum cannot be defined twice in the same scope

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the result of the following block of code?


let sum = 99

func computeSum(scores: [Int]) -> Int {

var sum = 0

for score in scores {

sum += score

}

return sum

}


let sum = computeSum(scores: [70, 30, 9])

0

99

109

Compiler error; sum cannot be defined twice in the same scope

6.

MULTIPLE SELECT QUESTION

30 sec • 1 pt

Why is self in front of the property names of the initializer? Check all that apply.


struct ThemePark {

var name: String

var numEmployees: Int

var mostPopularRide: String


init(name: String, numEmployees: Int, mostPopularRide:

String) {

self.name = name

self.numEmployees = numEmployees

self.mostPopularRide = mostPopularRide

}

}

It helps the reader distinguish between the parameters and properties with the same name

self is always required when setting properties with an initializer

It helps Swift compiler distinguish between the parameters and properties with the same name.

self is not required

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What property would you modify if you wanted to add a badge to a tab?

badge

badgelcon

badgeString

badgeValue

Create a free account and access millions of resources

Create resources
Host any resource
Get auto-graded reports
or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?