Computer Applications
An array with 3 elements is arranged in a ascending order as follows:

Name the technique used:
- Bubble sort
- Linear Search
- Selection sort
- Binary Search
Answer
Bubble sort
Reason — The array is arranged in ascending order by repeatedly comparing and swapping adjacent elements. First, 4 and 1 are swapped to get 1 4 3, and then 4 and 3 are swapped to get 1 3 4. This step-by-step swapping of adjacent elements is the characteristic feature of Bubble Sort.
Related Questions
The output of the below statement is:
String a[] = {"Atasi", "Aditi", "Anant", "Amit", "Ahana"}; System.out.println(a[1].charAt(1) + "*" + a[2].charAt(2));- da
- d*a
- ti
- t*i
Which of the following String methods returns a negative value?
- length()
- equals()
- compareTo()
- charAt()
The sales made by 5 salesmen selling 5 products is stored in a two-dimensional array of integer data type. How many bytes does the array occupy?
- 25
- 200
- 50
- 100
Assertion (A): The substring() method modifies the original String.
Reason (R): The substring() method can extract part of a String starting from a specific index.
- (A) is true and (R) is false.
- (A) is false and (R) is true.
- Both (A) and (R) are true and (R) is a correct explanation of (A).
- Both (A) and (R) are true and (R) is not a correct explanation of (A).