Given:
11.
public static void test(String str) {
12.
int check = 4;
13.
if (check = str.length()) {
14.
System.out.print(str.charAt(check -= 1) +", ");
15.
} else {
16.
System.out.print(str.charAt(0) + ", ");
17.
}
18.
} and the invocation:
21.
test("four");
22.
test("tee");
23.
test("to");
What is the result?
A. r, t, t,A company that makes Computer Assisted Design (CAD) software has, within its application, some utility classes that are used to perform 3D rendering tasks. The company's chief scientist has just improved the performance of one of the utility classes' key rendering algorithms, and has assigned a programmer to replace the old algorithm with the new algorithm. When the programmer begins researching the utility classes, she is happy to discover that the algorithm to be replaced exists in only one class. The programmer reviews that class's API, and replaces the old algorithm with the new algorithm, being careful that her changes adhere strictly to the class's API. Once testing has begun, the programmer discovers that other classes that use the class she changed are no longer working properly. What design flaw is most likely the cause of these new bugs?
A. InheritanceGiven:
11.
class A {
12.
public void process() { System.out.print("A,"); }
13.
class B extends A {
14.
public void process() throws IOException {
15.
super.process();
16.
System.out.print("B,");
17.
throw new IOException();
18.
}
19.
public static void main(String[] args) {
20.
try { new B().process(); }
21.
catch (IOException e) { System.out.println("Exception"); }
22.
}
What is the result?
A. ExceptionGiven:
1.
public class TestSeven extends Thread {
2.
private static int x;
3.
public synchronized void doThings() {
4.
int current = x;
5.
current++;
6.
x = current;
7.
}
8.
public void run() {
9.
doThings();
10.
} 11.}
Which statement is true?
A. Compilation fails.Given:
21.
abstract class C1 {
22.
public C1() { System.out.print(1); }
23.
}
24.
class C2 extends C1 {
25.
public C2() { System.out.print(2); }
26.
}
27.
class C3 extends C2 {
28.
public C3() { System.out.println(3); }
29.
}
30.
public class Ctest {
31.
public static void main(String[] a) { new C3(); }
32.
}
What is the result?
A. 3Which two code fragments will execute the method doStuff() in a separate thread? (Choose two.)
A. new Thread() { public void run() { doStuff(); } };Given:
12.
public class Test {
13.
public enum Dogs {collie, harrier};
14.
public static void main(String [] args) {
15.
Dogs myDog = Dogs.collie;
16.
switch (myDog) {
17.
case collie:
18.
System.out.print("collie ");
19.
case harrier:
20.
System.out.print("harrier ");
21.
}
22.
}
23.
}
What is the result?
A. collieGiven:
11. class X { public void foo() { System.out.print("X "); } } 12.
13.
public class SubB extends X {
14.
public void foo() throws RuntimeException {
15.
super.foo();
16.
if (true) throw new RuntimeException();
17.
System.out.print("B ");
18.
}
19.
public static void main(String[] args) {
20.
new SubB().foo();
21.
}
22.
}
What is the result?
A. X, followed by an Exception.Given:
1.
public class BuildStuff {
2.
public static void main(String[] args) {
3.
Boolean test = new Boolean(true);
4.
Integer x = 343;
5.
Integer y = new BuildStuff().go(test, x);
6.
System.out.println(y);
7.
}
8.
int go(Boolean b, int i) {
9.
if(b) return (i/7);
10.
return (i/49);
11.
}
12.
}
What is the result?
A. 7Click the Exhibit button. Which three code fragments, added individually at line 29, produce the output 100? (Choose three.)

Nowadays, the certification exams become more and more important and required by more and more enterprises when applying for a job. But how to prepare for the exam effectively? How to prepare for the exam in a short time with less efforts? How to get a ideal result and how to find the most reliable resources? Here on Vcedump.com, you will find all the answers. Vcedump.com provide not only Oracle exam questions, answers and explanations but also complete assistance on your exam preparation and certification application. If you are confused on your 1Z0-851 exam preparations and Oracle certification application, do not hesitate to visit our Vcedump.com to find your solutions here.