[Free] 2018(Jan) EnsurePass Examcollection Oracle 1z0-803 Dumps with VCE and PDF 41-50

Ensurepass.com : Ensure you pass the IT Exams
2018 Jan Oracle Official New Released 1z0-803
100% Free Download! 100% Pass Guaranteed!
http://www.EnsurePass.com/1z0-803.html

Java SE 7 Programmer I

Question No: 41

Given the code fragments:

Ensurepass 2018 PDF and VCE

What is the result?

  1. Super Sub

    Sub

  2. Contract Contract Super

  3. Compilation fails at line n1

  4. Compilation fails at line n2

Answer: D

Question No: 42

Which three are advantages of the Java exception mechanism?

  1. Improves the program structure because the error handling code is separated from the normal program function

  2. Provides a set of standard exceptions that covers all thepossible errors

  3. Improves the program structure because the programmer can choose where to handle exceptions

  4. Improves the program structure because exceptions must be handled in the method in which they occurred

  5. allows the creation of new exceptions that are tailored to the particular program being

Answer: A,C,E 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.

Question No: 43

Given:

Ensurepass 2018 PDF and VCE

What is the result?

  1. One

  2. Two

  3. Three

  4. Compilation fails

Answer: C Explanation:

In this scenario the overloading method is called with a double/float value, 4.0. This makes the third overload method to run.

Note:

The Java programming language supportsoverloadingmethods, and Java can distinguish between methods with differentmethod signatures. This means that methods within a class can have the same name if they have different parameter lists. Overloaded methods are differentiated by the number and the type of the arguments passed into the method.

Question No: 44

View the Exhibit.

public class Hat {

public int ID =0;

public String name = quot;hatquot;;

public String size = quot;One Size Fit Allquot;; public String color=quot;quot;;

public String getName() { return name; } public void setName(String name) { this.name = name;

}

}

Given

public class TestHat {

public static void main(String[] args) { Hat blackCowboyHat = new Hat();

}

}

Which statement sets the name of the Hat instance?

  1. blackCowboyHat.setName = quot;Cowboy Hatquot;;

  2. setName(quot;Cowboy Hatquot;);

  3. Hat.setName(quot;Cowboy Hatquot;);

  4. blackCowboyHat.setName(quot;Cowboy Hatquot;);

Answer: D

Question No: 45

Given:

public class MyClass {

public static void main(String[] args) { while (int ii = 0; ii lt; 2) {

ii ;

System.out.println(quot;ii = quot; ii);

}

}

}

What is the result?

  1. ii = 1 ii = 2

  2. Compilation fails

  3. The program prints nothing

  4. The program goes into an infinite loop with no output

  5. The program goes to an infinite loop outputting: ii =1

ii = 1

Answer: B

Explanation: The while statement is incorrect. It has the syntax of a for statement.

The while statement continually executes a block of statements while a particular condition is true. Its syntax can be expressed as:

while (expression) { statement(s)

}

The while statement evaluates expression, which must return a boolean value. If the expression evaluates to true, the while statement executes the statement(s) in the while block. The while statement continues testing the expression and executing its block until the expression evaluates to false.

Reference: The while and do-while Statements

Question No: 46

Given:

Ensurepass 2018 PDF and VCE

What is result?

  1. Successful

  2. Unsuccessful

  3. Compilation fails

  4. An exception is thrown at runtime

Answer: C

Question No: 47

TION NO: 77

Given:

public class Main {

public static void main(String[] args) { try {

doSomething();

}

catch (SpecialException e) { System.out.println(e);

}}

static void doSomething() { int [] ages = new int[4]; ages[4] = 17; doSomethingElse();

}

static void doSomethingElse() {

throw new SpecialException(quot;Thrown at end of doSomething() methodquot;); }

}

What is the output?

  1. SpecialException: Thrown at end of doSomething() method

  2. Error in thread quot;mainquot; java.lang. ArrayIndexOutOfBoundseror

  3. Exception inthread quot;mainquot; java.lang.ArrayIndexOutOfBoundsException: 4 at Main.doSomething(Main.java:12)

    at Main.main(Main.java:4)

  4. SpecialException: Thrown at end of doSomething() method at Main.doSomethingElse(Main.java:16)

at Main.doSomething(Main.java:13) at Main.main(Main.java:4)

Answer: C Explanation:

The following line causes a runtime exception (as the index is out of bounds): ages[4] = 17;

A runtime exception is thrown as anArrayIndexOutOfBoundsException.

Note: The third kind of exception (compared to checked exceptions and errors) is the runtime exception. These are exceptional conditions that are internal to the application, and that the application usually cannot anticipate or recover from. These usually indicate programming bugs, such as logic errorsor improper use of an API.

Runtime exceptionsare not subjectto the Catch or Specify Requirement. Runtime exceptions are those indicated byRuntimeExceptionand its subclasses.

Question No: 48

Given:

Ensurepass 2018 PDF and VCE

What is the result?

  1. Marrown String out of limits JesOran

  2. Marrown String out of limits Array out of limits

  3. Marrown String out of limits

  4. Marrown NanRed JesOran

Answer: A

Question No: 49

Given the for loop construct:

for ( expr1 ; expr2 ; expr3 ) { statement;

}

Which two statements aretrue?

  1. This is not the only valid for loop construct; there exits another form of for loop constructor.

  2. The expression expr1 is optional. it initializes the loop and is evaluated once, as the loop begin.

  3. When expr2 evaluates to false, the loop terminates. It is evaluated only after each iteration through the loop.

  4. The expression expr3 must be present. It is evaluated after each iteration through the loop.

Answer: B,C Explanation:

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#39;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.

Question No: 50

Given the class definitions:

Ensurepass 2018 PDF and VCE

And the code fragment of the main() method,

Ensurepass 2018 PDF and VCE

What is the result?

  1. Java Java Java

  2. Java Jeve va

  3. Java Jeve ve

  4. Compilation fails

Answer: D

100% Ensurepass Free Download!
Download Free Demo:1z0-803 Demo PDF
100% Ensurepass Free Guaranteed!
Download 2018 EnsurePass 1z0-803 Full Exam PDF and VCE

EnsurePass ExamCollection Testking
Lowest Price Guarantee Yes No No
Up-to-Dated Yes No No
Real Questions Yes No No
Explanation Yes No No
PDF VCE Yes No No
Free VCE Simulator Yes No No
Instant Download Yes No No

Leave a Comment

(0 Comments)

Your email address will not be published. Required fields are marked *