Mindoro State University
College of Computer Studies
ICT Proficiency Certification
Examination Review
Prepared by:
JAKE C. SISCAR
Instructor
E-mail Address: [email protected] /
Mobile Number: +639760720079
ICT Proficiency Certification Examination Review College of Computer
College of
College of
Computer
Computer Program Simulation
Click to edit Master title style
Studies
Studies
ICT Proficiency Certification Examination Review TOPIC: PROGRAM SIMULATION
College of
College of
Computer
Computer Program Simulation
Click to edit Master title style
Studies
Studies
Program simulation for the ICT Proficiency exam
involves understanding the:
• flow of a program,
• predicting outputs, and
• identifying errors.
ICT Proficiency Certification Examination Review TOPIC: PROGRAM SIMULATION
College of
College of
Computer
Computer Program Simulation
Click to edit Master title style
Studies
Studies
Understanding Control Structures
1. Loops
Be familiar with for, while, and do-while loops, their
conditions, and how they iterate.
ICT Proficiency Certification Examination Review TOPIC: PROGRAM SIMULATION
College of
College of
Computer
Computer Program Simulation
Click to edit Master title style
Studies
Studies
Understanding Control Structures
1. Loops
- For Loop (Basic)
This example prints the numbers from 1 to 5.
public class Main {
public static void main(String[] args) {
for (int i = 1; i <= 5; i++) {
System.out.println(i);
}
}
}
ICT Proficiency Certification Examination Review TOPIC: PROGRAM SIMULATION
College of
College of
Computer
Computer Program Simulation
Click to edit Master title style
Studies
Studies
Understanding Control Structures
1. Loops
- For Loop (Basic)
1
2
3
4
5
ICT Proficiency Certification Examination Review TOPIC: PROGRAM SIMULATION
College of
College of
Computer
Computer Program Simulation
Click to edit Master title style
Studies
Studies
Understanding Control Structures
1. Loops
- For Loop with Condition
This example prints the even numbers from 1 to 10.
public class Main {
public static void main(String[] args) {
for (int i = 1; i <= 10; i++) {
if (i % 2 == 0) {
System.out.println(i);
}
}
}
}
ICT Proficiency Certification Examination Review TOPIC: PROGRAM SIMULATION
College of
College of
Computer
Computer Program Simulation
Click to edit Master title style
Studies
Studies
Understanding Control Structures
1. Loops
- For Loop with Condition
2
4
6
8
10
ICT Proficiency Certification Examination Review TOPIC: PROGRAM SIMULATION
College of
College of
Computer
Computer Program Simulation
Click to edit Master title style
Studies
Studies
Understanding Control Structures
1. Loops
- Nested For Loop
This example prints a multiplication table for numbers 1 through 3.
public class Main {
public static void main(String[] args) {
for (int i = 1; i <= 3; i++) {
for (int j = 1; j <= 3; j++) {
System.out.println(i + " * " + j + " = " + (i * j));
}
}
}
}
ICT Proficiency Certification Examination Review TOPIC: PROGRAM SIMULATION
College of
College of
Computer
Computer Program Simulation
Click to edit Master title style
Studies
Studies
Understanding Control Structures
1. Loops
- Nested For Loop
1*1=1
1*2=2
1*3=3
2*1=2
2*2=4
2*3=6
3*1=3
3*2=6
3*3=9
ICT Proficiency Certification Examination Review TOPIC: PROGRAM SIMULATION
College of
College of
Computer
Computer Program Simulation
Click to edit Master title style
Studies
Studies
Understanding Control Structures
1. Loops
- Basic While Loop
public class Main {
public static void main(String[] args) {
int i = 1;
while (i <= 5) {
System.out.println(i);
i++;
}
}
}
ICT Proficiency Certification Examination Review TOPIC: PROGRAM SIMULATION
College of
College of
Computer
Computer Program Simulation
Click to edit Master title style
Studies
Studies
Understanding Control Structures
1. Loops
- Basic While Loop
1
2
3
4
5
ICT Proficiency Certification Examination Review TOPIC: PROGRAM SIMULATION
College of
College of
Computer
Computer Program Simulation
Click to edit Master title style
Studies
Studies
Understanding Control Structures
1. Loops
- While loop for summation public class Main {
public static void main(String[] args) {
int i = 1;
int sum = 0;
while (i <= 10) {
sum += i;
i++;
}
System.out.println("Sum: " + sum);
}
}
ICT Proficiency Certification Examination Review TOPIC: PROGRAM SIMULATION
College of
College of
Computer
Computer Program Simulation
Click to edit Master title style
Studies
Studies
Understanding Control Structures
1. Loops
- While loop for summation
Sum: 55
ICT Proficiency Certification Examination Review TOPIC: PROGRAM SIMULATION
College of
College of
Computer
Computer Program Simulation
Click to edit Master title style
Studies
Studies
Understanding Control Structures
1. Loops
- While Loop with Array
public class Main {
public static void main(String[] args) {
int[] numbers = {1, 2, 3, 4, 5};
int i = 0;
while (i < numbers.length) {
System.out.println(numbers[i]);
i++;
}
}
}
ICT Proficiency Certification Examination Review TOPIC: PROGRAM SIMULATION
College of
College of
Computer
Computer Program Simulation
Click to edit Master title style
Studies
Studies
Understanding Control Structures
1. Loops
- While Loop with Array
1
2
3
4
5
ICT Proficiency Certification Examination Review TOPIC: PROGRAM SIMULATION
College of
College of
Computer
Computer Program Simulation
Click to edit Master title style
Studies
Studies
import java.util.Scanner;
Understanding Control Structures public class Main {
1. Loops public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
- Do While with User input int input;
do {
System.out.println("Enter a number (0 to exit): ");
input = scanner.nextInt();
if (input != 0) {
System.out.println("You entered: " + input);
}
} while (input != 0);
System.out.println("Exited the loop.");
scanner.close();
}
}
ICT Proficiency Certification Examination Review TOPIC: PROGRAM SIMULATION
College of
College of
Computer
Computer Program Simulation
Click to edit Master title style
Studies
Studies
Understanding Control Structures
1. Loops
- Do While with User input
Enter a number (0 to exit):
5
You entered: 5
Enter a number (0 to exit):
3
You entered: 3
Enter a number (0 to exit):
0
Exited the loop.
ICT Proficiency Certification Examination Review TOPIC: PROGRAM SIMULATION
College of
College of
Computer
Computer Program Simulation
Click to edit Master title style
Studies
Studies
Understanding Control Structures
1. Loops
- Do While with User input
Enter a number (0 to exit):
5
You entered: 5
Enter a number (0 to exit):
3
You entered: 3
Enter a number (0 to exit):
0
Exited the loop.
ICT Proficiency Certification Examination Review TOPIC: PROGRAM SIMULATION
College of
College of
Computer
Computer Program Simulation
Click to edit Master title style
Studies
Studies
Understanding Control Structures
2. Conditional Statements
- If Statement
This example checks if a number is positive.
public class Main {
public static void main(String[] args) {
int number = 10;
if (number > 0) {
System.out.println(number + " is positive.");
}
}
}
ICT Proficiency Certification Examination Review TOPIC: PROGRAM SIMULATION
College of
College of
Computer
Computer Program Simulation
Click to edit Master title style
Studies
Studies
Understanding Control Structures
2. Conditional Statements
- If Statement
10 is positive.
ICT Proficiency Certification Examination Review TOPIC: PROGRAM SIMULATION
College of
College of
Computer
Computer Program Simulation
Click to edit Master title style
Studies
Studies
Understanding Control Structures
2. Conditional Statements
- if-else Statement
public class Main {
public static void main(String[] args) {
int number = -5;
if (number > 0) {
System.out.println(number + " is positive.");
} else {
System.out.println(number + " is negative.");
}
}
}
ICT Proficiency Certification Examination Review TOPIC: PROGRAM SIMULATION
College of
College of
Computer
Computer Program Simulation
Click to edit Master title style
Studies
Studies
Understanding Control Structures
2. Conditional Statements
- if-else Statement
-5 is negative.
ICT Proficiency Certification Examination Review TOPIC: PROGRAM SIMULATION
College of
College of
Computer
Computer Program Simulation
Click to edit Master title style
Studies
Studies
Understanding Control Structures
2. Conditional Statements
- if-else if-else Statement public class Main {
public static void main(String[] args) {
int number = 0;
if (number > 0) {
System.out.println(number + " is positive.");
} else if (number < 0) {
System.out.println(number + " is negative.");
} else {
System.out.println(number + " is zero.");
}
}
}
ICT Proficiency Certification Examination Review TOPIC: PROGRAM SIMULATION
College of
College of
Computer
Computer Program Simulation
Click to edit Master title style
Studies
Studies
Understanding Control Structures
2. Conditional Statements
- if-else if-else Statement
0 is zero.
ICT Proficiency Certification Examination Review TOPIC: PROGRAM SIMULATION
College of
College of
Computer
Computer Program Simulation
Click to edit Master title style
Studies
Studies
Understanding Control Structures
2. Conditional Statements
- Switch Statement public class Main {
public static void main(String[] args) {
int day = 3;
switch (day) {
case 6:
case 1:
System.out.println("Saturday");
System.out.println("Monday");
break;
break;
case 7:
case 2:
System.out.println("Sunday");
System.out.println("Tuesday");
break;
break;
default:
case 3:
System.out.println("Invalid day");
System.out.println("Wednesday");
break;
break;
}
case 4:
}
System.out.println("Thursday");
}
break;
case 5:
System.out.println("Friday");
break;
ICT Proficiency Certification Examination Review TOPIC: PROGRAM SIMULATION
College of
College of
Computer
Computer Program Simulation
Click to edit Master title style
Studies
Studies
Understanding Control Structures
2. Conditional Statements
- Switch Statement
Wednesday
ICT Proficiency Certification Examination Review TOPIC: PROGRAM SIMULATION