Chapter 7: Single Arrays Flashcards

1
Q

What’s the preferred syntax when declaring a variable?

A

elementType[] arrayRefVar;

Double[] myList;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How to create an array?

A

arrayRefVar = new elementType[arraysize];

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is an indexed variable?

A

An individual element inside of an array.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

How can you create a new arrary with a name and size?

A

elementType arrayRefVar[] = new elementType[arraySize];

EXAMPLE

double[] myList = new double[10];

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What are the two types of array searches?

A

Linear and Binary, linear is better with smaller arrays and easier to set up, but binary is more effective while being harder to set up.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What are some useful tools in java.util.Arrays?

A

sort or parallelSort - SORTS AN ARRAY

binarySearch - SEARCHES FOR A KEY IN ARRAY

equals - CHECKS TO SEE IF TWO ARRAYS ARE EQUAL

fill - FILLS IN AN ARRAY

toString - DISPLAYS A STRING OF THE ELEMENT IN THE ARRAY

How well did you know this?
1
Not at all
2
3
4
5
Perfectly