CS Grade 6-8

CS: Algorithms and Flowcharts

Planning steps and showing program logic

View Answer Key
Name:
Date:
Score: / 12

Planning steps and showing program logic

CS - Grade 6-8

Instructions: Read each problem carefully. Show your thinking clearly and use step-by-step logic when needed.
  1. 1
    Ingredients and tools for making a peanut butter and jelly sandwich.

    Write an algorithm with at least 5 steps for making a peanut butter and jelly sandwich. Use clear, numbered steps.

  2. 2
    A flowchart with a decision diamond branching into two possible outcomes.

    A flowchart starts with Start, then says Input age, then uses a decision diamond labeled age >= 13. If yes, it says Allow account. If no, it says Ask for parent permission. What does the decision diamond do?

  3. 3
    A sequence showing getting a bowl, pouring cereal, adding milk, and eating cereal.

    Put these algorithm steps in the correct order: A. Pour cereal into a bowl. B. Eat the cereal. C. Get a bowl. D. Add milk.

  4. 4

    Trace this algorithm: Set score = 0. Add 5 to score. Add 3 to score. If score > 6, subtract 2 from score. What is the final value of score?

  5. 5
    Common flowchart shapes including an oval, rectangle, and diamond.

    In a flowchart, what shape is usually used for Start and End, and what shape is usually used for a process step such as total = total + 1?

  6. 6
    A flowchart for deciding between even and odd outcomes.

    Write a short algorithm that decides whether a number is even or odd. Your algorithm should include an input step, a decision step, and an output step.

  7. 7
    A password decision flowchart branching to login or try again.

    A flowchart asks, Is the password correct? The yes path goes to Log in. The no path goes to Try again. What type of programming structure is this: sequence, selection, or repetition?

  8. 8
    A loop flowchart showing repeated output and a return arrow.

    Trace this loop: Set count = 1. While count <= 4, print count and then add 1 to count. What numbers are printed?

  9. 9
    A visual sequence of steps for brushing teeth.

    A student writes this algorithm for brushing teeth: 1. Put toothpaste on brush. 2. Wet toothbrush. 3. Get toothbrush. 4. Brush teeth. Explain what is wrong and how to fix it.

  10. 10
    A flowchart for deciding whether water is boiling based on temperature.

    Write the flowchart steps in words for this process: Start -> Input temperature -> If temperature >= 100 then Output Boiling, else Output Not boiling -> End.

  11. 11

    An algorithm has these steps: Set total = 0. For each number in 2, 4, 6, add the number to total. Output total. What does the algorithm output?

  12. 12
    A game character losing lives when hitting obstacles until no lives remain.

    Create a simple algorithm for a game character that has 3 lives. Each time the character hits an obstacle, it loses 1 life. The algorithm should repeat until lives = 0, then output Game over.

LivePhysics™.com CS - Grade 6-8

More CS Worksheets

See all CS worksheets

More Grade 6-8 Worksheets

See all Grade 6-8 worksheets