`RPG445 Practice Questions Page 1 of 3

(6) Walk through the following code and note the fields' final values
On the right, show the details of the iterations for part marks.

C* Factor1 OpCode Extended-factor2
C EVAL Evens = *ZERO

C EVAL Total = *ZERO

C EVAL Counter = *ZERO

C FOR Evens TO 11 BY 2

C EVAL Total = Total + Evens

C EVAL Counter = Counter + 1

C endfor

Evens = ____, Counter = ____, Total = ____

( 5) Rewrite this function using another non-DO looping structure

C* Factor1 OpCode Extended-factor2
C EVAL i = s

C DOW i <= n

C* ...

C EVAL i = i + x

C enddo
C ______
C ______
C ______
C ______
C ______

(1) If s is 1, n is 10, and x is 1, then the loop exit value of i = ____

C* Factor1 OpCode Extended-factor2

C EVAL SpeedOverLimit = Speed - Limit C READ TICKETS

(6) Rewrite the following without using the IF operation and so that all records in the Tickets file are read and processed to accumulate the total fines. (Note: the above two lines are part of the code but do not have to be rewritten.)

C IF %EOF

C ELSE

C IF SpeedOverLimit >= 50

C EVAL TotalFines += 300.00

C ELSE

C IF SpeedOverLimit >= 25

C EVAL TotalFines += 150.00

C ELSE

C IF SpeedOverLimit > 5

C EVAL TotalFines += 50.00

C ELSE

C EVAL TotalFines += 0

C endif

C endif

C endif

C READ TICKETS

C endif

Only 11 lines of code are required. Please answer on the next page.
C ______
C ______
C ______
C ______
C ______
C ______
C ______
C ______
C ______
C ______
C ______

(2) Given the following table of TICKETS file data, the structure's exit value of TotalFines is _____

TICKETS file
SPEED / LIMIT
75 / 50
160 / 100
45 / 40
70 / 60

2018/10/02originally given Fall, 2000Page 1 of 3