School ICT Self Study
Absolutely Free Learning Opportunity! No Need to Spend Money! Study at Your Own Pace! Everything You Need is Right Here
UNLOCK YOUR DIGITAL FUTURE!
Free ICT Learning for Sri Lanka
🚀 Welcome to School ICT

Your Gateway to Digital Excellence

🌍
|

Control Structures in Algorithms

370 viewsG11-01. Programming
0

  1. Name the three main control structures used in algorithm development and give an example of each.

  2. Design an algorithm to find the largest number in a list using iteration and selection.

  3. When would you choose iteration over selection in an algorithm?

  4. Write pseudo code to check if a number is even.

  5. Write pseudo code to print numbers from 1 to 5 using a loop.

Ruwan Suraweera Changed status to publish
0

Answers and Descriptions

  1. Answer: 1. Sequence: Executing statements in order (e.g., adding two numbers). 2. Selection: Making decisions (e.g., if a number is positive). 3. Iteration: Repeating steps (e.g., printing numbers 1 to 10).
    Description: Control structures guide program flow. Sequence ensures linear execution, selection enables conditional branching, and iteration supports repetition, forming the core of algorithm design.

  2. Answer:

Description: This algorithm uses iteration (looping through the list) and selection (comparing numbers) to find the maximum, demonstrating practical application of control structures.

  1. Answer: Use iteration when repeating a task multiple times, such as summing numbers, and selection when making a one-time decision, like checking if a number is positive.
    Description: Choosing the appropriate control structure depends on the problem. Iteration is ideal for repetitive tasks, while selection handles conditional logic, optimizing algorithm efficiency.

  2. Answer:

Description: Pseudo code provides a clear, human-readable algorithm representation. This example uses a selection structure to check divisibility by 2, reinforcing control structure application.

  1. Answer:

Description: A for loop is used when the number of iterations is known. This loop prints numbers 1 to 5, illustrating a basic iteration structure for repetitive tasks.

Ruwan Suraweera Changed status to publish
🔴 Lesson List
SIDE BUTTON ON
Sign In Register
×

👋 Welcome Back!

🚀
Ready to Learn?Pick up where you left off.
🔑
Forgot Password?Click the link below to reset.
📢
New FeaturesCheck out the new AI Voice tool.

Sign In

👤
🔒
or continue with
Google Facebook

Already have an account? Register Now

🖥️ View Desktop Version Switch to full website view.