CPS 1 (Ramm) Spring 1995 8 March 1995 Quiz #7 Name _______________________ Section _____ A. Do a trace for the program shown below left using the column headings shown below right. Assume that the user enters 13, then 9, and then 21 when input is requested. # AX X Y Z 0 in ax 1 copy x, ax 2 in ax 3 copy y, ax 4 copy ax, x 5 add ax, y 6 copy z, ax 7 in ax 8 copy x, ax 9 copy ax, z 10 add ax, x 11 copy z, ax 12 copy ax, z 13 out ax B. On the back of this sheet, write a procedure called Negatives which both adds together AND COUNTS all of the negative elements (of those elements in use) for an integer array and sets the next to last parameter to that count and the last parameter to that sum. Assume you have declarations such as type intara=array[1..100] of integer; var data: intara; size, negcnt, negtot: integer; Then invoking your procedure with size := 85; Negatives(data, size, negcnt, negtot); writeln('Sum of the ', negcnt, ' negative elements is ', negtot); should print out the count and sum of the negative elements among the first 85 elements of the array data. Make the order of your parameters match this example. JUST WRITE THE PROCEDURE, NOT THE MAIN PROGRAM.