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 11:
Given the code fragment:
1.
ArrayList list = new ArrayList<>(1);
2.
list.add(1001);
3.
list.add(1002);
4.
System.out.println(list.get(list.size()));
What is the result?
A. Compilation fails due to an error on line 1. B. An exception is thrown at run time due to error on line 3 C. An exception is thrown at run time due to error on line 4 D. 1002
C. An exception is thrown at run time due to error on line 4
The code compiles fine.
At runtime an IndexOutOfBoundsException is thrown when the second list item is added.
Question 12:
Given:
What is the reference type of myZ and what is the type of the object it references?
A. Reference type is Z; object type is Z. B. Reference type is Y; object type is Y. C. Reference type is Z; object type is Y. D. Reference type is X; object type is Z.
C. Reference type is Z; object type is Y.
Question 13:
Given:
How many times is 2 printed as a part of the output?
A. Zero B. Once C. Twice D. Thrice E. Compilation fails.
D. Thrice
Question 14:
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;
A. Line 21 B. Line 22 C. Line 23 D. Line 24 E. Line 25
B. Line 22
The following is printed:
Question 16:
Given:
public class Equal {
public static void main(String[] args) {
String str1 = "Java";
String[] str2 = {"J","a","v","a"};
String str3 = "";
for (String str : str2) {
str3 = str3+str;
}
boolean b1 = (str1 == str3);
boolean b2 = (str1.equals(str3));
System.out.print(b1+", "+b2);
}
What is the result?
A. true, false B. false, true C. true, true D. false, false
B. false, true
== strict equality.
equals compare state, not identity.
Question 17:
Given:
public class Test {
public static void main(String[] args) {
try {
String[] arr =new String[4];
arr[1] = "Unix";
arr[2] = "Linux";
arr[3] = "Solarios";
for (String var : arr) {
System.out.print(var + " ");
}
} catch(Exception e) {
System.out.print (e.getClass());
}
}
}
What is the result?
A. Unix Linux Solaris B. Null Unix Linux Solaris C. Class java.lang.Exception D. Class java.lang.NullPointerException
B. Null Unix Linux Solaris
null Unix Linux Solarios
The first element, arr[0], has not been defined.
Question 18:
Given:
public class Test {
public static void main(String[] args) {
int day = 1;
switch (day) {
case "7": System.out.print("Uranus");
case "6": System.out.print("Saturn");
case "1": System.out.print("Mercury");
case "2": System.out.print("Venus");
case "3": System.out.print("Earth");
case "4": System.out.print("Mars");
case "5": System.out.print("Jupiter");
}
}
}
Which two modifications, made independently, enable the code to compile and run?
A. Adding a break statement after each print statement B. Adding a default section within the switch code-block C. Changing the string literals in each case label to integer D. Changing the type of the variable day to String E. Arranging the case labels in ascending order
A. Adding a break statement after each print statement C. Changing the string literals in each case label to integer
The following will work fine:
public class Test {
public static void main(String[] args) {
int day = 1;
switch (day) {
case 7: System.out.print("Uranus"); break;
case 6: System.out.print("Saturn"); break;
case 1: System.out.print("Mercury"); break;
case 2: System.out.print("Venus"); break;
case 3: System.out.print("Earth"); break;
case 4: System.out.print("Mars"); break;
case 5: System.out.print("Jupiter"); break;
}
}
}
Question 19:
Given the for loop construct:
for ( expr1 ; expr2 ; expr3 ) {
statement;
}
Which two statements are true?
A. This is not the only valid for loop construct; there exits another form of for loop constructor. B. The expression expr1 is optional. it initializes the loop and is evaluated once, as the loop begin. C. When expr2 evaluates to false, the loop terminates. It is evaluated only after each iteration through the loop. D. The expression expr3 must be present. It is evaluated after each iteration through the loop.
B. The expression expr1 is optional. it initializes the loop and is evaluated once, as the loop begin. C. When expr2 evaluates to false, the loop terminates. It is evaluated only after each iteration through the loop.
The for statement have this forms:
for (init-stmt; condition; next-stmt) {
body
}
There are three clauses in the for statement.
The init-stmt statement is done before the loop is started, usually to initialize an iteration variable. The condition expression is tested before each time the loop is done. The loop isn't executed if the boolean expression is false (the same as the
while loop). The next-stmt statement is done after the body is executed. It typically increments an iteration variable.
Incorrect answers:
A: A try for a counter-example:
for (int 1 : a) {
}
This is a correct statement. However, Expr2 and Expr3 are here empty expressions, so it is still in the format defined above.
Question 20:
Which two statements are true?
A. An abstract class can implement an interface. B. An abstract class can be extended by an interface. C. An interface CANNOT be extended by another interface. D. An interface can be extended by an abstract class. E. An abstract class can be extended by a concrete class. F. An abstract class CANNOT be extended by an abstract class.
A. An abstract class can implement an interface. E. An abstract class can be extended by a concrete class.
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.