Are you taking CLEP classes? Try clep.ai
| preferred AP College board partner for AP classes
easy Solved by 7 students

String Iteration Character Count

< 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
Mark for review

Question Leaderboard

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

AI Tutor

How can I help?

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