# Columbia University Ch 6 & 8 Computational Thinking Modern Problem Solver Text Questions

Assignment: Chapters 6 & 8 Questions

#### Introduction

Prepare written answers to, and be prepared to discuss each of the following questions, each of which is taken from, is an extension of, or is inspired by the correspondingly numbered exercise question from the Computational Thinking for the Modern Problem Solver text.

Chapter 6:

Question 2. Is this picture (i.e. diagram) an activity diagram or a state diagram? In addition, develop a Python source program (as a method) that is fully equivalent to what is expressed by this diagram. You can then use this program to test your answers to Question 3.

Question 3. What is the first value of X output when this algorithm executes? Also, what is the last value of X output when this algorithm executes?

Question 6. Consider the Python source program, given in the file Ch06Qu05.py, that is presented as being fully equivalent to the corresponding diagram.

Test both the diagram and the program with the following “use scenario”. Beginning is Inactive, the user then presses buttons in the following order: shutter button half pressed, shutter button fully pressed, play button pressed, shutter button half pressed. What is the resulting value of photoCount?

Create three additional distinct “use scenarios” and test both the diagram and the program with them, providing the resulting value of photoCount for each.

Finally, comment on whether or not you are confident that the given program is, in fact, fully equivalent to the diagram.

Question 8. Develop a Python source program, similar to the one given in the file Ch06Qu05.py, and to be named Ch06Qu09.py, that is equivalent to the corresponding diagram. The program you are to develop for this question should reuse some of the methods given.

Test both the diagram and the program with the following “use scenario”. Beginning in idle, travel 20 miles in the city, then travel 30 miles on the highway. How many gallons of gas are used?

Create three additional distinct “use scenarios” and test both the diagram and the program with them, providing the resulting value of gallonsUsed for each.

Finally, comment on whether or not you are confident that the program you developed is, in fact, fully equivalent to the diagram.

_____________________________________________________________________________________________________________