chap 7 key terms and concepts Flashcards

1
Q

what is a size declarator?

A

The number of elements, or values, the array can hold.

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

What happens in this line int[] numbers = new int[6];

A

The array is initialized with a size of 6, meaning it can hold 6 integer values.

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

What is a subscript?

A

A subscript is used as an index to pinpoint a specific element within an array. (Also known as an index).

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

What is the format for an enhanced for loop

A

for (dataType elementVariable : array)
statement;

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

What does the sequential search algorithm do?

A

The sequential search algorithm uses a loop to sequentially step through an array, starting with the first element. It compares each element with the value being searched for and stops when the value is found or the end of the array is encountered

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

For a 2-D Array, what is the order of Rows and columns, say in this:

double[][] scores = new double[3][4];

A

The first is row, then column.

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

What is a ragged array?

A

When the rows of a two-dimensional array are of different lengths.

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

How does the selection sort work?

A

The smallest value in the array is located and moved to element 0. Then the next smallest value is located and moved to element 1. This process continues until all of the elements have been placed in their proper order

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

How does the binary search algorithm work?

A

Binary search works by repeatedly dividing the search interval in half and comparing the target value with the middle element until the target is found or the search interval becomes empty, achieving a time complexity of O(log n) in a sorted array.

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

What are variable-length argument lists?

A

variable-length argument lists makes it possible to write a method that takes a variable number of arguments. In other words, you can write a method that accepts any number of arguments when it is called. When the method runs, it can determine the number of arguments that were passed to it and act accordingly.

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