Get Ready to Pass the 1z1-808 exam with Oracle Latest Practice Exam [Q43-Q58]

Share

Get Ready to Pass the 1z1-808 exam with Oracle Latest Practice Exam

Get Prepared for Your 1z1-808 Exam With Actual Oracle Study Guide!

NEW QUESTION # 43
Given the code fragment:

What is the result?

  • A. Element 0
    Element 1
  • B. Null
    Null
  • C. A NullPointerException is thrown at runtime.
  • D. Null element 0
    Null element 1

Answer: C


NEW QUESTION # 44
Which three are advantages of the Java exception mechanism? (Choose three.)

  • A. Provides a set of standard exceptions that covers all the possible errors
  • B. Improves the program structure because the error handling code is separated from the normal program function
  • C. Improves the program structure because the programmer can choose where to handle exceptions
  • D. Allows the creation of new exceptions that are tailored to the particular program being created
  • E. Improves the program structure because exceptions must be handled in the method in which they occurred

Answer: B,C,E

Explanation:
Explanation/Reference:
Reference: http://javajee.com/introduction-to-exceptions-in-java


NEW QUESTION # 45
Given the code fragment:

What is the result?

  • A. 0
  • B. 1
  • C. 2
  • D. 3

Answer: C


NEW QUESTION # 46
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?

  • A. grid[2][0] = 'X';
  • B. grid[3][1] = 'X';
  • C. grid[0][2] = 'X';
  • D. grid[1][3] = 'X';
  • E. grid[1][2] = 'X';

Answer: C


NEW QUESTION # 47
Given the code fragment:

Which three lines fail to compile?

  • A. Line 12
  • B. Line 11
  • C. Line 9
  • D. Line 8
  • E. Line 7
  • F. Line 10

Answer: A,E,F


NEW QUESTION # 48
Given the code fragment:

What is the result?

  • A. 2012-02-10 00:00
  • B. A DateTimeException is thrown at runtime.
  • C. 2012-02-10
  • D. 2012-01-30

Answer: D

Explanation:


NEW QUESTION # 49
Given the code fragment:

What is the result?

  • A. Compilation fails.
  • B. 3 Found
  • C. 0 Found
  • D. 1 Found

Answer: B


NEW QUESTION # 50
Which of the following exception will be thrown due to the statement given here? int array[] = new int[-2];

  • A. ArrayIndexOutOfBoundsException
  • B. IndexOutOfBoundsException
  • C. NegativeArraySizeException
  • D. This statement does not cause any exception.
  • E. NullPointerException

Answer: C

Explanation:
In given statement we can see that, we have passed negative value for creating int array,
which results a NegativeArraySize Except ion. Hence option B is correct.
Option A is incorrect as it is thrown when an application attempts to use null in a case
where an object is required.
Option D is incorrect as IndexOutOfBoundsException thrown to indicate that an index of
some sort (such as to an array, to a string, or to a vector) is out of range.
REFERENCE
rhttpy/docs.oracle.com/iavase/S/docs/api/java/lang/NegativeArraySizeException.html


NEW QUESTION # 51
Given:
class MarksOutOfBoundsException extends IndexOutOfBoundsException { }
public class GradingProcess {
void verify(int marks) throws IndexOutOfBoundsException {
if (marks > 100) {
throw new MarksOutOfBoundsException();
}
if (marks > 50) {
System.out.print("Pass");
} else {
System.out.print("Fail");
}
}
public static void main(String[] args) {
int marks = Integer.parseInt(args[2]);
try {
new GradingProcess().verify(marks));
} catch(Exception e) {
System.out.print(e.getClass());
}
}
}
And the command line invocation:
Java grading process 89 50 104
What is the result?

  • A. Pass
  • B. Class MarketOutOfBoundsException
  • C. Class Exception
  • D. Class IndexOutOfBoundsException
  • E. Fail

Answer: B

Explanation:
The value 104 will cause a MarketOutOfBoundsException


NEW QUESTION # 52
Given the code fragment:

What is the result?

  • A. Compilation fails at both line n1 and line n2.
  • B. Compilation fails only at line n1.
  • C. Jesse 25
    Walter 52
  • D. Compilation fails only at line n2.

Answer: A


NEW QUESTION # 53
Given the code fragment:

Test.java

Which is the result?
A: Compilation fails in the Employee class.
B:

C:

D: Compilation fails in the Test class.
E: Both the Employee class and the test class fail to compile.

  • A. Option B
  • B. Option E
  • C. Option A
  • D. Option D
  • E. Option C

Answer: B


NEW QUESTION # 54
Given the following class:

Which three pieces of code, when inserted independently, set the value of amount to 100?

  • A. Option B
  • B. Option D
  • C. Option E
  • D. Option A
  • E. Option F
  • F. Option C

Answer: B,C,F


NEW QUESTION # 55
Give:

What value should replace kk in line x to cause jj = 5 to be output?

  • A. 0
  • B. 1
  • C. 2
  • D. 3
  • E. 4

Answer: C

Explanation:
We need to get jj to 5. It is initially set to 0. So we need to go through the for loop 5 times. The for loops ends when ii > 6 and ii decreases for every loop. So we need to initially set ii to 11. We set kk to 11.


NEW QUESTION # 56
Which three statements are benefits of encapsulation?

  • A. Permits classes to be combined into the same package
  • B. Allows a class implementation to change without changing t he clients
  • C. Protects confidential data from leaking out of the objects
  • D. Enables multiple instances of the same class to be created safely
  • E. Prevents code from causing exceptions
  • F. Enables the class implementation to protect its invariants

Answer: B,C,F


NEW QUESTION # 57
Given the code fragment:

Which three lines fail to compile? (Choose three.)

  • A. Line 12
  • B. Line 11
  • C. Line 9
  • D. Line 8
  • E. Line 7
  • F. Line 10

Answer: A,E,F


NEW QUESTION # 58
......

Pass Your Next 1z1-808 Certification Exam Easily & Hassle Free: https://www.examboosts.com/Oracle/1z1-808-practice-exam-dumps.html

Free Oracle 1z1-808 Exam Question Practice Exams: https://drive.google.com/open?id=1VOwJ80PO-7ccKXc9WCIZjU66i2OIPIYV