Unit 4: Iteration Flashcards
.equals(String string)
A method that is used to compare two strings for equality. It checks if both strings have exactly the same characters in the same order.
.length()
A method that is used to find the length or number of characters in a string.
.substring(int index)
A method that is used to extract and return part of a string starting from the specified index position.
2D Arrays
Data structures that store values in a grid-like format with rows and columns. They allow for the organization and manipulation of data in a two-dimensional manner.
Boolean Expression
A statement that evaluates to either true or false. It typically involves the use of comparison operators (such as ==, <, >) and logical operators (such as &&, ||).
Complex Algorithms
Sets of instructions or procedures designed to solve intricate problems or perform complex tasks. They often involve multiple steps, decision-making processes, and data manipulation techniques.
Control Structures
Programming constructs that determine the flow of execution in a program. They allow you to make decisions and repeat actions based on certain conditions.
Exam Weighting
Refers to the allocation of points or marks given to each section or topic in an exam. It determines how much each part contributes to the overall score.
For Loop
A control flow statement that allows you to repeatedly execute a block of code for a specified number of times or until certain conditions are met.
Iteration
Refers to the process of repeating a set of instructions multiple times in order to achieve a desired outcome. It allows for efficient execution of repetitive tasks without having to write redundant code.
Iteration Statement
Also known as a loop, allows for repeated execution of a block of code based on a specified condition. It helps automate repetitive tasks and saves time.
Loop Conditions
The conditions that determine whether a loop should continue executing or stop. They are typically expressed as boolean expressions and are evaluated before each iteration of the loop.
Loops
Control structures in programming that allow you to repeatedly execute a block of code until a specified condition is met. They provide an efficient way to perform repetitive tasks without writing redundant code.
Nested For Loops
A way to repeat a set of instructions multiple times within another loop. It allows you to iterate over elements in a multi-dimensional data structure, such as a 2D array.
Nested if statements
Conditional statements that are placed inside another conditional statement. They allow for more complex decision-making by checking multiple conditions within each other.
Return Statement
Used in functions/methods to specify what value should be sent back as output when the function is called. It terminates the execution of a function and returns control back to where it was called from.
Reversing a String
Changing the order of its characters so that the last character becomes the first, the second-to-last character becomes the second, and so on.
String Methods
Built-in functions in programming languages that allow manipulation and processing of strings (sequences of characters). They provide useful operations such as finding substrings, replacing characters, converting case, and more.
String Traversals
Refer to the process of accessing and examining each character in a string. It involves iterating through the characters one by one.
Tracing
Refers to the process of following the execution of a program step by step to understand how it works and identify any errors or bugs.
while loop
A control flow statement that allows a block of code to be executed repeatedly as long as a specified condition is true.
Write Methods
Refers to the process of creating reusable blocks of code that perform specific tasks. These methods can be called multiple times throughout a program, making the code more organized and efficient.
Boolean Statement
An expression that evaluates to either true or false. It is used in programming to make decisions and control the flow of a program.
Break statement
Used in loops (such as for and while loops) and switch statements to terminate their execution prematurely. It allows programmers to exit out of these constructs before reaching their natural end.
Counter
A variable that keeps track of a value, usually used to count or iterate through a loop.
divisibility modulo
Divisibility modulo refers to determining whether one number is divisible by another using modular arithmetic. It involves calculating the remainder when dividing one number by another.
Exception Handling
A mechanism in programming that allows you to handle and manage errors or exceptional situations that may occur during the execution of a program. It helps prevent the program from crashing by providing alternative paths or actions when an error occurs.
finally block
A section of code that follows a try-catch block and is always executed, regardless of whether an exception occurs or not. It is commonly used to perform cleanup tasks or release resources.
Flag
In programming, this is a variable or condition that acts as a signal or indicator. It helps control the flow of execution within a program.
Infinite Loop
A programming construct where a set of instructions keeps repeating indefinitely, causing the program to get stuck and not progress further.
Loop Body
Refers to the block of code that gets executed repeatedly in a loop. It contains the instructions that are repeated until the loop condition becomes false.
NumberFormatException
An exception that occurs when you try to convert a string into a numeric type (like int or double), but the string does not have the appropriate format for conversion.
Scanner class
A built-in Java class that allows users to read input from various sources, such as the keyboard or a file.
ArrayList
A dynamic data structure that allows you to store and manipulate collections of objects. Unlike arrays, ArrayLists can grow or shrink dynamically as needed.
Arrays
A collection of elements of the same data type, stored in contiguous memory locations. They have a fixed size and can be accessed using an index.
Conditional Expression
A statement that evaluates to either true or false based on the condition provided. It is commonly used in decision-making structures like if statements and loops.
Incrementer
An operator used to increase the value of a variable by one. It’s commonly used in loops and counting scenarios.
System.out.println
A Java statement used to display output on the console. It prints the specified message or value and adds a new line character at the end.
Traverse
Refers to the process of accessing each element in a data structure (such as arrays or linked lists) one by one, usually for performing some operation on them.
Equals Method
A method in Java that is used to compare two objects for equality. It checks if the values of the objects are the same, rather than comparing their memory addresses.
Loop Increment
The step in programming where variables are updated or modified after each iteration of a loop. It determines how the loop progresses and when it will eventually terminate.
Loop Initialization
The step in programming where variables are assigned initial values before entering a loop. It sets up the starting conditions for the loop’s execution.
Reverse
To change the order of its characters, so that the last character becomes the first, the second-to-last becomes the second, and so on.
Sliding Window
A technique used in computer science and algorithms where a fixed-size window moves through an array or string to perform operations on subarrays or substrings. It allows for efficient processing of data by avoiding redundant calculations.
boolean
A data type that can only have two possible values – true or false. It is often used in programming to make decisions and control the flow of a program.
Continue
A keyword used within loops (such as for or while loops) to skip the rest of the current iteration and move on to the next one. It allows you to control which iterations should be executed based on certain conditions.
Nested Iteration
Refers to the process of using one loop inside another loop. This allows for repeated execution of a block of code within another block of code.
prime number
A positive integer greater than 1 that has no positive divisors other than 1 and itself. In simpler terms, it’s a number that cannot be evenly divided by any other numbers except for 1 and itself.
System.out.print
A Java statement used to display output on the console. It allows you to print text or values directly to the standard output stream.
Zero-based indexing
A numbering system where the first element in an array or list is assigned index 0 instead of 1. This means that elements are accessed by their position relative to zero.
Nested For Loop
A loop structure where one loop is placed inside another loop. It allows for the repetition of a set of instructions within another set of instructions, resulting in more complex and controlled iterations.
Variables
Named storage locations in computer memory that hold values which can be changed during program execution.