The marks (out of 10) obtained by students in a class test are partly recorded in the frequency table below. Exactly 40 students took the test.
Marks (x) | 4 | 5 | 6 | 7 | 8
Frequency (f) | 6 | 9 | ? | 11 | 7
(i) Find the missing frequency for the mark 6.
(ii) Using the completed table, calculate the range of the marks obtained in the test.