What is the output of the following code?

```

int x = 0;
while (x < 4) {
x = x + 1;
}
System.out.println("x is " + x);
```

a. x is 0
b. x is 1
c. x is 2
d. x is 3
e. x is 4


e. x is 4
x is 0 before the loop. The loop is executed 4 times for x from 0 to 3. When x is 4 the loop exits. So, the correct answer is E.

Computer Science & Information Technology

You might also like to view...

MC A module function is called by preceding the function name with the module name followed by the______symbol.

a) .. b) ->. c) :. d) ( ).

Computer Science & Information Technology

___________ affects the sequence of bytes in State but does not alter byte contents and does not depend on byte contents to perform its transformation.

Fill in the blank(s) with the appropriate word(s).

Computer Science & Information Technology

A transparent bridge creates the internal port table by using a form of ____.?

A. ?forward learning B. ?backward correction C. ?backward learning D. ?forward correction

Computer Science & Information Technology

What class do you use if you have a group of user settings and you want to create a simple way in which the user can edit them?

a. The PreferenceEdit class b. The PreferenceActivity class c. The PreferenceAccess class d. The PreferenceIntent class

Computer Science & Information Technology