Assessment Tool

Lecture 9: Iteration (tool to give prior to lecture)

Content Tested:  Looping construct

Lecture Content:

Goals:

Assessment Technique:  Two Column Task Organizer

Purpose:

To engage students in a problem solving activity in which they discover the need for iteration to solve a problem.  Hopefully, they will figure out the motivation for using loops on their own.
 

Activity:



Given the following task, describe concepts that you know that will help you complete the task.  In the second column, describe concepts that you will need to solve the problem.  The items in the second column may be concepts we have not yet covered in lecture.

Task:  Write a C function to print a box of stars with dimensions width by height.  If width or height is less than 1, do not print any stars.  For example, a call to PrintBox(5,3) would result in the following printout:
*****
*****
*****

Remember, you do not need to write the syntax of the function.  You are to complete the chart below.
 
What you know What you need to find out

 
 
 
 
 
 
 
 
 
 
 

 

 

 
 
 
 
 
 
 
 


Possible Solution:

 
What you know What you need to find out
C syntax for a writing a function Need to find out how to print width number of stars
Printing a single star  Need to find out how to print height number of rows of stars
Conditional to check if width or height is less than 1 Need some sort of counter to know how many stars have been printed
Writing a function that has two parameters Need a looping construct to keep track of a counter

Possible Uses of Activity: