Find the error in each of the following. [Note: There may be more than one error.]

a) For ( x = 100, x >= 1, x++ )
document.writeln( x );
b) The following code should print whether integer value is odd or even:
```
switch ( value % 2 ) {
case 0:
document.writeln( "Even integer" );
case 1:
document.writeln( "Odd integer" );
}
```

c) The following code should output the odd integers from 19 to 1:
```
for ( x = 19; x >= 1; x += 2 )
document.writeln( x );
```

d) The following code should output the even integers from 2 to 100:
```
do {
document.writeln( counter );
counter += 2;
} While ( counter < 100 );
```


a) 1. The F in For should be lowercase.
2. Semicolons should be used in the for header instead of commas.
3. ++ should be --.
b) A break statement should be placed in case 0.
c) += should be -=.
d) 1. The W in While should be lowercase.
2. < should be <=.

Computer Science & Information Technology

You might also like to view...

Case-Based Critical Thinking QuestionsCase 3-2Maureen's brother Paul has also been researching cruise ships online and has created his own presentation. Maureen and Paul decide to work together to create a great presentation to show the rest of the family. At one point, Paul has a number of presentations open and he wants to overlap all the windows on top of one another. To do this with all the presentations open, he clicks the ____ button in the Window group.

A. Arrange All B. Display All C. Cascade Windows D. Show All

Computer Science & Information Technology

Each encoding method is known as a codec-short for coder/decoder. _________________________

Answer the following statement true (T) or false (F)

Computer Science & Information Technology

Discuss how the Validation Rule field property helps to control data entry and why that is important.

What will be an ideal response?

Computer Science & Information Technology

When exporting a PDF, if you check the View After Exporting check box, the document opens in a web page after it is exported.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology