How many times does the following loop execute?
Int upperCaseLetters = 0;
String str = "abcdefgHIJKL";
Boolean found = false;
For (int i = str.length() - 1; i >= 0 && !found; i--)
{
Char ch = str.charAt(i) ;
If (Character.isUpperCase(ch) )
{
UpperCaseLetters++;
}
Else
{
Found = false;
}
}
A) 6 times
B) 8 times
C) 9 times
D) 12 times
Correct Answer:
Verified
Q21: What is the output of the code
Q28: Select the statement that correctly completes the
Q45: Which statement about this code snippet is
Q71: How many times does the following loop
Q87: Is the following code snippet legal?
Boolean b
Q88: What will be the output of the
Q89: Is the code snippet written below legal?
String
Q93: What will be the output of the
Q95: What is the last output line of
Q98: What is the output of this code
Unlock this Answer For Free Now!
View this answer and more for free by performing one of the following actions
Scan the QR code to install the App and get 2 free unlocks
Unlock quizzes for free by uploading documents