ALEX Classroom Resource

  

Computer Science Principles Unit 5 Chapter 2 Lesson 12: Loops and Simulations

  Classroom Resource Information  

Title:

Computer Science Principles Unit 5 Chapter 2 Lesson 12: Loops and Simulations

URL:

https://curriculum.code.org/csp-18/unit5/12/

Content Source:

Code.org
Type: Lesson/Unit Plan

Overview:

In this lesson, students gain more practice using while loops as they develop a simulation that repeatedly flips coins until certain conditions are met. The lesson begins with an unplugged activity in which students flip a coin until they get five heads in total, and then again until they get three heads in a row. They will then compete to predict the highest outcome in the class for each statistic. This activity motivates the programming component of the lesson in which students develop a program that allows them to simulate this experiment for higher numbers of heads and longer streaks.

Students will be able to:
- use a while loop in a program to repeatedly call a block of code.
- use variables, iteration, and conditional logic within a loop to record the results of a repeated process.
- identify instances where a simulation might be useful to learn more about real-world phenomena.
- develop a simulation of a simple real-world phenomenon.

Note: You will need to create a free account on code.org before you can view this resource.

Content Standard(s):
Digital Literacy and Computer Science
DLIT (2018)
Grade: 9-12
9) Demonstrate the ability to verify the correctness of a program.

a. Develop and use a series of test cases to verify that a program performs according to its design specifications.

b. Collaborate in a code review process to identify correctness, efficiency, scalability and readability of program code.

Insight Unpacked Content
Evidence Of Student Attainment:
Students will:
  • apply the problem
  • solving process to a program to verify the correctness of the program.
a.
  • develop test cases to verify the performance of a program.
  • apply test cases to verify the performance of a program.
b.
  • identify correctness of program code while collaborating in a code review process.
  • identify efficiency of program code while collaborating in a code review process.
  • identify scalability of program code while collaborating in a code review process.
  • identify readability of program code while collaborating in a code review process.
Teacher Vocabulary:
  • compile
  • program
  • syntax
Knowledge:
Students know:
  • proper syntax and formatting for a coding language.
  • how to identify coding errors in a programming language.
a.
  • programs must be tested to verify that the desired task is executed properly.
  • testing a program requires a scenario where you can easily verify that the result of the program is correct/accurate.
b.
  • a program can contain one of the following properties, but not be an appropriate program: correctness, efficiency, scalability and readability
  • it is important to have others review your code.
  • that to be a quality program, code must be correct, efficient, scalable and readable.
Skills:
Students are able to:
  • analyze code for proper syntax and formatting.
a.
  • create a test case with verifiable results.
  • execute a program with the created test case to verify program performance.
  • locate errors in programming by executing test cases.
b.
  • work with others to review their code for correctness, efficiency, scalability and readability.
Understanding:
Students understand that:
  • programming languages each have their own required formatting which must be adhered to for a program to run correctly.
  • errors in programming languages prevent the program from executing its task.
  • each language has its own syntax and method for identifying potential errors.
a.
  • code can be formatted correctly and a program can still produce unintended results.
  • a test case is vital to verifying that a program is executing a task as intended.
b.
  • to be a quality program, code must be correct, efficient, scalable and readable.
  • it is important to have others proofread your code.
Digital Literacy and Computer Science
DLIT (2018)
Grade: 9-12
10) Resolve or debug errors encountered during testing using iterative design process.

Examples: Test for infinite loops, check for bad input, check edge-cases.

Insight Unpacked Content
Evidence Of Student Attainment:
Students will:
  • troubleshoot errors encountered during testing using an iterative design process.
  • resolve or debug errors encountered during testing using an iterative design process.
Teacher Vocabulary:
  • debug
Knowledge:
Students know:
  • steps of the problem solving process.
  • how to identify errors in an iterative design process.
Skills:
Students are able to:
  • review a process and identify errors in procedure.
  • rectify errors found in a process.
  • test resolution to verify that the process now runs as intended.
Understanding:
Students understand that:
  • errors in a process can prevent a solution.
  • resolving an error will allow the process to function as intended.
Digital Literacy and Computer Science
DLIT (2018)
Grade: 9-12
37) Evaluate the ability of models and simulations to test and support the refinement of hypotheses.

a. Create and utilize models and simulations to help formulate, test, and refine a hypothesis.

b. Form a model of a hypothesis, testing the hypothesis by the collection and analysis of data generated by simulations.

Examples: Science lab, robotics lab, manufacturing, space exploration.

c. Explore situations where a flawed model provided an incorrect answer.

Insight Unpacked Content
Evidence Of Student Attainment:
Students will:
  • evaluate how models and simulations can be used to examine theories and test and support the refinement of hypotheses.
  • explain how predictions and inferences are affected by large and complex data sets, quality of inputs, and software and hardware used.
a.
  • create a model or simulation to formulate, test, and refine a hypothesis.
  • utilize a model or simulation to formulate, test, and refine a hypothesis.
b.
  • form a model of a hypothesis.
  • test a hypothesis by the collection and analysis of data generated by simulations.
c.
  • be given a flawed model and explore reasons that the outcomes are not as expected or intended.
Teacher Vocabulary:
  • model
  • simulations
  • hypotheses
  • phenomena
  • target system
Knowledge:
Students know:
  • how to explain the use of models and simulations to generate new knowledge and understanding related to the phenomena or target system that is being studied.
  • how to explain the ability of models and simulations to test and support the refinement of hypotheses related to phenomena under consideration.
a.
  • that modeling and simulations are way to extrapolate and interpolate unrest situation and scenarios to help formulate, test and refine hypotheses.
b.
  • how to form a hypothesis.
  • how to test a hypothesis.
  • how to create a model or simulation.
c.
  • that simulations or models can be created to test a hypothesis but not provide the information expected or intended.
  • that it is vital to verify the data being generated by a model or simulation.
Skills:
Students are able to:
  • use a diagram or program to represent a model to express key properties of a phenomena or target system.
  • research existing models and simulations and how they are used to test and refine hypotheses.
  • explain how existing models and simulations are used to test and support the refinement of hypotheses.
a.
  • create a model or simulation to formulate, test, and refine a hypothesis.
  • utilize a model or simulation to formulate, test, and refine a hypothesis.
b.
  • form a model of a hypothesis.
  • test the hypothesis by collecting and analyzing data from a simulation.
c.
  • examine a model or simulation to determine the correctness of the generated data.
  • examine a flawed model or simulation and identify areas in which it is providing incorrect data.
Understanding:
Students understand that:
  • a simulation is based on a model and enables observation of the system as key properties change.
  • the accuracy of models and simulations are limited by the level of detail and quality of information used and the software and hardware used.
  • models and simulations are an effective and cost efficient way to understand phenomena and test and refine hypotheses.
a.
  • models and simulations are way to extrapolate and interpolate unrest situation and scenarios to help formulate, test and refine hypotheses.
  • models and simulations can be the only cost- ot time-effective way to test a hypothesis.
b.
  • Models and simulations can save money, are safer, usually requires less time, and do not have the environmental impact that a full experiment or operational test may induce.
c.
  • while a process may operate without errors, that does not guarantee that the process is providing accurate data to meet your needs.
Tags: app lab, coin flip, conditionals, iteration, loop, models, simulation, unplugged, variables, while loops
License Type: Custom Permission Type
See Terms: https://code.org/tos
For full descriptions of license types and a guide to usage, visit :
https://creativecommons.org/licenses
Accessibility
Comments
  This resource provided by:  
Author: Aimee Bates