Bubble Sort

1. Which of the following represents a homogeneous array (an array in which all elements are of the same type)?
Explanation

Explanation

Explanation

Explanation

Explanation

Explanation

Explanation

Explanation

2. Which of the following arrays is sorted in ascending order?
Explanation

Explanation

Explanation

Explanation

Explanation

Explanation

Explanation

Explanation

3. Which of the following is not a sorting algorithm?
Explanation

Explanation

Explanation

Explanation

Explanation

Explanation

Explanation

Explanation

4. Consider the following array: A = [-1, 9, 4, 8]. Identify A[2], i.e., the element at index 2, assuming 0-based indexing.
Explanation

Explanation

Explanation

Explanation

Explanation

5. Consider the following pseudo-code:
for i = 0 to 2
for j = 0 to i
print "*"
print newline
end
Predict the output of the above code.
Explanation

Explanation

Explanation

Explanation

Explanation

Explanation

Explanation

Explanation

6. In Bubble Sort, what is the main operation performed on two adjacent elements during a pass?
Explanation

Explanation

Explanation

Explanation

Explanation

Explanation

Explanation

Explanation

7. For an ascending Bubble Sort, what happens to the largest element during one complete pass through the unsorted portion of the array?
Explanation

Explanation

Explanation

Explanation

Explanation

Explanation

Explanation

Explanation

8. Consider the array A = [5, 2, 4]. What is the array after the first complete pass of Bubble Sort in ascending order?
Explanation

Explanation

Explanation

Explanation

Explanation

Explanation

Explanation

Explanation

9. If an array contains N elements, how many adjacent pairs are there when considering the entire array once?

Explanation

Explanation

Explanation

Explanation

Explanation

Explanation

Explanation