Exam 1 Review

Your first exam will include a written part that you will take in an ACC Testing Center using a “Locked Down Browser”. The exam will be on Blackboard, but not visible except in the Testing Centers. (Make sure you have your ACC ID when you go there!) The exam will be available for one week beginning on Wednesday, February 20. You need to complete the exam by Wednesday, February 25.

There will also be an open book Scratch problem for you to complete. That part will be posted on the class website when the exam is available. This lab project is also due on Wednesday, February 25.

Written Prepration

To get ready for the exam, be sure you have read these sections from the first part of your text (Starting Out with Programming Logic & Design):

  • Chapter 1: Introduction to Computers and Programming
  • Chapter 2: Input Processing, and Output
  • Chapter 3: Modules
  • Chapter 4: Decision Structures and Boolean Logic
  • Chapter 5: Repetition Structures
  • Appendix B: The ASCII Character Set

You should also review the lecture materials I have posted.

You do not need to memorize a bunch of detailed facts, just review the concepts we are covering. We are focusing on the tools and techniques we use to break real world problems down so we can solve them precisely, hopefully using a computer!

The review is in the form of a summary of the basic concepts we have studied, and how they fit together to build a solution. The topics in this review are not necessarily in the exact order they are presented in the book. I have organized them based on the phases of problem solving commonly referred to in the literature on this topic.


You will not be asked any questions about Scratch. We are using that tool to let you experience putting together simple solutions to a puzzle using constructs that are exactly like those we are studying. Sequences, Loops, and Decisions!

Basic Structures

We introduced three basic structures used in programming, and in human problem solving. You should know these well enough to discuss them. To show them on the exam, we will use pseudo-code which is mostly English sentences, but as short as you can make them!

I recommend using a notation like this:

    Step 1
    Step 2


    IF something is true THEN
        do something
        do something else


    WHILE (something is true LOOP
        do something


When you take the test, be careful not to hit the tab key at any time. Doing so will throw you off the current question and perhaps break your session. The Web Browsers used by the Testing Center are a bit quirky! If you want to indent something just use spaces to do the job! I will not be grading on style.

If you do break a test session, I will have to reset your attempt in Blackboard before you can try again, and that can take a while to get done. Please be careful!

Problem Solving

Our goal is to learn how to think through a problem in a clear, unambiguous way. Perhaps the solution to the problem will lead to a computer program. Perhaps not. What matters is how you train yourself to think clearly.

  • You are learning how to understand the problem well

  • You are studying that problem looking for things that help you break it down

  • You are always thinking about what could go wrong in any part of the solution

    • Look for places users can make mistakes

      • By accident
      • On purpose, trying to break your program! (They will do this, trust me!)
  • You are learning how to approach designing a solution:

Step 1: Define the problem

  • We always start with a Problem Statement

    • Written by human beings and full of ambiguity
    • Try to get as much detail as possible to avoid questions later
    • Ask the originator of this problem (your boss, or customer) for any additional details if possible.

Step 2: Analyze the Problem

  • Break down the problem statement

    • Identify key pieces of information

      • Input data

      • Output data

      • Required processing

        • How do we convert the input data into the output data?
  • Need to fill in details by asking questions

    • Eliminate any unknowns in the Problem Statement
    • Never assume things, ask the customer for details

Step 3: Design the Solution

  • Use Decomposition to carve off pieces of the task, creating smaller tasks

  • Compose your solution by combining the pieces in a sequence

    • Think about Input - Process - Output as a start
  • Use Basic Structures in thinking through the solution

    • Sequence

      • Do something Step by step
    • Decision

      • What you need to do depends on the data you have in hand
    • loop

      • You need to process a set of data items

        • While loop

          • Getting the loop started ( Preseeded Loops )
          • Stopping the loop ( Sentinel Values )
        • Counted Loop

          • Use a counter variable initialized to zero
          • Increment the counter inside the loop
          • Test the counter to see if you should stop the loop
    • Important characteristics of a structure

      • Single Input
      • Single Output
    • Using Pseudo-Code

      • Pick a few Key Words to identify the structure (IF, WHILE, etc)

      • Use simple, crisp English phrases to describe tasks to perform

        • Use names that make sense for variables (containers that hold your data)
      • Program Style

        • Indenting shows structure, and nested structure
  • Common Programming Patterns

    • Reading data from user

      • Prompts
      • Storing in variables with useful names
    • Generating output

    • Finding the sum of a set of numbers

      • Initialize an accumulator variable to zero (clear the calculator)

      • Loop over the items

        • Add the item to the accumulator variable
        • Stop when you reach the maximum item count, or a sentinel value
    • Processing a variable number of items

      • Identify a value for the data that is not likely to occur (Sentinel Value)
      • Loop until you see the Sentinel Value
    • Homing in on a solution (square root)

      • Guess the answer

      • determine if you are low or high

      • Pick a step size

      • Loop

        • Move toward the solution

        • Test to see if you stepped past solution

        • if so then

          • Reverse direction

          • Decrease step size

            • Stop if the step is small enough (you are close enough to the answer)
        • end loop

    • Doing Math

      • Arithmetic expressions - produce a numerical value

      • Logical expressions - produce a true/false value

      • Remember the two different ways computers do calculations:

        • If both numbers are integers (no decimal point) the result will not have a fraction. It is simply chopped off!
        • If either number )or both) is a floating point number (contains a decimap point), the calculation is dome in floating point, and fractions will be generated
        • 1/2 is NOT 0.5, it is zero! Know why!

Step 4: Building the Program

  • Set up Data containers

    • Places to store information

      • Variable Names should help in understanding solution
    • Identify innput data from the user

    • Determine output data needed to display to the user

    • Internal data, needed during processing (temporary variables)

  • Take Baby Steps

    • Work by making small changes to your scheme
    • Test them (in your head if needed) to see that they work
    • Fix errors
    • Repeat until done
  • Deploy your solution

  • Don’t Repeat yourself

    • If you see the same chunk of code twice, think about how to eliminate this

      • Use a loop
      • Later, we will build a module
    • Why is this important

Final Steps

There are more steps in the process, but we have not covered them yet!

Common Mistakes

It is common for beginners in a class like this to have problems thinking through a problem. Humans leap around trying out ideas in their head until they get something to work, then probably have trouble writing down what they did. To get past this, replay the problem and your solution, this time writing down what you did. You have to visualize yourself finding that solution again, leaving out the stuff that went through your head and got you nowhere!

The real problem is writing down exactly what needs to be done, and not leaving things for the human to fill in. Even something like our square root problem might have a simple statement like this:

When you step over the solution, reverse direction.

How do you do that?

Well, you are probably doing something over and over (that is a loop), and you are adding a small number to a guessed value trying to find a number that is the answer. Each time you add something, your guess gets bigger. When you see that your guess is too big, adding more will not work. We need to subtract something to get smaller. That is “reversing direction” and we now know how to do it.

By the way, when you do this, you need to change the number you added to something smaller, or you will zoom past the answer in the opposite direction, realize you are too small, switch directions again, and go past the solution yet another time! Ugh! If you make the number smaller each time you change direction (cutting it in half is a good approach), eventually you will home in on the solution.

Think this through by visualizing yourself driving your car and needing to stop right on a line on the road. You might overshoot, backup and miss it, then go forward. Eventually you will hit the mark, close enough for you to stop. We need to teach the machine to do the same thing.

If you are faced with a problem on the exam, first think it through as a human. How would you do this task in real life. Then think about explaining it precisely enough that some clueless space alien (who at least understands English!)

Rely on your experience getting through life up to this point. You can solve problems, you just have not tried to explain your solutions as precisely as we need to if we are ever going to get this beast called a computer to do our work for us!

More Review

In looking through my materials, I stumbled on this website. You should read through this and make sure you agree with the answers. It will help make sure you are ready for our first exam!