Search Header Logo
Unit 1 - 3.Creating a bubble sort program

Unit 1 - 3.Creating a bubble sort program

Assessment

Presentation

Computers

9th Grade

Practice Problem

Easy

Created by

Ala Jaber

Used 5+ times

FREE Resource

3 Slides • 14 Questions

1

media

2

media

3

Multiple Choice

Which statement best describes pseudocode?



1

A. Program-like planning code that isn’t executable, used to design solutions before writing them in a high-level language (e.g., Python/Java/C++)

2

B. Code that the operating system compiles and runs directly

3

C. A low-level language used to control hardware

4

D. A special syntax used only in Python

4

Multiple Choice

Question image

What does WHILE list is unsorted DO tell the algorithm to do?

1

A. Keep repeating passes until the list is sorted

2

B. Run exactly once

3

C. Compare only the first and last items

4

D. Stop after two passes

5

Multiple Choice

Question image

In FOR n items in list DO, what is the loop doing each pass?

1

A. Adding a new item to the list

2

B. Picking two random items to compare

3

C. Jumping directly to the smallest item

4

D. Stepping through the list positions to compare adjacent items

6

Multiple Choice

What condition triggers a swap?

1

A. If n < n+1

2

B. If n > n+1

3

C. If n = n+1

4

D. If n is the smallest value

7

Multiple Choice

Question image

When does the outer WHILE loop finish?

1

A. After the last index is reached

2

B. When the smallest item is at the front

3

C. When a full pass makes no swaps (list is sorted)

4

D. After a fixed number of passes

8

Multiple Choice

Question image

In the pseudocode, n and n+1 refer to:

1

A. The first and last items in the list

2

B. Any two random items

3

C. The smallest and largest items

4

D. Two adjacent items being compared

9

Multiple Choice

Question image

What does END FOR signify here?

1

A. End of the entire algorithm

2

B. Start of a new outer pass

3

C. All items for this pass have been compared

4

D. A swap must occur

10

media
media

11

Multiple Choice

Question image

What does bubbleSort(list) do to list?

1

A. Returns a new sorted copy and leaves the original unchanged

2

B. Randomly shuffles the items

3

C. Sorts the list in descending order only

4

D. Sorts the list in place in ascending order (no return value)

12

Multiple Choice

Question image

What is the name of the counter in the inner loop?

1

temp

2

number

3

n

4

list

13

Multiple Choice

Question image

What is the role of listChanged?

1

A. Counts how many swaps happen overall

2

B. Detects if any swap occurred in the current pass to allow early exit

3

C. Stores the largest value found so far

4

D. Tracks the current index of the inner loop

14

Multiple Choice

Question image

Why does the outer loop use range(len(list)-1, 0, -1)?



1

A. To compare the first and last items only

2

B. To iterate through all pairs twice

3

C. To control the number of passes, reducing the inner loop’s work each pass

4

D. To reverse the list before sorting

15

Multiple Choice

Question image

Given list = [7, 3, 8, 5, 6, 4], what does the program print after calling bubbleSort(list)?

1

A. [8, 7, 6, 5, 4, 3]

2

B. [3, 4, 5, 6, 7, 8]

3

C. [7, 3, 8, 5, 6, 4]

4

D. [3, 5, 4, 6, 7, 8]

16

Multiple Choice

Question image

What does if not listChanged: break achieve?



1

A. It restarts the algorithm from the beginning

2

B. It swaps the last two elements regardless of order

3

C. It skips the next comparison

4

D. It stops early after a pass with no swaps (list already sorted)

17

Multiple Choice

Question image

What does if not listChanged: break achieve?

1

A. It restarts the algorithm from the beginning

2

B. It swaps the last two elements regardless of order

3

C. It skips the next comparison

4

D. It stops early after a pass with no swaps (list already sorted)

media

Show answer

Auto Play

Slide 1 / 17

SLIDE