wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

SAPET

Total questions: 20

Worksheet time: 20mins

Name
Class
Date
1.

Which of the following is considered a String value

a)

500

b)

false

c)

“ SAPET ”

d)

Yes

2.

To initialize an instance of type ‘Expert’ ; the correct code is :

a)

let expert=Expert()

b)

var Expert()

c)

Expert()=expert

d)

dec expert=Expert

3.

Which of the following is considered a Boolean value?

a)

100

b)

“Swift”

c)

var

d)

true or false

4.

To insert number 10 at index 2 in score array; the correct command is :

a)

insert(10,2)

b)

score.insert(2,10)

c)

score.insert(10)

d)

score.insert(10, at:2)

5.

Which of the below commands used to

delete the first element in the Array array ?

a)

Array.remove(at:0)

b)

Array (remove(0))

c)

delete(at:0)

d)

delete(0)

6.

abc =[5 , 2 , 3]

The correct method to insert the values 8 at the end of the array is ?

a)

abc.insert(4+4)

b)

abc.append(8)

c)

abc.insert(8)

d)

abc.append(8,at: 2)

7.

var list :[Int]= [ 3 , 2 , 4 , 6 , 8 , 10 ].

what is the range of index in the list array ?

a)

0 to 5

b)

1 to 5

c)

0 t0 6

d)

1 to 6

8.

var list :[Int]= [ 3 , 2 , 4 , 6 , 8 , 10 ].

what is the value of the index 2 in the list array ?

a)

2

b)

4

c)

6

d)

8

9.

To insert the letter "B" at index 2 in letter array; the correct command is :

a)

insert("B",2)

b)

letter.add(2,"B")

c)

letter.insert("B")

d)

letter.insert("B", at:2)

10.

Which of the below commands used to

delete the third element in the number array ?

a)

number.remove(at:2)

b)

number (remove(2))

c)

number.remove(at:3)

d)

number (remove(3))

11.

letter =["A" , "B" , "C", "D"]

The correct method to insert the letter "Y" at the end of the array is ?

a)

letter.insert("Y")

b)

letter.append("Y")

c)

letter.insert("Y")

d)

letter.append("Y",at: 3)

12.

var list :[Int]= [ 3 , 2 , 4 , 6 ].

what is the range of index in the list array ?

a)

0 to 3

b)

1 to 3

c)

0 t0 4

d)

1 to 4

13.

var list :[Int]= [ 3 , 2 , 4 , 6 ].

How many elements in the list array ?

a)

3

b)

4

c)

5

d)

6

14.

var list :[Int]= [ 3 , 2 , 4 , 6 , 8 , 10 ].

what is the index of the element (6)in the list array ?

a)

2

b)

3

c)

4

d)

6

15.

var list :[Int]= [ 3 , 2 , 4 , 6 , 8 , 10 ].

what is the data type of the list array ?

a)

float

b)

integer

c)

Boolean

d)

String

16.

abc =[40 , 50 , 10]

What is the final output of the array after executing the following command

abc.append(50) ?

a)

[50 , 40 , 50 , 10]

b)

[40 , 50 , 10 , 50]

c)

[40 , 10]

d)

[40 , 50 , 50 ,10]

17.

abc =[40 , 50 , 10]

What is the final output of the array after executing the following command

abc.insert("50", at:2) ?

a)

[50 , 40 , 50 , 10]

b)

[40 , 50 , 10 , 50]

c)

[40 , 10]

d)

[40 , 50 , 50 ,10]

18.

abc =[40 , 50 , 10]

What is the final output of the array after executing the following command

abc.remove(at:1) ?

a)

[50 , 40 , 50 , 10]

b)

[40 , 50 , 10 , 50]

c)

[40 , 10]

d)

[40 , 50 , 50 ,10]

19.

A collection that stores an ordered list of items.

a)

Array

b)

Function

c)

Bolean

d)

loop

20.

The number that represents the position of an item in an array.

a)

String

b)

Function

c)

Bolean

d)

Index