Do the following two statements in (I) and (II) result in the same value in sum?

```
(I):
for (int i = 0; i < 10; ++i) {
sum += i;
}
(II):
for (int i = 0; i < 10; i++) {
sum += i;
}
```
a. Yes
b. No

a. Yes
In this case, ++i and i++ are used standalone with no side-effect. So, (I) and (II) are equivalent. The correct answer is A.

Computer Science & Information Technology

You might also like to view...

A small text file that contains your personal information, such as preferences, that is put on your computer by a Web site is called a(n):

A) script B) cookie C) thread D) post

Computer Science & Information Technology

What do you see if you cout the name of an array?

What will be an ideal response?

Computer Science & Information Technology