CSE 131 Module 2: Choice & Iteration

Exercises

These exercises are part of the asynchronous component of this course. Material is taught and demonstrated, but at times you are asked to complete one of the exercises to help you master the new concepts.

In the repository you are using for this course, look inside the exercises source folder, and you will see assignments organized by name. Before continuing on to the next portion of the asynchronous material, spend some time on the exercise. When you are finished, commit your code so that credit for the exercise can be given.

It is not so important that you get the exercise exactly right. It is important to work through it as best you can before you look at the solution or continue with other work in this module.


Before starting this exercise:
Be sure to update your repository before beginning this assignment, so that you receive any code you need.

N runs of the 10 heads problem

Instructions

This is the second of three exercises in which you take the program developed in the round table video and modify it to compute more interesting results.
After completing this exercise:
Commit any files you have changed so that you receive credit for your work!

Before starting this exercise:
Be sure to update your repository before beginning this assignment, so that you receive any code you need.

Average number of flips to get 10 heads

Instructions

This is the last of three exercises in which you take the program developed in the round table video and modify it to compute more interesting results.
After completing this exercise:
Commit any files you have changed so that you receive credit for your work!

Before starting this exercise:
Be sure to update your repository before beginning this assignment, so that you receive any code you need.

Computing the maximum of two inputs

Instructions

After completing this exercise:
Commit any files you have changed so that you receive credit for your work!

Before starting this exercise:
Be sure to update your repository before beginning this assignment, so that you receive any code you need.

A bad swap

Instructions

After completing this exercise:
Commit any files you have changed so that you receive credit for your work!

Before starting this exercise:
Be sure to update your repository before beginning this assignment, so that you receive any code you need.

Heads or tails?

Instructions

After completing this exercise:
Commit any files you have changed so that you receive credit for your work!

Before starting this exercise:
Be sure to update your repository before beginning this assignment, so that you receive any code you need.

Convert inches to feet

Instructions

After completing this exercise:
Commit any files you have changed so that you receive credit for your work!

Before starting this exercise:
Be sure to update your repository before beginning this assignment, so that you receive any code you need.

Careful division

Instructions

After completing this exercise:
Commit any files you have changed so that you receive credit for your work!

Before starting this exercise:
Be sure to update your repository before beginning this assignment, so that you receive any code you need.

Die

Instructions

After completing this exercise:
Commit any files you have changed so that you receive credit for your work!

Before starting this exercise:
Be sure to update your repository before beginning this assignment, so that you receive any code you need.

Average of some random double values

Instructions

After completing this exercise:
Commit any files you have changed so that you receive credit for your work!

Before starting this exercise:
Be sure to update your repository before beginning this assignment, so that you receive any code you need.

Exercises writing some loops

Instructions

After completing this exercise:
Commit any files you have changed so that you receive credit for your work!

Before starting this exercise:
Be sure to update your repository before beginning this assignment, so that you receive any code you need.

100 runs of the 10 heads problem

Instructions

This is the first of three exercises in which you take the program developed in the round table video and modify it to compute more interesting results.
After completing this exercise:
Commit any files you have changed so that you receive credit for your work!