wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Lesson 7: Problem solving

Total questions: 7

Worksheet time: 4mins

Name
Class
Date
1.

An array is used to record number of students in a school from Grade 1 to Grade 6:


S=[31, 32, 35, 32, 28, 39]


James wants to know the number of students in Grade 4. How to get it?

a)

S[0]

b)

S[1]

c)

S[2]

d)

S[3]

2.

An array is used to record number of students in a school from Grade 1 to Grade 6:


S=[31, 32, 35, 32, 28, 39]


James wants to know the total number of students in Grade 4 and 5, How to get it?

a)

sum(S[3:4]

b)

sum(S[3:5])

c)

sum(S[4:5])

d)

sum(S[4:5])

3.

Number of students in a school from Grade 1 to Grade 6:


S=[31, 32, 35, 32, 28, 39]


James wants to use above code to get the average number of students in all Grades. What should be fill in ???

(a)  

4.

Students from Grade 1 to Grade 6:


S=[31, 32, 35, 32, 28, 39]


James wants to find out which Grade can be grouped into exactly 7 groups. What's the missing code above to achieve this?

(a)  

5.

Students from Grade 1 to Grade 6:


S=[31, 32, 35, 32, 28, 39]


James wants to find out which Grade can be grouped into exactly 2 groups and 4 groups. What's the missing code above to achieve this?

a)

i%4 == 0

b)

i%2 == 0 and i%4 == 0

6.

Teach Tom wants to remove the 'ed' from the grading string when printing. What to fill in ???

a)

0:-3

b)

0:-2

c)

1:-2

d)

1:-3

7.

Teach Tom wants to change 'Passed' to 'Passing' and 'Failed' to 'Failing' when printing. What to fill in ???

a)

grade[0:-2]+'ing'

b)

grade.replace('ed','ing')

c)

grade[0:4] + 'ing'