Oracle 1Z0-803 Online Practice
Questions and Exam Preparation
1Z0-803 Exam Details
Exam Code
:1Z0-803
Exam Name
:Java SE 7 Programmer I
Certification
:Oracle Certifications
Vendor
:Oracle
Total Questions
:216 Q&As
Last Updated
:Oct 18, 2021
Oracle 1Z0-803 Online Questions &
Answers
Question 171:
Which two are valid instantiations and initializations of a multi dimensional array?
A. Option A B. Option B C. Option C D. Option D E. Option E
B. Option B D. Option D
In the Java programming language, a multidimensional array is simply an array whose components are themselves arrays.
Question 172:
Given the code fragment:
What is the result?
A. 3 false 1 B. 2 true 3 C. 2 false 3 D. 3 true 1 E. 3 false 3 F. 2 true 1 G. 2 false 1
D. 3 true 1
The length of the element with index 0, {0, 1, 2}, is 3. Output: 3 The element with index 1, {3, 4, 5, 6}, is of type array. Output: true The element with index 0, {0, 1, 2} has the element with index 1: 1. Output: 1
Question 173:
Given: What is the result?
A. 6 B. 6 C. 6 D. 6
A. 6
Within main z is assigned 6. z is printed. Output: 6 Within doStuff z is assigned 5.DoStuff2 locally sets z to 4 (but MyScope.z is set to 4), but in Dostuff z is still 5. z is printed. Output: 5 Again z is printed within main (with local z set to 6). Output: 6 Finally MyScope.z is printed. MyScope.z has been set to 4 within doStuff2(). Output: 4
Question 174:
Given the code fragment: StringBuilder sb = new StringBuilder ( ) ; Sb.append ("world");
Which code fragment prints Hello World?
A. sb.insert(0,"Hello "); System.out.println(sb); B. sb.append(0,"Hello "); System.out.println(sb); C. sb.add(0,"Hello "); System.out.println(sb); D. sb.set(0,"Hello "); System.out.println(sb);D
A. sb.insert(0,"Hello "); System.out.println(sb);
The java.lang.StringBuilder.insert(int offset, char c) method inserts the string representation of the char argument into this sequence. The second argument is inserted into the contents of this sequence at the position indicated by offset. The length of this sequence increases by one.The offset argument must be greater than or equal to 0, and less than or equal to the length of this sequence.
A. Option A B. Option B C. Option C D. Option D E. Option E
A. Option A C. Option C E. Option E
A: Throwing the same exception is fine.
C: Using a subclass of java.io.IOException (here java.io.FileNotFoundException) is fine
E: Not using a throw clause is fine.
Incorrect answers:
B: Exception is not a subclass of java.io.IOException and cannot be used here.
D: Not extends. SampleCloseable cannot be the superclass of Test, a superclass must be a class. (An interface extends other interfaces.)
Question 176:
Given the code fragment:
How many times is 2 printed?
A. Zero B. Once C. Twice D. Thrice E. It is not printed because compilation fails
B. Once
The outer loop will run three times, one time each for the elements in table. The break statement breaks the inner loop immediately each time. 2 will be printed once only.
Note: If the line int ii = 0; is missing the program would not compile.
Question 177:
Given the code fragment:
public class Test {
public static void main(String[] args) {
boolean isChecked = false;
int arry[] = {1,3,5,7,8,9};
int index = arry.length;
while ( ) {
if (arry[index-1] % 2 ==0) {
isChecked = true;
}
}
System.out.print(arry(index]+", "+isChecked));
}
}
Which set of changes enable the code to print 1, true?
A. Replacing with index > 0 and replacing with index--; B. Replacing with index > 0 and replacing with --index; C. Replacing with index > 5 and replacing with --index ; D. Replacing with index and replacing with --index ;
A. Replacing with index > 0 and replacing with index--;
Note: Code in B (code2 is --index;). also works fine.
Question 178:
Given:
interface Pet { }
class Dog implements Pet { }
public class Beagle extends Dog{ }
Which three are valid?
A. Pet a = new Dog(); B. Pet b = new Pet(); C. Dog f = new Pet(); D. Dog d = new Beagle(); E. Pet e = new Beagle(); F. Beagle c = new Dog();
A. Pet a = new Dog(); D. Dog d = new Beagle(); E. Pet e = new Beagle();
Incorrect:
Not B, not C: Pet is abstact, cannot be instantiated. Not F: incompatible type. Required Beagle, found Dog.
Question 179:
Given:
public class App { // Insert code here System.out.print("Welcome to the world of Java"); } }
Which two code fragments, when inserted independently at line // Insert code here, enable the program to execute and print the welcome message on the screen?
A. static public void main (String [] args) { B. static void main (String [] args) { C. public static void Main (String [] args) { D. public static void main (String [] args) { E. public void main (String [] args) {
A. static public void main (String [] args) { D. public static void main (String [] args) {
Incorrect:
Not B: No main class found.
Not C: Main method not found
not E: Main method is not static.
Question 180:
Given:
What is the result?
A. hEllOjAvA! B. Hello java! C. Out of limits hEllOjAvA! D. Out of limits
Nowadays, the certification exams become more and more important and required by more and more
enterprises when applying for a job. But how to prepare for the exam effectively? How to prepare
for the exam in a short time with less efforts? How to get a ideal result and how to find the
most reliable resources? Here on Vcedump.com, you will find all the answers.
Vcedump.com provide not only Oracle exam questions,
answers and explanations but also complete assistance on your exam preparation and certification
application. If you are confused on your 1Z0-803 exam preparations
and Oracle certification application, do not hesitate to visit our
Vcedump.com to find your solutions here.