Unit 4 Practice Exam: Arrays and ArrayLists

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/13

flashcard set

Earn XP

Description and Tags

Flashcards covering Java programming concepts including 1D and 2D arrays, ArrayList syntax, and standard iteration methods based on the Unit 4 practice exam.

Last updated 11:58 PM on 5/28/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai

No analytics yet

Send a link to your students to track their progress

14 Terms

1
New cards

Array Length Property

The property used to determine the total number of elements in an array, such as int[] nums = new int[5]; having a length of 55.

2
New cards

Valid Array Declaration

A syntax like String[] colors = {"Red","Blue","Green"}; or double[] grades = {88.5,91.2,77.8}; that properly initializes an array with specific values.

3
New cards

Array Index Access

The syntax used to retrieve or modify an element, such as values[(values.length-1)] which accesses the last element of an array.

4
New cards

names[i].contains("Smith")

A boolean method used within a loop to check if a specific string element in the names array contains the sequence "Smith".

5
New cards

words[i].length()

A method used to return the number of characters in a string element located at index ii of the words array.

6
New cards

2D Array Initialization

The syntax int[][] nums={ {1,2,3}, {4,5,6} }; which creates a multidimensional array containing rows and columns.

7
New cards

Row-Major 2D Array Creation

The syntax int[][] board=new int[5][8]; which correctly creates a 2D array structure consisting of 55 rows and 88 columns.

8
New cards

data.length (2D Array)

The property of a 2D array that returns the number of rows contained within the structure.

9
New cards

data[0].length

The property of a 2D array that returns the number of columns in the first row.

10
New cards

Nested For-Loops (2D Arrays)

A control structure where an outer loop iterates through rows (r<array.length) and an inner loop iterates through columns (c<array[r].length).

11
New cards

ArrayList.size()

The specific method used to return the current number of elements stored in an ArrayList.

12
New cards

ArrayList Type Constraint

A rule in Java stating that ArrayList cannot use primitive types (e.g., double); it must use wrapper classes (e.g., Double).

13
New cards

ArrayList.get(i)

The method used to retrieve an element at index ii from an ArrayList, as the square bracket syntax list[i] causes a Compiler Error.

14
New cards

ArrayList.remove(index)

A method that deletes the element at the specified index and shifts all subsequent elements to the left, effectively changing their index positions.