Multiple Choice
Which of the following would cause an ArrayIndexOutOfBounds error?
A) public boolean setElementOfX(int index, int val) {
if(index >= 0 && index < x.length) {
x[index] = val;
return true;
} else {
return false;
}
}
B) public static void main(Strin[] args) {
String inputFileName;
if (args.length > 0)
inputFileName = args[0];
else
inputFileName = "Phone.dat";
}
C) for (int i = 0; i
x[i] = i + i;
D) for (int i = 0; i <= x.length; i++)
x[i] = i * i;
Correct Answer:

Verified
Correct Answer:
Verified
Q20: The is-a relationship between classes means that
Q21: Which of the following methods of java.lang.Object
Q22: In UML class diagrams, the _ sign
Q23: Which of the following statements is correct?<br>A)
Q24: The class _ is the superclass of
Q26: A major reason for the popularity of
Q27: Which of the following statements is correct?<br>A)
Q28: The _ is thrown when a program
Q29: The _ represent error conditions that may
Q30: The combination of data together with its