Choosing how to earn college credit? CLEP vs AP guide
| preferred AP College board partner for AP classes
easy Solved by 11 students

String Iteration Character Count

Mark
< Prev
Next >

What is the value of the variable result after the following code segment is executed?

String word = "COMPUTER";
int result = 0;
for (int i = 0; i < word.length(); i++) {
    if (word.substring(i, i + 1).equals("E") || 
        word.substring(i, i + 1).equals("U")) {
        result++;
    }
}
A

2

B

1

C

0

D

3

Hint
Did You Know?
Explain Why
Explain All Answers
Check Answer
Show Correct Answer
Report Question

Question Leaderboard

Rank
User
Correct Count
Attempt Count
Total Time
Score
#1busemagngr22 0m 59s 141
#2sgarv251311 - 100
#3hitrishabhatia12 - 90
#4Pelisx11 0m 21s 79
#5171662811 0m 22s 78
#6y.seong202712 1m 50s -20
#7yuvansankarnyc11 2m 22s -42
#8midnightasdark01 1m 06s -76
#9suhanakochhar00611 2m 58s -78
#10bommasam00011 56m 15s -3,275
Items per page:
10
1 – 10 of 10
No comments yet. Be the first to comment!

AI Tutor

How can I help?

APFIVE © 2020.
Email: apfive@apfive.org|Instagram: @_apfive_|Privacy Policy|