Data Sets & Ethics
Parsing & File Input
Arrays & ArrayLists
Looping & Traversing
Trivia Time!
100

What is a data set?

A collection of related specific data used for analysis, training programs, or making decisions.

100

What does Integer.parseInt("42") return?  Be PRECISE!

The int 42.

100

What is the index of the first element in an array or ArrayList?

0

100

What is the correct loop condition to avoid out-of-bounds errors when looping through an array named arr?

i < arr.length

100

What fruit used to be called a "Persian Apple"?

The peach

200

Why is it important to evaluate how a data set was collected before using it?

It may be biased, incomplete, or unrepresentative, leading to flawed conclusions.

200

What happens if Integer.parseInt() is used on a non-numeric string?  Be PRECISE!

It throws a NumberFormatException.

200

What method is used to get the size of an ArrayList?

What is used to get the size of an array?

ArrayList: .size() 

Array: .length

200

What does it mean to traverse an array?

To visit each element, usually using a loop.

200

What is the only country named after a woman?

St. Lucia

300

What is the difference between bias and algorithmic bias?

Bias is any unfair preference toward a group or outcome.

Algorithmic bias occurs when a program produces unfair results due to biased data.

300

What class is used to read data from a file line by line?

Scanner

300

What method replaces an element at a specific index in an ArrayList?

.set(index, value)

300

What should we do when we call the .remove() element in a standard for loop?  

Why do we need to do this?

We must use i-- when we call remove()

We have to do this to make sure that we check the element that "slides" to the left to replace the removed element.  If we did not use i--, we would go to the next index value and skip that element.

300

What two seas does the Suez Canal connect?

The Mediterranean Sea and the Red Sea

400

What is unintended data persistence?

Unintended data persistence is when data remains in a system after a user tries to remove it

400

What loop condition is commonly used to read all lines from a file?

while (scanner.hasNextLine()) 

or 

while (scanner.hasNext())

400

What is the difference between .add(index, value) and .set(index, value)?

.add() adds a new element at that index (and slides all elements at that index and greater to the right by 1)

.set() replaces an existing element at that index and returns the element replaced.  

Both are ArrayList methods.

400

What is printed?

int[] nums = {2, 4, 6};

for (int i = 0; i < nums.length-1; i++) {

    System.out.print(nums[i] + " ");

}

2 4

400

What dinosaur's name means "Speedy Thief"?

Velociraptor

500

What is a data breach / unauthorized access?

A data breach is when hackers access a database and expose sensitive information; unauthorized access is when someone gains access to a user’s account or device without permission.  (These may be the same thing)

500

What is the correct order of steps to read from a file?  Answer in plain english / pseudocode.

Add the .txt file to the project
Import File and Scanner Classes
Create File Object
Create Scanner object that uses File Object
Loop through data with a while loop and Scanner object
Close Scanner.

500

Given:  ArrayList<String> colors that contains "red", "yellow", "blue".  

What will be the result from the code:  
colors.set(3, "green")?

An IndexOutOfBoundsException occurs

500

What is printed?

int[] a = {1, 2, 3};

int[] b = {4, 5, 6};

for (int i = 0; i < a.length; i++) {

    System.out.print(a[i] + b[i] + " ");

}


5 7 9

500

What is the longest word in the English language that contains just one vowel?

Strengths

M
e
n
u