Computer Applications
In the bubble sort technique, during each iteration of the inner loop, two adjacent elements are …………… and …………… .
(i) compared
(ii) swapped
(iii) selected
(iv) deleted
- (i) and (ii)
- (ii) and (iii)
- (iii) and (iv)
- (ii) and (iv)
Answer
(i) and (ii)
Reason — In the bubble sort technique, during each iteration of the inner loop, two adjacent elements are first compared to check their order. If they are found to be in the wrong order, they are swapped to move the larger element towards the end of the list. This process repeats until the array is sorted.
Related Questions
Which of the following is a valid array declaration statement to store the Gender of 80 employees [ 'M'-male, 'F'-female, 'T'-transgender ]?
- char gender = new char[80];
- char gender[] = new char[80];
- char gender[80];
- char gender[80] = new char[ ];
Arrange the following java statements in the correct order of execution to accept values into the array a[]:
(i) a[i]=sc.nextInt( );
(ii) int a[]=new int[10];
(iii) Scanner sc=new Scanner(System.in);
(iv) for(i=0;i<10;i++)- (i), (ii), (iii), (iv)
- (ii), (iii), (iv), (i)
- (iv), (iii), (ii), (i)
- (iii), (i), (iv), (ii)
What is the highest index of any array with 100 elements?
- 100
- 101
- 99
- 98
Mr. Sanjay is an event manager, he plans and allots duties to each of his subordinates to handle different events. In a program, a task is divided into simple methods. Name the feature used in these contexts.
- Complexity
- Modularity
- Reusability
- Monolithic