Respuesta :

Answer:

(a) In line 3, 2 should be changed to 1

Explanation:

Given

The attached procedure to return true if numberList is in ascending order

Required

Which line(s) need to be changed

On line 3 of the program, we have:;

[tex]count \to 2[/tex]

On line 6, we have the following comparison:

[tex]numberList[count] <numberList[count-1][/tex]

Substitute 2 for count

[tex]numberList[2] <numberList[2-1][/tex]

[tex]numberList[2] <numberList[1][/tex]

The above implies that, the first comparison made by the program is to compare numberList elements at index 2 and index 1.

This means that, the first element (i.e. index 0) has been ommitted in the program.

Hence, for the program to work as intended, 2 should be changed to 1 on line 3

ACCESS MORE
EDU ACCESS