1Z0-851 | Pinpoint Java 1Z0-851 dumps


Q51. Given:

11. public class Commander {

12. public static void main(String[] args) {

13. String myProp = /* insert code here */

14. System.out.println(myProp);

15. }

16. }

and the command line:

java -Dprop.custom=gobstopper Commander Which two, placed on line 13, will produce the output

gobstopper? (Choose two.)

A. System.load("prop.custom");

B. System.getenv("prop.custom");

C. System.property("prop.custom");

D. System.getProperty("prop.custom");

E. System.getProperties().getProperty("prop.custom");

Answer: DE

Q52. Given the following directory structure: bigProject |--source | |--Utils.java | |--classes |-- And the following command line invocation: javac -d classes source/Utils.java Assume the current directory is bigProject, what is the result?

A. If the compile is successful, Utils.class is added to the source directory.

B. The compiler returns an invalid flag error.

C. If the compile is successful, Utils.class is added to the classes directory.

D. If the compile is successful, Utils.class is added to the bigProject directory.

Answer: C

Q53. Given:

11. public class Test {

12. public static void main(String [] args) {

13. int x = 5;

14. boolean b1 = true;

15. boolean b2 = false;

16.

17. if ((x == 4) && !b2 )

18. System.out.print("1 ");

19. System.out.print("2 ");

20. if ((b2 = true) && b1 )

21. System.out.print("3 ");

22. }

23. }

What is the result?

A. 2

B. 3

C. 1 2

D. 2 3

E. 1 2 3

F. Compilation fails.

G. An exception is thrown at runtime.

Answer: D

Q54. Given:

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. Exception

B. A,B,Exception

C. Compilation fails because of an error in line 20.

D. Compilation fails because of an error in line 14.

E. A NullPointerException is thrown at runtime.

Answer: D

Q55. Given:

3. interface Animal { void makeNoise(); }

4. class Horse implements Animal {

5. Long weight = 1200L;

6. public void makeNoise() { System.out.println("whinny"); }

7. }

8. public class Icelandic extends Horse {

9. public void makeNoise() { System.out.println("vinny"); }

10. public static void main(String[] args) {

11. Icelandic i1 = new Icelandic();

12. Icelandic i2 = new Icelandic();

13. Icelandic i3 = new Icelandic();

14. i3 = i1; i1 = i2; i2 = null; i3 = i1;

15. }

16. }

When line 15 is reached, how many objects are eligible for the garbage collector?

A. 0

B. 1

C. 2

D. 3

E. 4

F. 6

Answer: E

Q56. Given

11. public interface Status {

12. /* insert code here */ int MY_VALUE = 10;

13. }

Which three are valid on line 12? (Choose three.)

A. final

B. static

C. native

D. public

E. private

F. abstract

G. protected

Answer: ABD

Q57. Given:

12. String csv = "Sue,5,true,3";

13. Scanner scanner = new Scanner( csv );

14. scanner.useDelimiter(",");

15. int age = scanner.nextInt();

What is the result?

A. Compilation fails.

B. After line 15, the value of age is 5.

C. After line 15, the value of age is 3.

D. An exception is thrown at runtime.

Answer: D

Q58. Given:

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.

B. No output, and an Exception is thrown.

C. Compilation fails due to an error on line 14.

D. Compilation fails due to an error on line 16.

E. Compilation fails due to an error on line 17.

F. X, followed by an Exception, followed by B.

Answer: A

Q59. DRAG DROP

Click the Task button.

Answer:

Q60. Given:

31. // some code here

32. try {

33. // some code here

34. } catch (SomeException se) {

35. // some code here

36. } finally {

37. // some code here

38. }

Under which three circumstances will the code on line 37 be executed? (Choose three.)

A. The instance gets garbage collected.

B. The code on line 33 throws an exception.

C. The code on line 35 throws an exception.

D. The code on line 31 throws an exception.

E. The code on line 33 executes successfully.

Answer: BCE