Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question 1 The following table shows the results after each pass of a sorting algorithm for just the first 3 passes. What kind of sort

Question 1

The following table shows the results after each pass of a sorting algorithm for just the first 3 passes. What kind of sort is being performed?

21 40 29 77 45 92 28 61 40 21 40 29 21 77 40 29 21
Selection sort, ascending order
Selection sort, descending order
Insertion sort, ascending order
Insertion sort, descending order

Flag this Question

Question 2

How many steps are required to successfully swap the values in two variables?

0
1
2
3
4

Flag this Question

Question 3

Given the following declaration: double[][] y = {{ 1, 2, 3, -1}, {4, 5, 6, 0}, {7, 8, 9, 10}}; What is the proper syntax to access the -1?

y[3][0]
y[0][3]
y[1][4]
y[1, 4]

Flag this Question

Question 4

In order to visit every element in a 2-dimensional array, what control structure design do you need?

A single loop
A loop nested within another loop
A loop nested in an if statement
A single loop followed by another single loop

Flag this Question

Question 5

Which sort algorithm begins with the algorithm below? start at index 1 copy array value into temporary storage compare temporary to index 0 - if element 0 is less than element 1, shift element 0 to element 1 put temporary value into element 0

random sort
insertion sort
selection sort

Flag this Question

Question 6

Which of the following is legal syntax to return a 2-dimensional array?

public String[][] method(){...}
public int [][] method(){...}
public double[][] method(){...}
All of the above
Only the 2nd and 3rd choice. You can't have a 2-dimensional array of Strings

Flag this Question

Question 7

Given a 2-dimensional array of ints, what will the following code do? int sum = 0; for (int r = 0; r < array.length; r++) {

for ( c= 0; c < array[r].length; c++)

sum += array[r][c];

} System.out.println(sum);

Prints out the sum of each row
Prints out the sum of each column
Prints out the sum of the entire array

Flag this Question

Question 8

DIFFERENT FROM THE PREVIOUS QUESTION Given a 2-dimensional array of ints, what will the following code do? int sum = 0; for (int r = 0; r < array.length; r++, sum = 0) {

for ( c= 0; c < array[r].length; c++)

sum += array[r][c];

System.out.println(sum);

}

Prints the sum of each column
Prints the sum of each row
Prints the sum of all the elements of the array

Flag this Question

Question 9

Which sort algorithm is described below? set top of unsorted array to 0 search array from top to end to find index of largest entry swap value at top of array with value at index of largest entry increment top repeat until end of loop

bubble sort
selection sort
insertion sort

Flag this Question

Question 10

You can swap 2 rows of a 2-dimensional array

True
False

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Management With Website Development Applications

Authors: Greg Riccardi

1st Edition

0201743876, 978-0201743876

More Books

Students also viewed these Databases questions

Question

Contrast variables that increase helping and aggressive behavior.

Answered: 1 week ago