CS 1401, Quiz 10

Date: Tuesday, April 1, 2008
Name (please type legibly, ideally in block letters): ______________________________________________________________________

Today is April Fool's day. To celebrate this day, a CS student tries playing practical jokes on his friends, TAs, and professors. Some realize that something is wrong, others fall for the jokes. Since this student is from CS, he keeps the results of his jokes in an array succeeded:

1. Write a piece of code that, given this array, computes the number of jokes that succeeded.

2. To check the correctness of the code you wrote in Problem 1, write a piece of code that defines a new array succeeded consisting of 3 elements of type boolean and assigns, to elements of this array, values true, false, and true. Trace step-by-step how the piece of code you wrote in Problem 1 will perform on this array.