Multiple Choice
Is there any thing wrong with the following code snippet? String[] data = { "abc", "def", "ghi", "jkl" };
String searchedValue = "ghi";
Int pos = 0;
Boolean found = false;
While (pos < data.length)
{
If (data[pos].equals(searchedValue) )
{
Found = true;
}
Else
{
Found = false;
}
Pos++;
}
If (found)
{
System.out.println("Found at position: " + pos) ;
}
Else
{
System.out.println("Not found") ;
}
A) There is nothing wrong.
B) There is compile-time error.
C) There is a bounds error.
D) There is a logic error.
Correct Answer:

Verified
Correct Answer:
Verified
Q6: When an integer literal is added to
Q42: Consider the following code snippet:<br>String[] data =
Q85: Which one of the following statements about
Q98: Assume the following variable has been declared
Q99: Select the statement that reveals the logic
Q100: Which statement is true about the code
Q101: Which one of the following statements is
Q102: Which one of the following is the
Q105: What is the valid range of index
Q107: What is the output of the following