Comp Sci Chapter 11 AP MC

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

What would the following code return from mystery ([90,-30,50],-20)?

-1

What is printed when the following main method is executed? (GuestList)

0

What is printed when the following main method is executed?

1

Consider the binarySearch method below. How many times would the while loop execute if you first do int[] arr = {2,10,23,31,55,86} and then call binarySearch(arr,2)

2

What is printed when the following main method is executed? (NumberCount)

2

What would the following code return from mystery ([90,-30,50],50)?

2

What is printed when the following main method is executed? (PrimeOrNot)

2,3,5,9,3,4

What is printed when the following main method is executed? (OddEvenMod)

4,7,7,3,8,1

What is printed when the following main method is executed? (DivisibleBy2or3)

9 7 17 6 3 2 1 5

What is printed when the following main method is executed? (AlphaSort)

ABBCDE

Which of the following changes to the sort method would correctly sort the integers in elements into descending order?

I and III only

Under what condition will an ascending insertion sort execute the slowest?

If the data is already sorted in descending order

What is printed when the following main method is executed? (GradeSort)

John Dominic Anna Roger Bob Billy

What would test return if a={1,2,3,4} and v=3

The code will not compile

In which situation would it be best to choose a sequential search instead of a binary search

When the data can not be sorted

Under which condition will the method not necessarily produce the desired result?

When the values in the array are all positive

Which statement should replace statement so that the method works as intended?

if (n < min) min=n;

Which of the following could be used to replace //missing code// in the code so that the method always sorts the array elem in ascending order?

int k= j+1; k < elem.length; k++

Which sort contains a recursive call?

merge sort

Which of the following correctly shows the iterations of an ascending insertion sort on an array with the following elements: {10,6,3,2,8}

{2,6,3,10,8}, {2,3,6,10,8}, {2,3,6,10,8}, {2,3,6,8,10}

Which of the following correctly shows the iterations of an ascending insertion sort on an array with the following elements: {7,3,8,5,2}

{3,7,8,5,2}, {3,7,8,5,2}, {3,5,7,8,2}, {2,3,5,7,8}


Set pelajaran terkait

lección 7: la tecnología y la ciencia

View Set

Chapter 4 Risk- Operational, Financial and Strategic Risk

View Set

Psychology CIE 9990 Health, Abnormality

View Set

Finance - Ch. 7: Interest Rates and Bond Valuation

View Set

Engineering Graphics - Lecture 1, 2A, 2B

View Set

Practice of Real Estate and Disclosures-Final Exam

View Set