Download Java SE 7 Programmer I.1Z0-803.PracticeTest.2018-08-09.118q.vcex

Vendor: Oracle
Exam Code: 1Z0-803
Exam Name: Java SE 7 Programmer I
Date: Aug 09, 2018
File Size: 5 MB

How to open VCEX files?

Files with VCEX extension can be opened by ProfExam Simulator.

Demo Questions

Question 1
Given:
  
What is the result?
  1. There is no output
  2. d is output
  3. A StringIndexOutOfBoundsException is thrown at runtime
  4. An ArrayIndexOutOfBoundsException is thrown at runtime
  5. A NullPointException is thrown at runtime
  6. A StringArrayIndexOutOfBoundsException is thrown at runtime
Correct answer: C
Explanation:
There are only 11 characters in the string "Hello World". The code the String.charAt(11) retrieves the 12th character, which does not exist. A StringIndexOutOfBoundsException is thrown. Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: 11
There are only 11 characters in the string "Hello World". The code the String.charAt(11) retrieves the 12th character, which does not exist. A StringIndexOutOfBoundsException is thrown. 
Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: 11
Question 2
Given a java source file:
  
What changes will make this code compile? (Select Two)
  1. Adding the public modifier to the declaration of class x
  2. Adding the protected modifier to the x() constructor
  3. Changing the private modifier on the declaration of the one() method to protected
  4. Removing the Y () constructor
  5. Removing the private modifier from the two () method
Correct answer: CE
Explanation:
Using the private protected, instead of the private modifier, for the declaration of the one() method, would enable the two() method to access the one() method.
Using the private protected, instead of the private modifier, for the declaration of the one() method, would enable the two() method to access the one() method.
Question 3
Given:
  
What three modifications, made independently, made to class greet, enable the code to compile and run?
  1. line 6 replaced with handy.dandy.keystroke stroke = new KeyStroke ( );
  2. line 6 replaced with handy.*.KeyStroke = new KeyStroke ( );
  3. line 6 replaced with handy.dandy.KeyStroke Stroke = new handy.dandy.KeyStroke();
  4. import handy.*; added before line 1
  5. import handy.dandy.*; added after line 1
  6. import handy.dandy,KeyStroke; added after line 1
  7. import handy.dandy.KeyStroke.typeException(); added before line 1
Correct answer: CEF
Explanation:
Three separate solutions:C: the full class path to the method must be stated (when we have not imported the package)D: We can import the hold dandy classF: we can import the specific method
Three separate solutions:
C: the full class path to the method must be stated (when we have not imported the package)
D: We can import the hold dandy class
F: we can import the specific method
Question 4
Given:
  
What is the result?
  1. They match 
    They really match
  2. They really match
  3. They match
  4. Nothing Prints
  5. They really match 
    They really match
Correct answer: B
Explanation:
The strings are not the same objects so the == comparison fails. See note #1 below. As the value of the strings are the same equals is true. The equals method compares values for equality. Note: #1 ==Compares references, not values. The use of == with object references is generally limited to the following:Comparing to see if a reference is null. Comparing two enum values. This works because there is only one object for each enum constant. You want to know if two references are to the same object.
The strings are not the same objects so the == comparison fails. See note #1 below. 
As the value of the strings are the same equals is true. The equals method compares values for equality. 
Note: #1 ==
Compares references, not values. The use of == with object references is generally limited to the following:
Comparing to see if a reference is null. 
Comparing two enum values. This works because there is only one object for each enum constant. 
You want to know if two references are to the same object.
Question 5
Given:
  
 
Which three lines will compile and output “right on!”?
  1. Line 5
  2. Line 6
  3. Line 7
  4. Line 8
  5. Line 9
  6. Line 10
Correct answer: CDF
Question 6
Given the code fragment:
String h1 = "Bob"; 
String h2 = new String ("Bob"); 
What is the best way to test that the values of h1 and h2 are the same?
  1. if (h1 = = h2)
  2. if (h1.equals(h2))
  3. if (h1 = = h2)
  4. if (h1.same(h2))
Correct answer: B
Explanation:
The equals method compares values for equality. Incorrect answers:The strings are not the same objects so the == comparison fails. See note #1 below. As the value of the strings are the same equals is true. The equals compares values for equality. There is no generic comparison method named same. = = (with a space) is not a valid method. Note: #1 ==Compares references, not values. The use of == with object references is generally limited to the following:Comparing to see if a reference is null. Comparing two enum values. This works because there is only one object for each enum constant. You want to know if two references are to the same object.
The equals method compares values for equality. 
Incorrect answers:
The strings are not the same objects so the == comparison fails. See note #1 below. 
As the value of the strings are the same equals is true. The equals compares values for equality. 
There is no generic comparison method named same. 
= = (with a space) is not a valid method. 
Note: #1 ==
Compares references, not values. The use of == with object references is generally limited to the following:
Comparing to see if a reference is null. 
Comparing two enum values. This works because there is only one object for each enum constant. 
You want to know if two references are to the same object.
Question 7
Which two are valid declarations of a two-dimensional array?
  1. int [] [] array2D;
  2. int [2] [2] array2D;
  3. int array2D [];
  4. int [] array2D [];
  5. int [] [] array2D [];
Correct answer: AD
Explanation:
int[][] array2D; is the standard convention to declare a 2-dimensional integer array. int[] array2D[]; works as well, but it is not recommended. Incorrect answers:int[2][2] array2D; The size of the array cannot be defined this way. int array2D[]; is good definition of a one-dimensional array. int[] []array2D[];is good definition of a three-dimensional array.
int[][] array2D; is the standard convention to declare a 2-dimensional integer array. 
int[] array2D[]; works as well, but it is not recommended. 
Incorrect answers:
int[2][2] array2D; 
The size of the array cannot be defined this way. 
int array2D[]; is good definition of a one-dimensional array. 
int[] []array2D[];is good definition of a three-dimensional array.
Question 8
Given the code fragment:
System.out.printIn ("Result: " +3+5);
System.out.printIn ("Result: " + (3+5));
What is the result?
  1. Result: 8 
    Result: 8
  2. Result: 35 
    Result: 8
  3. Result: 8 
    Result: 35
  4. Result: 35 
    Result: 35
Correct answer: B
Explanation:
In the first statement 3 and 5 are treated as strings and are simply concatenated. In the first statement 3 and 5 are treated as integers and their sum is calculated.
In the first statement 3 and 5 are treated as strings and are simply concatenated. 
In the first statement 3 and 5 are treated as integers and their sum is calculated.
Question 9
Given:
  
Which two are possible outputs? 
  
  1. Option A
  2. Option B
  3. Option C
  4. Option D
Correct answer: AD
Explanation:
The first println statement,  System.out.println("Before if clause");, will always run. If Math.Random() > 0.5 then there is an exception. The exception message is displayed and the program terminates. If Math.Random() > 0.5 is false, then the second println statement runs as well. Incorrect answers:B: The second println statement would not run.C: The first println statement will always run.
The first println statement,  System.out.println("Before if clause");, will always run. 
If Math.Random() > 0.5 then there is an exception. The exception message is displayed and the program terminates. 
If Math.Random() > 0.5 is false, then the second println statement runs as well. 
Incorrect answers:
B: The second println statement would not run.
C: The first println statement will always run.
Question 10
A method doSomething () that has no exception handling code is modified to trail a method that throws a checked exception. 
Which two modifications, made independently, will allow the program to compile?
  1. Catch the exception in the method doSomething().
  2. Declare the exception to be thrown in the doSomething() method signature.
  3. Cast the exception to a RunTimeException in the doSomething() method.
  4. Catch the exception in the method that calls doSomething().
Correct answer: BD
Explanation:
Valid Java programming language code must honor the Catch or Specify Requirement. This means that code that might throw certain exceptions must be enclosed by either of the following:  A try statement that catches the exception. The try must provide a handler for the exception, as described in Catching and Handling Exceptions. A method that specifies that it can throw the exception. The method must provide a throws clause that lists the exception, as described in Specifying the Exceptions Thrown by a Method. Code that fails to honor the Catch or Specify Requirement will not compile.
Valid Java programming language code must honor the Catch or Specify Requirement. This means that code that might throw certain exceptions must be enclosed by either of the following:  
  • A try statement that catches the exception. The try must provide a handler for the exception, as described in Catching and Handling Exceptions. 
  • A method that specifies that it can throw the exception. The method must provide a throws clause that lists the exception, as described in Specifying the Exceptions Thrown by a Method. 
Code that fails to honor the Catch or Specify Requirement will not compile.
HOW TO OPEN VCE FILES

Use VCE Exam Simulator to open VCE files
Avanaset

HOW TO OPEN VCEX FILES

Use ProfExam Simulator to open VCEX files
ProfExam Screen

ProfExam
ProfExam at a 20% markdown

You have the opportunity to purchase ProfExam at a 20% reduced price

Get Now!