Pass the Oracle Java SE 1z0-819 Questions and answers with CertsForce

Viewing page 5 out of 9 pages
Viewing questions 41-50 out of questions
Questions # 41:

Given:

Question # 41

Which statement is true?

Options:

A.

The code compiles successfully.


B.

The code fails to compile as res2 should be declared as final.


C.

The code fails to compile as MyResource must implement Closeable.


D.

The code fails to compile as try-try-resource needs a variable declaration such as MyResource r1= res1; MyResource r2 = res2;.


Questions # 42:

Given the code fragment:

Question # 42

What is the result?

Options:

A.

01


B.

0


C.

1


D.

The program prints nothing.


E.

It prints 1 in the infinite loop.


Questions # 43:

Given the code fragment:

Question # 43

What change on line 1 will make this code compile?

Options:

A.

Add catch (L |N e).


B.

Add catch (L |M N e).


C.

Add catch (L e).


D.

Add catch (N | L | M e).


E.

Add catch (M |L e).


Questions # 44:

Given the declaration:

Question # 44

Examine this code fragment:

/* Loc1 */ class ProcessOrders { ... }

Which two annotations may be applied at Loc1 in the code fragment? (Choose two.)

Options:

A.

@Resource(priority=100)


B.

@Resource(priority=0)


C.

@Resource(name=“Customer1”, priority=100)


D.

@Resource(name=“Customer1”)


E.

@Resource


Questions # 45:

Given:

Question # 45

What is the result?

Options:

A.

[0,0] = Red[0,1] = White[1,0] = Black[1,1] = Blue[2,0] = Yellow[2,1] = Green[3,0] = Violet


B.

[0,0] = Red[1,0] = Black[2,0] = Blue


C.

java.lang.ArrayIndexOutOfBoundsException thrown


D.

[0,0] = Red[0,1] = White[1,0] = Black[2,0] = Blue[2,1] = Yellow[2,2] = Green[2,3] = Violet


Questions # 46:

Which two describe reasons to modularize the JDK? (Choose two.)

Options:

A.

easier to understand the Java language


B.

improves security and maintainability


C.

easier to expose implementation details


D.

improves application robustness


E.

easier to build a custom runtime linking application modules and JDK modules


Questions # 47:

Given:

Question # 47

and:

Question # 47

Which code, when inserted on line 10, prints the number of unique localities from the roster list?

Options:

A.

.map(Employee::getLocality)

.distinct()

.count();


B.

map(e −> e.getLocality())

.count();


C.

.map(e −> e.getLocality())

.collect(Collectors.toSet())

.count();


D.

.filter(Employee::getLocality)

.distinct()

.count();


Questions # 48:

Given:

Question # 48

What will secure this code from a potential Denial of Service condition?

Options:

A.

After Line 4, add indexReader.close().


B.

On Line 3, enclose processData(dataReader) with try with resources.


C.

After Line 3, add dataReader.close().


D.

On Line 1, use try with resources when opening each dataReader.


E.

Before Line 1, check the size of dataFiles to make sure it does not exceed a threshold.


Questions # 49:

Given:

Question # 49

Which would cause s to be AQCD?

Options:

A.

s.replace(s.indexOf(“A”), s.indexOf(“C”), “Q”);


B.

s.replace(s.indexOf(“B”), s.indexOf(“C”), “Q”);


C.

s.replace(s.indexOf(“B”), s.indexOf(“B”), “Q”);


D.

s.replace(s.indexOf(“A”), s.indexOf(“B”), “Q”);


Questions # 50:

Assume ds is a DataSource and the EMP table is defined appropriately.

Question # 50

What does executing this code fragment do?

Options:

A.

inserts two rows (101, 'SMITH', 'HR') and (102, 'JONES', NULL)


B.

inserts two rows (101, 'SMITH', 'HR') and (102, 'JONES', 'HR')


C.

inserts one row (101, 'SMITH', 'HR')


D.

throws a SQLException


Viewing page 5 out of 9 pages
Viewing questions 41-50 out of questions