Glossary
ArrayLists
A resizable array implementation in Java that allows dynamic addition and removal of elements, providing more flexibility than traditional arrays.
Example:
Managing a shopping cart where items can be added or removed at any time is best handled by an ArrayList because its size can change dynamically.
Arrays
A fixed-size, ordered collection of elements of the same data type, where each element is accessed by an integer index starting from zero.
Example:
Storing the scores of 10 students in a class can be efficiently done using an array of integers, int[] studentScores = new int[10];.
Code Tracing
The methodical process of manually executing code line by line, tracking variable values and program flow, to predict its output or behavior.
Example:
To debug why a loop is not terminating as expected, a programmer might perform code tracing to observe the loop's condition and counter variable changes.
Curly Braces {}
Symbols used in Java to define the boundaries of code blocks, such as those for `if`, `else`, loops, or methods, ensuring code organization and proper execution scope.
Example:
When defining the actions for a button click, all the code that runs when the button is pressed must be enclosed within curly braces {}.
FRQs (Free Response Questions)
A section of the AP Computer Science A exam where students are required to write or complete Java code to solve given problems, demonstrating their programming and problem-solving abilities.
Example:
On the AP exam, an FRQ might ask you to implement a class that simulates a deck of cards, including methods for shuffling and dealing.
If-Else Statement
A control structure that executes one block of code if a specified condition is true, and a different block of code if the condition is false.
Example:
If a user's age is less than 18, the program might display a 'Minor' message; otherwise, an 'Adult' message is shown, handled by an if-else statement.
Method Writing
The skill of designing and implementing reusable blocks of code (methods) that perform specific tasks, often taking parameters and returning values.
Example:
Creating a calculateTax() method writing for a financial application involves defining its input (e.g., income) and its output (the calculated tax amount).
Modulo Operator %
An arithmetic operator that returns the remainder of a division operation between two numbers.
Example:
To determine if a year is a leap year, you can use the modulo operator % to check if it's divisible by 4, 100, and 400.
Object-Oriented Programming (OOP)
A programming paradigm centered around 'objects' that encapsulate data and behavior, emphasizing concepts like classes, inheritance, and polymorphism to model real-world entities.
Example:
Building a simulation of a zoo where each animal is an Object-Oriented Programming object with its own characteristics (like species, age) and actions (like eat(), sleep()).
Recursion
A programming technique where a method calls itself to solve a problem, typically by breaking it down into smaller, similar subproblems until a base case is reached.
Example:
Calculating the Fibonacci sequence (where each number is the sum of the two preceding ones) is a classic problem often solved using recursion.
Searching
The process of finding a specific element within a collection of data, such as an array or list, to determine its presence or location.
Example:
When looking up a student's record in a large database by their ID number, a searching algorithm quickly locates the relevant information.
Sorting
The process of arranging elements in a list or array into a specific order, such as ascending or descending, based on a defined criterion.
Example:
To display a list of products on an e-commerce website from the lowest price to the highest, a sorting algorithm would be applied to the product data.