Oracle Java SE 8 Programmer I - 1z1-808 Exam Practice Test

Which two code fragments cause compilation errors? (Choose two.)
Correct Answer: B,D Vote an answer
You are developing a banking module.
You have developed a class named ccMask that has a maskcc method.
Given the code fragment:

You must ensure that the maskcc method returns a string that hides all digits of the credit card number except the four last digits (and the hyphens that separate each group of four digits).
Which two code fragments should you use at line n1, independently, to achieve this requirement?
Correct Answer: C,D Vote an answer
Given the code fragment:

What is the result?
Correct Answer: B Vote an answer
Given:
public class Test {
}
From which class does the Java compiler implicitly derive Test?
Correct Answer: C Vote an answer
Given the code fragment:

What is the result?
Correct Answer: A Vote an answer
Given the classes:
* AssertionError
* ArithmeticException
* ArrayIndexOutofBoundsException
* FileNotFoundException
* IllegalArgumentException
* IOError
* IOException
* NumberFormatException
* SQLException
Which option lists only those classes that belong to the unchecked exception category?
Correct Answer: E Vote an answer
Explanation: Only visible for PassTestking members. You can sign-up / login (it's free).
Which two initialization statements are valid? (Choose two.)
Correct Answer: B,D Vote an answer
Explanation: Only visible for PassTestking members. You can sign-up / login (it's free).
Given:

And given the code fragment:

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

What is the result?
Correct Answer: B Vote an answer
Given the following class:

And given the following main method, located in another class:

Which three lines, when inserted independently at line n1, cause the program to print a o balance?
Correct Answer: B,E,H Vote an answer
Explanation: Only visible for PassTestking members. You can sign-up / login (it's free).
Given the code fragment:

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 the following code:

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

What is the result?
Correct Answer: A Vote an answer
The following grid shows the state of a 2D array:

This grid is created with the following code:

Which line of code, when inserted in place of //line n1, adds an X into the grid so that the grid contains three consecutive X's?
Correct Answer: B Vote an answer
Given:
package p1;
public interface DoInterface {
void method1(int n1); // line n1
}
package p3;
import p1.DoInterface;
public class DoClass implements DoInterface {
public DoClass(int p1) { }
public void method1(int p1) { } // line n2
private void method2(int p1) { } // line n3
}
public class Test {
public static void main(String[] args) {
DoInterface doi= new DoClass(100); // line n4
doi.method1(100);
doi.method2(100);
}
}
Which change will enable the code to compile?
Correct Answer: C Vote an answer
Explanation: Only visible for PassTestking members. You can sign-up / login (it's free).