[2016-May-NEW]Exam 1Z0-803 VCE Dumps 271q from Braindump2go[NQ11-NQ20]
2016 May Oracle Official News – 1Z0-803: Java SE 7 Programmer I Exam Questions New Updated Today! Braindump2go.com Offers 1Z0-803 New Questions and Answers for Free Download!
NEW QUESTION 11 – NEW QUESTION 20
QUESTION 11
Given:
Which three lines will compile and output “right on!”?
A. Line 5
B. Line 6
C. Line 7
D. Line 8
E. Line 9
F. Line 10
Answer: CDF
QUESTION 12
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?
A. if (h1 == h2)
B. if (h1.equals(h2))
C. if (h1 = = h2)
D. if (h1.same(h2))
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.
QUESTION 13
Which two are valid declarations of a two-dimensional array?
A. int[][] array2D;
B. int[2][2] array2D;
C. int array2D[];
D. int[] array2D[];
E. int[][] array2D[];
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.
QUESTION 14
Given:
Which two are possible outputs?
A. Option A
B. Option B
C. Option C
D. Option D
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.
QUESTION 15
Given the code fragment:
System.out.println (“Result:” +3+5);
System.out.println (“result:” + (3+5));
What is the result?
A. Result: 8
Result: 8
B. Result: 35
Result: 8
C. Result: 8
Result: 35
D. Result: 35
Result: 35
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.
QUESTION 16
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?
A. Catch the exception in the method doSomething().
B. Declare the exception to be thrown in the doSomething() method signature.
C. Cast the exception to a RunTimeException in the doSomething() method.
D. Catch the exception in the method that calls doSomething().
Answer: AB
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.
QUESTION 17
Which two may precede the word “class” in a class declaration?
A. local
B. public
C. static
D. volatile
E. synchronized
Answer: BC
Explanation:
B: A class can be declared as public or private.
C: You can declare two kinds of classes: top-level classes and inner classes.
You define an inner class within a top-level class. Depending on how it is defined, an inner class
can be one of the following four types:Anonymous, Local, Member and Nested top-level.
A nested top-level class is a member classes with astaticmodifier.
A nested top-level class is just
like any other top-level class except that it is declared within another class or interface. Nested
top-level classes are typically used as a convenient way to group related classes without creating
a new package.
The following is an example:
public class Main {
static class Killer {
QUESTION 18
Given the code fragment:
What is the result?
A. Found Red
B. Found Red
Found Blue
C. Found Red
Found Blue
Found White
D. Found Red
Found Blue
Found White
Found Default
Answer: B
Explanation:
As there is no break statement after the case “Red” statement the case Blue statement will run as well.
Note: The body of a switch statement is known as a switch block.
A statement in the switch block
can be labeled with one or more case or default labels. The switch statement evaluates its expression, then executes all statements that follow the matching case label.
Each break statement terminates the enclosing switch statement. Control flow continues with the
first statement following the switch block. The break statements are necessary because without
them, statements in switch blocksfall through: All statements after the matching case label are
executed in sequence, regardless of the expression of subsequent case labels, until a break
statement is encountered.
QUESTION 19
Given:
What code should be inserted?
A. Option A
B. Option B
C. Option C
D. Option D
E. Option E
F. Option F
Answer: C
Explanation:
Dog should be an abstract class.
The correct syntax for this is: abstract class Dog { Poodle should extend Dog (not implement).
QUESTION 20
Which three are bad practices?
A. Checking for ArrayindexoutofBoundsException when iterating through an array to determinewhen
all elements have been visited
B. Checking for Error and. If necessary, restartingthe program to ensure that users are unaware
problems
C. Checking for FileNotFoundException to inform a user that a filename entered is not valid
D. Checking for ArrayIndexoutofBoundsExcepcion and ensuring that the program can recover if one
occur
E. Checking for an IOException and ensuring that the program can recover if one occurs
Answer: ABD
2016 Valid Oracle 1Z0-803 Exam Study Materials:
1.| Latest 1Z0-803 Exam VCE and PDF Dumps 271q from Braindump2go: http://www.braindump2go.com/1z0-803.html [100% Exam Pass Guaranteed!]
2.| New 1Z0-803 Exam Questions and Answers – Google Drive: https://drive.google.com/folderview?id=0B75b5xYLjSSNTUpTSzVyeEw0WW8&usp=sharing
MORE Practice is the Most Important IF You want to PASS 70-341 Exam 100%!
————— Braindump2go.com
————— Pass All IT Exams at the first Try!