Question 2(a) 2019 · May-June · Paper 33 · 4 marks
Reveal official mark-scheme answer
Official answer for Question 2
Part (a)
Question 4
Show text version of question
Question 2
Part (a)
Question 2
In JavaScript code, the sort() function is used to sort lists into ascending order.
Part (a)
Explain, in detail, why, when using the sort() function, the list in Fig. 2.1 is sorted correctly, but
the list in Fig. 2.2 is not.
Before sorting After sorting Before sorting After sorting
fly ant 1345 1111 cockroach beetle 3666 12 ant butterfly 1111 1345 butterfly cockroach 23 23 moth fly 37 3666 beetle moth 12 37
Fig. 2.1 Fig. 2.2
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
.............................................................................................................................................
Why this question appears here
98% assigned-topic match · Programming for the web
Topic-match percentages estimate how closely each question fits the selected syllabus topic. They are a guide for choosing stricter or broader practice.
Permanent source page: Educate A Change · From 9626_s19_qp_33.pdf
