Singapore GCE O-Level Computing Practice Questions - Singapore GCE O-Level Computing Exam

Access More Questions
Consider the following pseudocode implementing a single pass of Bubble Sort on an array `arr = [5, 2, 8, 1]` of length 4: FOR i ← 0 TO 2 DO IF arr[i] > arr[i+1] THEN temp ← arr[i] arr[i] ← arr[i+1] arr[i+1] ← temp ENDIF ENDFOR What is the state of `arr` after completing this single pass (i = 0 to 2)?
Correct Answer:
[2, 5, 1, 8]

Access more questions from this quiz

Continue to Singapore GCE O-Level Computing Practice Questions - Singapore GCE O-Level Computing Exam for more practice questions and the full quiz experience.

Access More Questions