Las Ict7 Java Q3 Las 2
Las Ict7 Java Q3 Las 2
QUARTER 3 WEEK 2
Learning Activity Sheet
Quarter 3 – Activity Sheet 2: Loops
Unang Edisyon, 2023
Republic Act 8293, section 176 states that: No copyright shall subsist in any work of the
Government of the Philippines. However, prior approval of the government agency or
office wherein the work is created shall be necessary for exploitation of such work for
profit. Such agency or office may, among other things, impose as a condition the payment
of royalties.
Borrowed materials (i.e., songs, stories, poems, pictures, photos, brand names,
trademarks, etc.) included in this module are owned by their respective copyright holders.
Every effort has been exerted to locate and seek permission to use these materials from
their respective copyright owners. The publisher and authors do not represent nor claim
ownership over them.
This Learning Activity Module (LAS) was designed and written with you in mind. It is
here to help you master Java Technology and the Java Programming Language. The
scope of this module permits it to be used in many different learning situations. The
language used recognizes the diverse vocabulary level of students. The lessons are
arranged to follow the standard sequence of the course. But the order in which you
read them can be changed to correspond with the textbook you are now using.
The LAS is divided into one (1) learning outcome, specifically:
After going through this Learning Activity Sheets, you are expected to:
In this Learning Activity Sheet, you will study about Java technology and
Java programming.
1. Study the lessons and answer religiously the activities. These will guide you on
what you will learn at the end of this Learning Activity Sheet.
Activity 1:
Directions: Create a schedule of your usual activities every Saturday. Use the
table below to answer.
Timeframe Activities/Schedule
Loops
For Loop
initialization – initial values of variables that will be used in the loop; it is even
possible to declare other variables here that will be used in your loop
test condition – a boolean expression that should be satisfied for the loop to
continue executing the statements within the loop’s scope; as long as the condition
is true, the set of statements within the loop will be repeated
Syntax:
<statement/s>
Example: Output:
While Loop
Here the condition is at the beginning and the set of instructions inside the loop
will be repeated until this condition becomes false.
Syntax:
<statement/s>
}
Example: Output:
Do-While Loop
The do-while loop is the only loop which executes at least once. This is due to the
fact that the condition for the loop is located at the last part.
Syntax:
do{
<statement/s>
Example: Output
Nested Loops
In Java, a nested loop is a loop inside another loop. This means you can have one
loop (inner loop) inside another loop (outer loop).
Example: Output:
? Questions
Activity 2:
Directions: Read and analyze each statement. Write check (/) if the statement is
correct and (x) if otherwise.
_________4. Initialization is the part of the for loop where initial values of the
variables are assigned.
_________6. The set of statements within the loop will be repeated as long as the
condition set in the for loop is false.
_________7. The condition in while loop is at the beginning and the set of
instructions inside the loop will be repeated until this condition
becomes false.
_________8. The do-while loop is the only loop which executes statements at least
once.
_________9. The condition in the while loop is located at the last part.
Directions: Read and analyze the sample Java Code below and provide what is
asked in each item below the code.
Directions: Directions: Write a Java Loop Statement determine that will print even
numbers from 1-15. Write your code in the box including the variable declaration of
num and your chosen number.
-------------------------------------
-------------------------------------
-------------------------------------
Telefax: -------------------------