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 21 – NEW QUESTION 30
QUESTION 21
Given:
Which two declarations will compile?
A. int a, b, c = 0;
B. int a, b, c;
C. int g, int h, int i = 0;
D. int d, e, F;
E. int k, l, m = 0;
Answer: AD
Explanation:
Incorrect answers:
int a, b, c;
OK, but duplicate definition.
QUESTION 22
Given:
class X {}
class Y {Y () {}}
class Z {z(int i ) {} }
Which class has a default constructor?
A. X only
B. Y only
C. Z only
D. X and Y
E. Y and Z
F. X and Z
G. X, Y and Z
Answer: A
QUESTION 23
Given the code fragment:
What values of x, y, z will produce the following result?
1 2 3 4
1 2 3 4
1 2 3 4
——
1 2 3 4
——
A. X = 4, Y = 3, Z = 2
B. X = 3, Y = 2, Z = 3
C. X = 2, Y = 3, Z = 3
D. X = 4, Y = 2, Z= 3
E. X = 2, Y = 3, Z = 4
Answer: E
Explanation:
Z is for the innermost loop. Should print 1 2 3 4. So Z must be 4.
Y is for the middle loop. Should print three lines of 1 2 3 4. So Y must be set 3.
X is for the outmost loop. Should print 2 lines of —-. So X should be 2.
QUESTION 24
Which statement initializes a stringBuilder to a capacity of 128?
A. StringBuildersb = new String(“128”);
B. StringBuildersb = StringBuilder.setCapacity(128);
C. StringBuildersb = StringBuilder.getInstance(128);
D. StringBuildersb = new StringBuilder(128);
Answer: D
Explanation:
(int capacity)
StringBuilder
Constructs a string builder with no characters in it and an initial capacity specified by the capacity argument.
Note: An instance of a StringBuilder is a mutable sequence of characters. The principal operations on a StringBuilder are the append and insert methods, which are overloaded so as to accept data of any type. Each effectively converts a given datum to a string and then appends or inserts the characters of that string to the string builder. The append method always adds these characters at the end of the builder; the insert method adds the characters at a specified point.
Incorrect answers:
StringBuilder sb = new String(“128”);
StringBuilder not String is required.
setCapacity or getInstance do not work.
QUESTION 25
Given:
What is the result?
A. 0
B. 0
1
2
C. 0
1
2
0
1
2
0
1
2
D. Compilation fails
Answer: B
Explanation:
table.length is 3. So the do-while loop will run 3 times with ii=0, ii=1 and ii=2.
The second while statement will break the do-loop when ii = 3.
Note:The Java programming language provides ado-whilestatement, which can be expressed as
follows:
do {
statement(s)
} while (expression);
QUESTION 26
A method is declared to take three arguments.
A program calls this method and passes only two arguments.
What is the result?
A. Compilation fails.
B. The third argument is given the value null.
C. The third argument is given the value void.
D. The third argument is given the value zero.
E. The third argument is given the appropriate false value for its declared type.
F. An exception occurs when the method attempts to access the third argument.
Answer: A
Explanation:
The problem is noticed at build/compile time. At build you would receive an error
message like:
required: int,int,int
found: int,int
QUESTION 27
Given the fragment:
What is the result?
A. 14
B. 15
C. 24
D. 25
E. 34
F. 35
Answer: F
Explanation:
The two elements 3 and 4 (starting from position with index 2) are copied into
position index 1 and 2 in the same array.
After the arraycopy command the array looks like:
{1, 3, 4, 4, 5};
Then element with index 1 is printed: 3
Then element with index 4 is printed: 5
Note:The System class has an arraycopy method that you can use to efficiently copy data from
one array into another:
public static void arraycopy(Object src, int srcPos,
Object dest, int destPos, int length)
The two Object arguments specify the array to copyfromand the array to copyto. The three int
arguments specify the starting position in the source array, the starting position in the destination
array, and the number of array elements to copy.
QUESTION 28
Given the following code fragment:
What is the result if the integer value is 33?
A. The fox jump lazy…
B. The fox lazy…
C. Quick fox over lazy …
D. Quick fox the ….
Answer: B
Explanation:
33 is greater than 0.
33 is not equal to 0.
the is printed.
33 is greater than 30
fox is printed
33 is greater then 10 (the two else if are skipped)
lazy is printed
finally … is printed.
QUESTION 29
Which three are advantages of the Java exception mechanism?
A. Improves the program structure because the error handling code is separated from the normal
program function
B. Provides a set of standard exceptions that covers all the possible errors
C. Improves the program structure because the programmer can choose where to handle exceptions
D. Improves the program structure because exceptions must be handled in the method in which they
occurred
E. allows the creation of new exceptions that are tailored to the particular program being
Answer: ACE
Explanation:
A: The error handling is separated from the normal program logic.
C: You have some choice where to handle the exceptions.
E: You can create your own exceptions.
Incorrect answers:
B: The standard exceptions do not cover all possible errors.
D. Exceptions do not need to be handled in the method where they occurred.
They can be handled in the method which is calling the method that throws an exception.
QUESTION 30
Given the code fragment:
Boolean b1 = true;
Boolean b2 = false;
int 1 = 0;
while (foo) {}
Which one is valid as a replacement for foo?
A. b1.compareTo(b2)
B. i = 1
C. i == 2? -1:0
D. “foo”.equals(“bar”)
Answer: D
Explanation:
equals works fine on strings. equals produces a Boolean value.
Incorrect answers:
the compareTo method produces and int, not a boolean.
i = 1 is an assignment, not a comparison.
i == 2? -1:0 would produce the integer 0. A Boolean value is needed.
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!