Field Reports tell how instructors have used AVs in their teaching.

CS1 activity on 1D arrays and FOR loops

No replies
White BeltYellow BeltGreen Belt
Joined: 2009-08-14
Points: 20
David Furcy
University of Wisconsin - Oshkosh
CS221: Object-Oriented Design and Programming I

Students are actively engaged while practicing 1D array traversals using FOR loops. This activity takes place during the second half of a CS1 course focused on OOD&P and uses JHAVE (after web starting JHAVE, enter cs221 in the category text field). I only spend 5 minutes in class demonstrating how to access and run the AV. Then, I encourage students to use it for practice out of class as often as they wish until they feel comfortable with the concepts of looping and array indexing. I motivate students by letting them know that one of their weekly quizzes and up to 20% of the next exam will consist of questions taken (literally: I use screen shots) from this AV. Due to randomization, the best way for students to do well on the graded exercises is to spend time practicing with the AV. Each time it is executed, this AV randomly generates a Java program fragment containing an array declaration/instantiation/initialization statement and a FOR loop. Variable names, array length, initial array contents (numerical), loop initialization, loop condition, loop increment, and the loop body are all randomized. The latter may contain a single assignment statement, an IF/THEN statement, or an IF/THEN/ELSE statement. Each IF statement contains one or two assignment statements with one or more array-indexed expressions combined with arithmetic operations. As is typical with JHAVE-based AVs, the randomized code fragment is displayed on numbered lines in the right half of the screen. Execution proceeds line by line with highlighting, while the left half of the screen depicts the contents of the array. Students can go forward and backward through the visualization. Random questions pop up to keep students actively engaged. Their answers are (optionally) recorded in a back-end database for automated assessment purposes.