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

🌍
|

Selection and Iteration Structures

407 viewsG11-01. Programming
0

  1. Write a program in pseudo code to categorize a person’s BMI (Body Mass Index) as Underweight (<18.5), Normal (18.5-24.9), or Overweight (≥25).

  2. Write a switch/case pseudo code to display a message based on a day number (1=Monday, 2=Tuesday, …, 7=Sunday).

  3. What is the difference between a while loop and a do-while loop?

  4. Optimize a loop to calculate the factorial of a number.

  5. Write pseudo code to sum digits of a number until a single digit is obtained.

Ruwan Suraweera Changed status to publish
0

Answers and Descriptions

  1. Answer:

Description: Nested If-Else statements handle multiple BMI ranges, testing complex selection logic for real-world applications.

  1. Answer:

Description: Switch/case maps a single variable to multiple outcomes, ideal for enumerated values like days, enhancing code clarity.

  1. Answer: A while loop checks the condition before executing, while a do-while loop executes at least once before checking the condition.
    Description: While loops may skip execution if the condition is false, whereas do-while loops guarantee one execution, useful for menu-driven programs.

  2. Answer:

Description: This loop uses a single variable to accumulate the product, demonstrating efficient iteration for factorial computation.

  1. Answer:

Description: This while loop handles unknown iterations, summing digits until a single digit remains, testing advanced iteration logic.

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.