9.3k views
2 votes
Which of the following statements will not execute a DO loop?

a. do i=8, 10, 4, 14;
b. do i=.30 to .20 by -.1;
c. do i=(x+10) to x;
d. do i=-1 to -3 by -1;

User Kazuya
by
7.5k points

1 Answer

4 votes

Final answer:

The DO loop statement that will not execute is a. do i=8, 10, 4, 14; because it has an incorrect syntax with four parameters instead of the required two or three for a standard DO loop.

Step-by-step explanation:

The statement that will not execute a DO loop is: a. do i=8, 10, 4, 14;. This is because the syntax of the DO loop is incorrect. In most programming languages, a DO loop (also known as a FOR loop) has a starting value, an end value, and an optional step increment, but it does not support four parameters as shown in the statement.

Correct syntax examples for DO loops:

  • do i=1 to 10: This loop will start at 1 and end at 10, incrementing by 1.
  • d. do i=-1 to -3 by -1: This loop will start at -1 and end at -3, decrementing by 1.

Syntax such as b. do i=.30 to .20 by -.1 and c. do i=(x+10) to x are also potentially valid. However, part a's syntax does not match standard loop constructs, making it the one that would not execute.

User KTastrophy
by
8.3k points

No related questions found