Proper study guides for Improved Oracle Java Standard Edition 6 Programmer Certified Professional Exam certified begins with Oracle 1Z0-851 preparation products which designed to deliver the Validated 1Z0-851 questions by making you pass the 1Z0-851 test at your first time. Try the free 1Z0-851 demo right now.

2021 Aug 1z0-851 mock:

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


Q162. DRAG DROP


Answer:


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


Q164. Click the Exhibit button. Which three code fragments, added individually at line 29, produce the output 100? (Choose three.)


A. n = 100;

B. i.setX( 100 );

C. o.getY().setX( 100 );

D. i = new Inner(); i.setX( 100 );

E. o.setY( i ); i = new Inner(); i.setX( 100 );

F. i = new Inner(); i.setX( 100 ); o.setY( i );

Answer: BCF


Q165. Given:

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

12. for (int i = 0; i <= 10; i++) {

13. if (i > 6) break;

14. }

15. System.out.println(i);

16. }

What is the result?

A. 6

B. 7

C. 10

D. 11

E. Compilation fails.

F. An exception is thrown at runtime.

Answer: E


1Z0-851  pdf exam

Avant-garde 1z0-851 vs 310-065:

Q166. Given:

12. Date date = new Date();

13. df.setLocale(Locale.ITALY);

14. String s = df.format(date);

The variable df is an object of type DateFormat that has been initialized in line 11. What is the result if this

code is run on December 14, 2000?

A. The value of s is 14-dic-2000.

B. The value of s is Dec 14, 2000.

C. An exception is thrown at runtime.

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

Answer: D


Q167. Given:

11. String test = "a1b2c3";

12. String[] tokens = test.split("\d");

13. for(String s: tokens) System.out.print(s + " ");

What is the result?

A. a b c

B. 1 2 3

C. a1b2c3

D. a1 b2 c3

E. Compilation fails.

F. The code runs with no output.

G. An exception is thrown at runtime.

Answer: A


Q168. Given:

11. String test = "Test A. Test B. Test C.";

12. // insert code here

13. String[] result = test.split(regex);

Which regular expression, inserted at line 12, correctly splits test into "Test A", "Test B", and "Test C"?

A. String regex = "";

B. String regex = " ";

C. String regex = ".*";

D. String regex = "\s";

E. String regex = "\.\s*";

F. String regex = "\w[ .] +";

Answer: E


Q169. Given a class Repetition:

1. package utils;

2.

3. public class Repetition {

4. public static String twice(String s) { return s + s; }

5. } and given another class Demo: 1. // insert code here

2.

3. public class Demo {

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

5. System.out.println(twice("pizza"));

6. }

7. }

Which code should be inserted at line 1 of Demo.java to compile and run Demo to print "pizzapizza"?

A. import utils.*;

B. static import utils.*;

C. import utils.Repetition.*;

D. static import utils.Repetition.*;

E. import utils.Repetition.twice();

F. import static utils.Repetition.twice;

G. static import utils.Repetition.twice;

Answer: F


Q170. Given:

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

12. String str = "null";

13. if (str == null) {

14. System.out.println("null");

15. } else (str.length() == 0) {

16. System.out.println("zero");

17. } else {

18. System.out.println("some");

19. }

20. }

What is the result?

A. null

B. zero

C. some

D. Compilation fails.

E. An exception is thrown at runtime.

Answer: D