wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Removal - Part 2

Total questions: 20

Worksheet time: 19mins

Name
Class
Date
1.

If the array contains the following values:

num = [5, 7, 12, 15, 21, 25, 36, 39, 45, 48, 58, 61, 84, 87]

Question: What is the array size?

a)

13

b)

14

c)

15

d)

None of the choices

2.

If the array contains the following values:

num = [5, 7, 12, 15, 21, 25, 36, 39, 45, 48, 58, 61, 84, 87]

Question: What is the last array index?

a)

13

b)

14

c)

15

d)

None of the choices

3.

If the array contains the following values:

num = [5, 7, 12, 15, 21, 25, 36, 39, 45, 48, 58, 61, 84, 87]

Question: What is the first array index?

a)

13

b)

14

c)

15

d)

None of the choices

4.

If the array contains the following values:

num = [5, 7, 12, 15, 21, 25, 36, 39, 45, 48, 58, 61, 84, 87]

Question: What value is stored in num[5]?

a)

5

b)

4

c)

21

d)

25

5.

If the array contains the following values:

num = [5, 7, 12, 15, 21, 25, 36, 39, 45, 48, 58, 61, 84, 87]

Question: What value is stored in the first element?

a)

5

b)

7

c)

21

d)

25

6.

If the array contains the following values:

num = [5, 7, 12, 15, 21, 25, 36, 39, 45, 48, 58, 61, 84, 87]

Question: What is the arrangement order of the numbers in the array?

a)

mixed

b)

increasing

c)

decreasing

d)

whole numbers

7.

If the array contains the following values:

num = [5, 7, 12, 15, 21, 25, 36, 39, 45, 48, 58, 61, 84, 87]

Question: What are the indexes of the all numbers that are divisible by 5?

a)

5, 15, 25, 45

b)

0, 4, 6, 9

c)

0, 3, 5, 8

d)

1, 4, 6, 9

8.

If the array contains the following values:

num = [5, 7, 12, 15, 21, 25, 36, 39, 45, 48, 58, 61, 84, 87]

Question: What are prime numbers in the array?

a)

5, 7, 21

b)

5, 7, 61

c)

7, 21, 61

d)

7, 61, 84

9.

If the array contains the following values:

num = [5, 7, 12, 15, 21, 25, 36, 39, 45, 48, 58, 61, 84, 87]

Question: Which of the following statements will compute the sum of all the numbers in the array?

a)

sum=index=0

while index < SIZE:

...sum = num[index]

...index = index + 1

b)

sum=index=0

while index < SIZE:

...sum = num[index]

...index = + 1

c)

sum=index=0

while index < SIZE:

...sum =+ num[index]

...index =+ 1

d)

sum=index=0

while index < SIZE:

...sum += num[index]

...index = index + 1

10.

If the array contains the following values:

num = [5, 7, 12, 15, 21, 25, 36, 39, 45, 48, 58, 61, 84, 87]

Question: Which of the following statements will display all the numbers in the array?

a)

sum=index=0

while index < SIZE:

...print(num[index])

...index = index + 1

b)

sum=index=0

while index < SIZE:

...print(num[SIZE])

...index = index + 1

c)

sum=index=0

while index < SIZE:

...print(num[index])

...index = index

d)

sum=index=0

while index < SIZE:

...print(num[index])

...index =+ 1

11.

If the array contains the following values:

ch = ['A', 'B', 'C', 'D', 'E', 'F', 'G']

Question: What is printed in this statement?

print (ch[0], ch[6])

a)

AB

b)

AF

c)

AG

d)

AC

12.

If the array contains the following values:

ch = ['A', 'B', 'C', 'D', 'E', 'F', 'G']

Question: What is printed in this statement?

print (ch[6], ch[7])

a)

FG

b)

GF

c)

All letters

d)

ERROR

13.

If the array contains the following values:

ch = ['A', 'B', 'C', 'D', 'E', 'F', 'G']

Question: What is printed in this statement?

print (ch[6], ch[7])

a)

FG

b)

GF

c)

Mismatch error

d)

Index error

14.

If the array contains the following values:

ch = ['A', 'B', 'C', 'D', 'E', 'F', 'G']

Question: Which of the following statements will swap the letters 'A' and 'B'?

a)

temp=ch[0]

ch[0]=ch[1]

temp=ch[1]

b)

temp=ch[0]

ch[0]=ch[1]

ch[1]=temp

c)

temp=ch[1]

ch[0]=ch[1]

ch[1]=temp

d)

temp=ch[2]

ch[0]=ch[1]

ch[1]=temp

15.

If the array contains the following values:

ch = ['A', 'B', 'C', 'D', 'E', 'F', 'G']

Question: Which of the following statements will copy the last letter to the first letter?

a)

temp = ch[0]

ch[0] = temp

b)

temp = ch[7]

ch[0] = temp

c)

temp = ch[6]

ch[0] = temp

d)

temp = ch[0]

ch[6] = temp

16.

If the array contains the following values:

ch = ['A', 'B', 'C', 'D', 'E', 'F', 'G']

Question: Which of the following statements will verify if the letters in the array are all capital letters?

a)

if ch[index] >= 65 and ch[index] <=90:

b)

if ch[index] > 'A' and ch[index] < 'Z':

c)

if ch[index] >= 65 or ch[index] <=90:

d)

if ch[index] > 'A' or ch[index] < 'Z':

17.

If the array contains the following values:

ch = ['A', 'B', 'C', 'D', 'E', 'F', 'G']

Question: Which of the following statements will verify if the letters in the array are all small letters?

a)

if ch[index] > 97 and ch[index] < 122:

b)

if ch[index] >= 'a' and ch[index] < 'z':

c)

if ch[index] >= 97 or ch[index] <=122:

d)

if ch[index] > 'a' or ch[index] < 'z':

18.

If the array contains the following values:

ch = ['A', 'B', 'C', 'D', 'E', 'F', 'G']

Question: Which of the following statements will update the third element to letter 'S'?

a)

'S' = ch[3]

b)

'S' = ch[2]

c)

ch[2] = 'S'

d)

ch[3] = 'S'

19.

If the array contains the following values:

ch = ['A', 'B', 'C', 'D', 'E', 'F', 'G']

Question: How can you display the letters in reverse order'?

a)

index=0

while index<SIZE:

...print ch[index]

...index+=1

b)

index=0

while index<SIZE:

...print ch[SIZE-index-1]

...index+=1

c)

index=0

while index<SIZE:

...print ch[index]

...index=1

d)

index=0

while index<SIZE:

...print ch[SIZE-index]

...index+=1

20.

If the array contains the following values:

ch = ['A', 'B', 'C', 'D', 'E', 'F', 'G']

Question: Which of the following statements will display the first three letters?

a)

print (ch[0])

b)

print (ch[0], ch[1])

c)

print (ch[0], ch[1], ch[2])

d)

print (ch[0], ch[1], ch[2], ch[3])