wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

APCSA Search & Sort

Total questions: 15

Worksheet time: 29mins

Name
Class
Date
1.

Which method puts all items in x in ascending order?

a)

sort(x)

b)

binarySearch(x,y)

c)

equals(x,y)

d)

toString(x)

e)

fill(x,y)

2.

Which method checks x for the location of y?

a)

sort(x)

b)

binarySearch(x,y)

c)

equals(x,y)

d)

toString(x)

e)

fill(x,y)

3.

Which method checks if x and y have the same value?

a)

sort(x)

b)

binarySearch(x,y)

c)

equals(x,y)

d)

toString(x)

e)

fill(x,y)

4.

Which method returns a string version of x in [ , ] form?

a)

sort(x)

b)

binarySearch(x,y)

c)

equals(x,y)

d)

toString(x)

e)

fill(x,y)

5.

binarySearch works best on:

a)

unsorted array

b)

sorted or unsorted arrays

c)

sorted array

6.

If the specified value is present, binarySearch will return:

a)

true

b)

spot at which the value is present

c)

yes

d)

the value

7.

If the value is NOT present, binarySearch will return:

a)

False

b)

-1

c)

-1 + -1 + (where it should be present)

d)

-1 + -1 * (where it should be present)

8.

Linear/Sequential Algorithm are:

a)

complicated

b)

basic

c)

extremely long code

d)

one line of code

9.

Linear/Sequential search is most commonly written using:

a)

nested for loops

b)

a for loop and an if statement

c)

multiple if statements

d)

2D arrays

10.

Selection Sort puts all of the items in an array in:

a)

ascending order only

b)

descending order only

c)

ascending or descending

d)

neither ascending or descending

11.

Selection sort is most commonly written using:

a)

nested for loops

b)

a for loop and an if statement

c)

multiple if statements

d)

2D arrays

12.

split() returns:

a)

number of items in an array

b)

list of Strings in alphabetical order

c)

all Strings connected as one long word

d)

array of String references

13.

split() requires that a split value be provided

a)

True

b)

False

14.

split() can be used to like a Scanner to chop up large numbers into smaller numbers

a)

True

b)

False

15.

Which is correct?

a)

import java.util.Arrays;

b)

import.java.util.array;

c)

import java.util.Array;

d)

import Java.Util.Arrays;

e)

import Java.Util.Array;