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 141:
Given:
Which approach ensures that the class can be compiled and run?
A. Put the throw new Exception() statement in the try block of try catch B. Put the doSomethingElse() method in the try block of a try catch C. Put the doSomething() method in the try block of a try catch D. Put the doSomething() method and the doSomethingElse() method in the try block of a try catch
A. Put the throw new Exception() statement in the try block of try catch
We need to catch the exception in the doSomethingElse() method.
Such as:
private static void doSomeThingElse() {
try {
throw new Exception();}
catch (Exception e)
{}
}
Note: One alternative, but not an option here, is the declare the exception in doSomeThingElse and catch it in the doSomeThing method.
Question 142:
Given:
What is the result?
A. Shining Sun Shining Sun Shining Sun B. Shining Sun Twinkling Star Shining Sun C. Compilation fails D. A ClassCastException is thrown at runtime
D. A ClassCastException is thrown at runtime
Question 143:
Given: Which two actions, used independently, will permit this class to compile?
A. Adding throws IOException to the main() method signature B. Adding throws IOException to the doSoomething() method signature C. Adding throws IOException to the main() method signature and to the dosomething() method D. Adding throws IOException to the dosomething() method signature and changing the catch argument to IOException E. Adding throws IOException to the main() method signature and changing the catch argument to IOException
C. Adding throws IOException to the main() method signature and to the dosomething() method D. Adding throws IOException to the dosomething() method signature and changing the catch argument to IOException
The IOException must be caught or be declared to be thrown. We must add a throws exception to the doSomething () method signature (static void doSomething() throws IOException). Then we can either add the same throws IOException to the main method (public static void main (String[] args) throws IOException), or change the catch statement in main to IOException.
Question 144:
Given: What is the result?
A. 7 B. 12 C. 19 D. Compilation fails E. An exception is thrown at run time
B. 12
Question 145:
public class Two {
public static void main(String[] args) {
try {
doStuff();
system.out.println("1");
}
catch {
system.out.println("2");
}}
public static void do Stuff() {
if (Math.random() > 0.5) throw new RunTimeException(); doMoreStuff(); System.out.println("3 "); }
public static void doMoreStuff() {
System.out.println("4");
}
}
Which two are possible outputs?
A. 2 B. 4 C. 1 D. 1
A. 2 B. 4
A: Output is 2 if Math.random() is greater than 0.5.
B: If Math.random() returns a value less equal to 0.5, the code won't throw an exception, it will continue with the doMore() method which will println "4" after which the program will continue with the doStuff() method and will println "3", after that we will be back in main() and the program will print "1".
Question 146:
Which is a valid abstract class?
A. public abstract class Car { protected void accelerate(); } B. public interface Car { protected abstract void accelerate(); } C. public abstract class Car { protected final void accelerate(); } D. public abstract class Car { protected abstract void accelerate(); } E. public abstract class Car { protected abstract void accelerate() { //more car can do }}
D. public abstract class Car { protected abstract void accelerate(); }
Question 147:
Given:
class Sports {
int num_players;
String name, ground_condition;
Sports(int np, String sname, String sground){
num_players = np;
name = sname;
ground_condition = sground;
}
}
class Cricket extends Sports {
int num_umpires;
int num_substitutes;
Which code fragment can be inserted at line //insert code here to enable the code to compile?
not C, not D: call to super must be the first statement in constructor.
Question 148:
Given:
What is the result?
A. Marrown String out of limits JesOran B. Marrown String out of limits Array out of limits C. Marrown String out of limits D. Marrown NanRed JesOran
A. Marrown String out of limits JesOran
Question 149:
Given:
A. X XX B. X Y X C. Y Y X D. Y YY
D. Y YY
Question 150:
Given:
What is the result?
A. The program prints nothing B. d C. A StringIndexOutOfBoundsException is thrown at runtime. D. AnArrayIndexOutOfBoundsException is thrown at runtime. E. A NullPointerException is thrown at runtime.
C. A StringIndexOutOfBoundsException is thrown at runtime.
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.