6.5k views
4 votes
How many times would the code in this loop repeat? ____________ for ( j = 0; j < 10; j++ ) { appendItem (myList, aNumber); }

User Dfperry
by
4.5k points

1 Answer

1 vote

Answer:

The answer to this question is given below in the explanation section.

Step-by-step explanation:

The for-loop given in the question is:

for ( j = 0; j < 10; j++ )

{

appendItem (myList, aNumber); //this loop append a number to a list myList

}

This loop starts from J variable's value zero and when J's value is less than 10, the loop iterate through its body until J's value becomes greater or equal to 10. As J's value exceed nine, the loop will get terminated.

So this loop repeats 10 times its loop body, at the 11th time, the condition becomes false and the loop will get terminated.

User Munny
by
4.8k points