Oracle Java SE 7 Programmer I - 1Z1-803 Exam Practice Test

Given the code fragment:

What is the result?
Correct Answer: E Vote an answer
Given:

What is the result?
Correct Answer: E Vote an answer
Explanation: Only visible for PassTestking members. You can sign-up / login (it's free).
Given:
class MarksOutOfBoundsException extends IndexOutOfBoundsException { }
public class GradingProcess {
void verify(int marks) throws IndexOutOfBoundsException {
if (marks > 100) {
throw new MarksOutOfBoundsException();
}
if (marks > 50) {
System.out.print("Pass");
} else {
System.out.print("Fail");
}
}
public static void main(String[] args) {
int marks = Integer.parseInt(args[2]);
try {
new GradingProcess().verify(marks));
} catch(Exception e) {
System.out.print(e.getClass());
}
}
}
And the command line invocation:
Java grading process 89 50 104
What is the result?
Correct Answer: E Vote an answer
Explanation: Only visible for PassTestking members. You can sign-up / login (it's free).
A method doSomething () that has no exception handling code is modified to trail a method that throws a checked exception. Which two modifications, made independently, will allow the program to compile?
Correct Answer: B,D Vote an answer
Explanation: Only visible for PassTestking members. You can sign-up / login (it's free).
Given:
public class TestLoop1 { public static void main(String[] args) { int a = 0, z=10; while (a < z) { a++;
--z;
}
System.out.print(a + " : " + z);
}
}
What is the result?
Correct Answer: C Vote an answer
Explanation: Only visible for PassTestking members. You can sign-up / login (it's free).
Given: What is the result?
Correct Answer: A Vote an answer
Given the code fragment:

What is the result?
Correct Answer: A Vote an answer
Explanation: Only visible for PassTestking members. You can sign-up / login (it's free).
Given: What is the result?
Correct Answer: B Vote an answer
Which three statements are benefits of encapsulation?
Correct Answer: B,D,F Vote an answer
Given:
public class Test {
public static void main(String[] args) {
try {
String[] arr =new String[4];
arr[1] = "Unix";
arr[2] = "Linux";
arr[3] = "Solarios";
for (String var : arr) {
System.out.print(var + " ");
}
} catch(Exception e) {
System.out.print (e.getClass());
}
}
}
What is the result?
Correct Answer: D Vote an answer
Explanation: Only visible for PassTestking members. You can sign-up / login (it's free).
Given:
Correct Answer: C Vote an answer