wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Arrays in Swift

Total questions: 13

Worksheet time: 9mins

Name
Class
Date
1.

How many types of collections are provided by the swift?

a)

Two

b)

Three

c)

Four

d)

Five

2.

The type of collection shown in the picture is an example of

a)

Array

b)

Set

c)

Dictionary

3.

The type of collection shown in the picture is an example of

a)

Array

b)

Set

c)

Dictionary

4.

The type of collection shown in the picture is an example of

a)

Array

b)

Set

c)

Dictionary

5.

An array is a collection of different data types.

a)

True

b)

False

6.

The index number of first element of an array is

a)

-1

b)

0

c)

1

7.

If an array has a size of 8, then what is the index number of last element?

a)

1

b)

7

c)

8

d)

9

8.

If an array has a size of 5, then what is the index number of the first element?

a)

0

b)

1

c)

4

d)

5

9.

Which of the following shows correct declaration of an array Age and storing values 13, 14, 15, and 16 in it?

a)

Age = 13, 14, 15, 16

b)

var Age = 13, 14, 15, 16

c)

Age = ("13", "14", "15", "16")

d)

var Age = [13, 14, 15, 16]

10.

Which of the following shows correct declaration of an array named as Cars and storing values Tesla, Ferrari, BMW in it?

a)

Cars = [Tesla, Ferrari, BMW]

b)

var Cars = ["Tesla", "Ferrari", "BMW"]

c)

Cars = (Tesla, Ferrari, BMW)

d)

var Cars = [Tesla, Ferrari, BMW]

11.

What is the size of the array shown in the image?

a)

4

b)

5

c)

17

d)

14

12.

The name of the array shown in the image is "Languages". What should be the code to print Swift?

a)

print(Swift)

b)

print(Languages)

c)

print(Languages[0])

d)

print(Languages[1])

13.

The name of the array shown in the image is "Languages". What should be the code to print Java?

a)

print(Java)

b)

print(Languages)

c)

print(Languages[1])

d)

print(Languages[2])