Question 15
The following pseudocode is executed using the “Scores” dataset. What will the value of L represent at the end of the execution?
cityMarks = { }while (Table 1 has more rows) { Read the first row X in Table 1 if (isKey(cityMarks, X.CityTown)) { cityMarks[X.CityTown] = cityMarks[X.CityTown] ++ [X.Total] } else { cityMarks[X.CityTown] = [X.Total] } Move row X to Table 2}
A = 0, L = [ ]foreach c in keys(cityMarks) { data = doSomething(cityMarks[c]) B = first(data) − last(data) if (B == A) { L = L ++ [c] } if (B > A) { A = B L = [c] }}
Procedure doSomething(Y) p = 0, q = 301 foreach k in Y{ if (k > p) { p = k } if (k < q) { q = k } } return([p, q])End doSomethingList of cities in which the difference of highest total and lowest total marks of students is same
List of cities in which the difference of highest total and lowest total marks of students is maximum
List of cities in which the difference of highest total and lowest total marks of students is minimum
List of cities in which the difference of highest total and lowest total marks of students is 301