In this blog you will find the correct answer of the Coursera quiz Java Programming Principles Software Design Coursera Week 2 mixsaver always try to brings best blogs and best coupon codes
 

Week- 2

Earthquakes: Sorting Algorithms

1.
Question 1
For an assignment you wrote the method sortByLargestDepth in the class QuakeSortInPlace to sort earthquakes by their depth from largest depth to smallest depth using the selection sort algorithm. Modify this method to do exactly 70 passes and then modify testSort to run this method on the file earthQuakeDataDec6sample2.atom. The file may not be completely sorted as there are many quakes in the file.

After running your program of 70 selection sort passes on this file, what is the depth of the last earthquake in the ArrayList?

Note: This question has variations. If you attempt this quiz multiple times, make sure you are using the correct number of sort passes!

1 point
Enter answer here

-100000.00

2.
Question 2
For an assignment you wrote the method sortByMagnitudeWithCheck in the class QuakeSortInPlace to sort earthquakes by their magnitude from smallest to largest using the selection sort algorithm, and stopping with passes once the ArrayList is sorted. Modify testSort to run this method on the file earthQuakeDataWeekDec6sample1.atom.

How many passes are needed to sort this file?

Note: This question has variations. If you attempt this quiz multiple times, make sure you are using the correct data file!

1 point

1282

1292

1298

1299

1301

1319

3.
Question 3
For an assignment you wrote the method sortByMagnitudeWithBubbleSortWithCheck in the class QuakeSortInPlace to sort earthquakes by their magnitude from smallest to largest using the bubble sort algorithm, and stopping with passes once the ArrayList is sorted. Modify testSort to run this method on the file earthQuakeDataWeekDec6sample2.atom. Make sure you are using the updated (1/12/16) version of the EarthQuakeParser class.

How many passes are needed to sort this file?

Note: This question has variations. If you attempt this quiz multiple times, make sure you are using the correct data file!

1 point

1226

1233

1240

1255

1260

1267

4.
Question 4
Consider an ArrayList of following six integers.

2 4 5 9 8 1
What does this ArrayList look like after two passes of selection sort that sorts the elements in numeric order from smallest to largest?

1 point

1 2 4 9 8 5

1 2 5 4 9 8

1 2 5 9 8 4

1 4 5 9 8 2

2 4 5 9 8 1

4 1 5 2 8 9

 

4. For an assignment you wrote the method sortByMagnitudeWithBubbleSortWithCheck in the class QuakeSortInPlace to sort earthquakes by their magnitude from smallest to largest using the bubble sort algorithm, and stopping with passes once the ArrayList is sorted. Modify testSort to run this method on the file earthQuakeDataWeekDec6sample1.atom.

How many passes are needed to sort this file?

Note: This question has variations. If you attempt this quiz multiple times, make sure you are using the correct data file!

1241

5.
Question 5
Consider an ArrayList of following six integers.

4 2 5 9 8 1
What does this ArrayList look like after two passes of bubble sort that sorts the elements in numeric order from smallest to largest?

1 point

2 4 1 5 8 9

2 4 5 1 8 9

2 4 5 8 1 9

4 2 5 1 8 9

4 2 5 8 1 9

4 2 5 9 8 1

6.
Question 6
For an assignment, you modified the compareTo operator in the class QuakeEntry to sort earthquakes by their magnitude first, from smallest magnitude to largest magnitude, and to break ties by their depth, from largest depth to smallest depth. Then you wrote the method sortWithCompareTo in the DifferentSorters class using the Collections.sort method. Modify this method to print out the QuakeEntry in position 600 after sorting the QuakeEntry’s by the above method. Run this method on the file earthQuakeDataWeekDec6sample2.atom.

What is the depth of the earthquake that is in position 600 after the earthquakes are sorted by the above method?

Note: This question has variations. If you attempt this quiz multiple times, make sure you are using the correct data file!

1 point
Enter answer here

53600.00

7.
Question 7
For an assignment, you wrote the TitleAndDepthComparator to sort earthquakes by their title first, in alphabetical order, and to break ties by their depth, from smallest depth to largest depth. You then used the Collections.sort method with the TitleAndDepthComparator. Modify the sortByTitleAndDepth method in the DifferentSorters class to print out the QuakeEntry in position 500 after sorting the QuakeEntry’s by the above method. Run this method on the file earthQuakeDataWeekDec6sample2.atom.

What is the depth of the earthquake that is in position 500 after the earthquakes are sorted by the above method?

Note: This question has variations. If you attempt this quiz multiple times, make sure you are using the correct data file!

1 point
Enter answer here

-7630.00

8.
Question 8
For an assignment, you wrote the TitleLastAndMagnitudeComparator to sort earthquakes by the last word in their title first, in alphabetical order, and to break ties by their magnitude, from smallest to largest. You then used the Collections.sort method with the TitleLastAndMagnitudeComparator. Modify the sortByLastWordInTitleThenByMagnitude method in the DifferentSorters class to print out the QuakeEntry in position 500 after sorting the QuakeEntry’s by the above method. Run this method on the file earthQuakeDataWeekDec6sample2.atom.

What is the depth of the earthquake that is in position 500 after the earthquakes are sorted by the above method?

Note: This question has variations. If you attempt this quiz multiple times, make sure you are using the correct data file!

1 point
Enter answer here

-1490.00

 

 

Important Links: