Glossary

1

1-D Arrays

Criticality: 3

A linear data structure where elements are arranged in a single sequence, accessed using a single numerical index.

Example:

A list of daily temperatures for a week, double[] *weeklyTemps*, would be represented as a 1-D array.

2

2-D Arrays

Criticality: 1

A data structure (covered in Unit 8) that organizes data in a grid-like format, using two indices (typically row and column) to access elements.

Example:

A spreadsheet or a game board can be effectively modeled using a 2-D array, where board[row][col] accesses a specific cell.

A

Array Algorithms

Criticality: 3

Standard computational procedures or patterns applied to arrays to perform specific tasks, such as finding minimum/maximum values, calculating sums, searching for elements, or reordering elements.

Example:

Implementing a search function to find if a specific student ID exists in an array of IDs is an example of an array algorithm.

ArrayIndexOutOfBoundsException

Criticality: 3

A runtime error that occurs when a program attempts to access an array element using an index that is outside the valid range of indices for that array.

Example:

Trying to access myArray[10] when myArray only has 5 elements (indices 0-4) will cause an ArrayIndexOutOfBoundsException.

ArrayIndexOutOfBoundsException

Criticality: 3

A common runtime error in Java that occurs when a program attempts to access an array element using an index that is outside the valid range (i.e., negative or greater than or equal to the array's length).

Example:

If int[] numbers = new int[5]; is declared, trying to access numbers[5] will result in an ArrayIndexOutOfBoundsException.

ArrayLists

Criticality: 1

A dynamic data structure (covered in Unit 7) that provides resizable array functionality, allowing elements to be added or removed after creation.

Example:

Unlike a fixed-size array, an ArrayList is perfect for managing a user's shopping cart, as items can be easily added or removed.

Arrays

Criticality: 3

A fundamental data structure used to store a fixed-size collection of elements of the same data type, which can be either primitive or reference types. Arrays themselves are reference types.

Example:

To store the high scores of a game, you might use int[] *highScores* = {980, 1200, 750};.

Arrays

Criticality: 3

A container object that holds a fixed number of values of a single, specified type. Its length is determined at creation and cannot be changed.

Example:

To store the high scores for a game, you might use int[] *highScores* = new int[10]; to hold ten integer values.

C

Constructor (for arrays)

Criticality: 2

A specific syntax used to initialize an array with a predefined size, where elements are automatically set to default values based on their data type.

Example:

String[] studentNames = new String[5]; uses a constructor to create an array that can hold 5 student names, initially all null.

D

Data Structures

Criticality: 2

Structures designed to store multiple pieces of data in an organized way, allowing for efficient access and manipulation. Arrays are one type of data structure.

Example:

Beyond arrays, a linked list is another data structure that stores elements in a sequence, but unlike arrays, its size can change dynamically.

Data structures

Criticality: 2

Structures designed to store and organize multiple pieces of data in a specific way, enabling efficient access and manipulation.

Example:

An array is a fundamental data structure that allows you to manage a collection of related items, like a list of student IDs.

Default values (for array elements)

Criticality: 2

The initial values automatically assigned to elements of an array if they are not explicitly populated during initialization. These values depend on the element's data type (e.g., 0 for int, 0.0 for double, false for boolean, null for objects).

Example:

If you create boolean[] flags = new boolean[3]; without assigning values, all elements will have a default value of false.

E

Enhanced for loop ("for-each" loop)

Criticality: 3

A simplified `for` loop syntax designed to iterate over each element in an array (or other iterable collections) without requiring explicit management of indices.

Example:

To print every character in a char[] letters array, you can use for (char letter : *letters*) { System.out.print(letter); }.

I

Index (Array Index)

Criticality: 3

A numerical position used to uniquely identify and access a specific element within an array.

Example:

In the array String[] colors = {"red", "green", "blue"};, the element "green" is located at index 1.

N

NullPointerException

Criticality: 2

A runtime error that occurs when a program attempts to use an object reference that currently points to `null`, indicating it does not refer to any actual object in memory.

Example:

If String[] names = new String[2]; is created and you try to call names[0].toUpperCase(), it will throw a NullPointerException because names[0] is null by default.

P

Pre-initialized Arrays

Criticality: 2

A method of creating an array by directly providing a list of initial values enclosed in braces, which also determines the array's fixed size.

Example:

boolean[] answers = {true, false, true}; creates a pre-initialized array with three boolean values.

T

Traverse (Traversing Arrays)

Criticality: 3

The process of systematically visiting each element in an array, typically using a loop, to perform an operation or inspect its value.

Example:

To find the average of all student scores, you would traverse the scores array, summing up each element.

Traverse (an array)

Criticality: 3

The process of iterating through each element of an array, typically using a loop, to access or manipulate its contents.

Example:

To find the largest number in a list of temperatures, you would traverse the temperatures array, comparing each element.

Z

Zero-based (Zero-based indexing)

Criticality: 3

The convention in Java where the first element of an array is located at index 0, the second at index 1, and so on, meaning an array of length N has valid indices from 0 to N-1.

Example:

When working with an array of 10 items, remember that the last item is at zero-based index 9, not 10.

Zero-indexed language

Criticality: 3

A characteristic of a programming language where the first element in a sequence or array is located at index 0, rather than index 1.

Example:

In Java, if you have an array colors with "red", "green", "blue", "red" is at colors[0] because it's a zero-indexed language.

a

arrayName.length

Criticality: 3

An instance variable that provides the total number of elements an array can hold, representing its fixed size. It is not a method, so no parentheses are used.

Example:

If int[] scores = new int[10];, then scores.*length* would evaluate to 10, indicating the array's capacity.