0% found this document useful (0 votes)
26 views3 pages

Arrays-WPS Office

Educational
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views3 pages

Arrays-WPS Office

Educational
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Arrays

1. Arrays are used to store multiple values in a single variable. True

2. All array elements must be of the same data type. True

3. Arrays in programming are always indexed starting from 1. False

4. An array of length 5 can store 6 elements. False

5. Accessing an array element with an invalid index can lead to an error. True

6. Arrays can only be one-dimensional. False

7. Arrays allow random access to elements. True

8. The size of an array cannot be changed after its creation. True

9. Arrays are a type of data structure. True

10. It is efficient to use arrays when you need fast access to elements by index. True

Bubble Sort
1. Bubble Sort is a comparison-based algorithm. True

2. In Bubble Sort, the largest element is placed at the beginning of the list in each iteration. False

3. Bubble Sort repeatedly steps through the list, compares adjacent elements, and swaps them if they
are in the wrong order. True

4. Bubble Sort has a best-case time complexity of O(n^2). False

5. Bubble Sort is considered an inefficient sorting algorithm for large datasets. True

6. Bubble Sort is stable, meaning it preserves the relative order of equal elements. True

7. Bubble Sort can be optimized by stopping the algorithm if the inner loop didn’t cause any swap. True

8. Bubble Sort is an in-place sorting algorithm. True

9. The average and worst-case time complexity of Bubble Sort is O(n log n). False

10. Bubble Sort works well on small or nearly sorted datasets. True
Selection Sort
1. The selection sort algorithm is a comparison-based algorithm.

- True

2. Selection sort finds the maximum element and places it at the beginning of the array.

- False (It finds the minimum element and places it at the beginning.)

3. Selection sort works by dividing the input list into a sorted and an unsorted region.

- True

4. The time complexity of selection sort is O(n log n).

- False (The time complexity is O(n²).)

5. Selection sort is not a stable sort.

- True

6. Selection sort repeatedly selects the largest remaining element and moves it to its correct position.

- False (It selects the smallest remaining element.)

7. Selection sort performs well on small lists.

- True

8. Selection sort requires additional memory proportional to the size of the input list.
- False (It requires a constant amount of additional memory, O(1).)

9. The outer loop of selection sort runs 'n' times for an array of length 'n'.

- True

10. Selection sort has a best-case time complexity of O(n).

- False (Both the best-case and worst-case time complexities are O(n²).)

Insertion Sort

You might also like