Unit 2 Test Review ICS3U 2025
Unit 2 Test Review ICS3U 2025
ICS3U
The Format
• You can prepare a study guide to bring in (1 double sided page).
• No access to google, ChatGPT, etc…
• No coding for the test.
Definition Sections (roughly 5 questions)
• Matching
• Multiple Choice
• Few short answer
Code Identification Sections (roughly 5 questions)
• Identifying usage of programming concepts in code examples
• Identifying the purpose of code examples
• Identifying the output of code examples
• Labeling code examples
Pseudocode (2 questions)
• Reading a pseudocode plan and determining the purpose and output of it.
• Creating a code outline/plan for how you would create a program.
Concepts: Data Types and Variables
• Primitive Data Types: int, double, Boolean, character
• Objects: Strings, Scanners, etc…
Data types define what kind of data can be placed inside a variable.
The type must be declared when the variable is first created.
Variables have a scope: the scope of a variable are the areas of the
programs that a variable exists in. The scope of a variable is defined by
where in the program the variable is defined:
Variables only exist in the control structure in which they are defined.
Control Structures
Used to control the flow of a program.
• If
• Based around Booleans statements. If this is true … then do this …
• Switch//Case
• Uses case matching to execute code.
• For
• Used to loop a countable number of times
• Do
• Used to loop while a Boolean statement is true: checks at the end of the loop.
• While
• Used to loop while a Boolean statement is true: checks at the start of the
loop.
• Try//Catch
• Used to catch errors. Code is tried and will be caught if it throws an exception
If Statements
if (Boolean == true){
//do this code
} else if (Boolean == true){
//do this code (if the above did not happen)
} else if (Boolean == true){
//do this code (if the above did not happen)
}…
}else{
//do this code (if none of the above did not happen)
}
If Statements Statement Operator Statement Outcome
True && True True
Comparison (aka Relational) Operators
True && False False
False && True False
False && False False
do{
//this will repeat as long as the conditional is true
//the conditional is only checked at the end of the loop
//this guarantees that the loop will run at least once
} while(conditional);
While Loops
while(conditional){
//this will repeat as long as the conditional is true
//the conditional is checked at the start of the loop
//the loop might not run
}
Errors
• Syntax: These errors occur from typos or mistakes in the code you
write. It makes code uncompilable and, therefore, not runnable. They
are caught by the IDE with a red underline (usually).
• Runtime: These errors occur while the program is running. They will
crash the program, throwing an Exception. There are many different
kinds of Exceptions (like IOException, ArithmeticException, etc..)
• Logic: These types of errors don’t cause the program to crash. They
won’t be underlined by the IDE. Instead they cause the code to have
unexpected or unplanned outcomes.
Arrays
An array is a type of data structure—that is a way of orgnaizing and
representing information. In Java an array is a collection of variables that
share a type.
Element: Each variable within an array is called an element. An element is
made of both a value and an index.
Index: The index of an element refers to its position within the array.
Each array starts counting indexes at 0, and the indexes increase by 1
reaching up to the length of the array – 1.
Value: A value is the actual information stored at the index.
counter = 0
for 1 to length
increase counter by 1
call ALPHABET pass counter as parameter
MAIN END