[Premium](100% Valid) Free Trying Passleader Oracle 1Z0-803 Study Materials With New Questions (1-15)

Info For 1Z0-803 Exam 100% Pass: PassLeader provides you with the newest 1Z0-803 exam questions updated in recent days to prepare your 1Z0-803 certification exams. Our best 1Z0-803 exam dumps will offer you the newest questions and answers with premium VCE and PDF format to download. And PassLeader also offer you the latest free version VCE Player!

PassLeader 1Z0-803 Braindumps[15]

Vendor: Oracle
Exam Code: 1Z0-803
Exam Name: Java SE 7 Programmer I

QUESTION 1
Given:
import java.io.IOException;
public class Y {
public static void main(String[] args) {
try {
doSomething();
}
catch (RuntimeException e) {
System.out.println(e);
}
}
static void doSomething() {
if (Math.random() > 0.5) throw new IOException();
throw new RuntimeException();
}
}
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

Answer: CD

QUESTION 2
Given:
class X {
String str = “default”;
X(String s) { str = s;}
void print () { System.out.println(str); }
public static void main(String[] args) {
new X(“hello”).print();
}
}
What is the result?

A.    hello
B.    default
C.    Compilation fails
D.    The program prints nothing
E.    An exception is thrown at run time

Answer: A

QUESTION 3
Given:
public class SampleClass {
public static void main(String[] args) {
AnotherSampleClass asc = new AnotherSampleClass();
SampleClass sc = new SampleClass();
// TODO code application logic here
}
}
class AnotherSampleClass extends SampleClass {
}
Which statement, when inserted into line “// TODO code application logic here “, is valid change?

A.    asc = sc;
B.    sc = asc;
C.    asc = (object) sc;
D.    asc= sc.clone ()

Answer: B

QUESTION 4
Given the code fragment:
System.out.println(“Result: ” + 2 + 3 + 5);
System.out.println(“Result: ” + 2 + 3 * 5);
What is the result?

A.    Result: 10
Result: 30
B.    Result: 10
Result: 25
C.    Result: 235
Result: 215
D.    Result: 215
Result: 215
E.    Compilation fails

Answer: C

QUESTION 5
Which code fragment is illegal?

A.    class Base1{
abstract class Abs1{ }}
B.    abstract class Abs1{
void doit () { }
}
C.    class Basel {
abstract class Abs1extends Basel {
D.    abstract int var1= 89;

Answer: D

QUESTION 6
Given the code fragment:
int a = 0;
a++;
System.out.println(a++);
System.out.println(a);
What is the result?

A.    1
2
B.    0
1
C.    1
1
D.    2
2

Answer: A

QUESTION 7
Given:
public class x{
public static void main (string [] args){
String theString = “Hello World”;
System.out.println(theString.charAt(11));
}
}
What is the result?

A.    There is no output
B.    d is output
C.    A StringIndexOutOfBoundsException is thrown at runtime
D.    An ArrayIndexOutOfBoundsException is thrown at runtime
E.    A NullPointException is thrown at runtime
F.    A StringArrayIndexOutOfBoundsException is thrown at runtime

Answer: C


PassLeader 1Z0-803 Braindumps[24]

http://www.passleader.com/1z0-803.html

QUESTION 8
Given a java source file:
class x {
x () {}
private void one () {}
}
public class Y extends x {
Y () {}
private void two () {one();}
public static void main (string [] args) {
new Y().two ();
}
}
What changes will make this code compile?

A.    adding the public modifier to the declaration ofclass x
B.    adding the protected modifier to the x()constructor
C.    changing the private modifier on the declarationof the one() method to protected
D.    removing the Y () constructor
E.    removing the private modifier from the two () method

Answer: C

QUESTION 9
Given:
#1
package handy.dandy;
public class KeyStroke {
public void typeExclamation() {
System.out.println(“!”)
}
}
#2
package handy; /* Line 1 */
public class Greet { /* Line 2 */
public static void main(String[] args) { /* Line 3 */
String greeting = “Hello”; /* Line 4 */
System.out.print(greeting); /* Line 5 */
Keystroke stroke = new Keystroke; /* Line 6 */
stroke.typeExclamation(); /* Line 7 */
} /* Line 8 */
} /* Line 9 */
What three modifications, made independently, made to class greet, enable the code to compile and run?

A.    Line 6 replaced with handy.dandy.keystroke stroke = new KeyStroke ( );
B.    Line 6 replaced with handy.*.KeyStroke = new KeyStroke ( );
C.    Line 6 replaced withhandy.dandy.KeyStroke Stroke = new handy.dandy.KeyStroke();
D.    import handy.*;addedbeforeline 1
E.    import handy.dandy.*;added after line 1
F.    import handy.dandy,KeyStroke;added after line 1
G.    import handy.dandy.KeyStroke.typeException(); added before line 1

Answer: CEF

QUESTION 10
Given:
String message1 = “Wham bam!”;
String message2 = new String(“Wham bam!”);
if (message1 == message2)
System.out.println(“They match”);
if (message1.equals(message2))
System.out.println(“They really match”);
What is the result?

A.    They match
They really match
B.    They really match
C.    They match
D.    Nothing Prints
E.    They really match
They really match

Answer: B

QUESTION 11
Given:
public class Speak { /* Line 1 */
public static void main(String[] args) { /* Line 2 */
Speak speakIT = new Tell(); /* Line 3 */
Tell tellIt = new Tell(); /* Line 4 */
speakIT.tellItLikeItIs(); /* Line 5 */
(Truth)speakIt.tellItLikeItIs(); /* Line 6 */
((Truth)speakIt).tellItLikeItIs(); /* Line 7 */
tellIt.tellItLikeItIs(); /* Line 8 */
(Truth)tellIt.tellItLikeItIs(); /* Line 9 */
((Truth)tellIt).tellItLikeItIs(); /* Line 10 */
}
}
class Tell extends Speak implements Truth {
public void tellItLikeItIs() {
System.out.println(“Right on!”);
}
}
interface Truth { public void tellItLikeItIs()};
Which three lines will compile and output “right on!”?

A.    Line 5
B.    Line 6
C.    Line 7
D.    Line 8
E.    Line 9
F.    Line 10

Answer: CDF

QUESTION 12
Given the code fragment:
String h1 = “Bob”;
String h2 = new String (“Bob”);
What is the best way to test that the values of h1 and h2 are the same?

A.    if (h1 == h2)
B.    if (h1.equals(h2))
C.    if (h1 = = h2)
D.    if (h1.same(h2))

Answer: B

QUESTION 13
Which two are valid declarations of a two-dimensional array?

A.    int[][] array2D;
B.    int[2][2] array2D;
C.    int array2D[];
D.    int[] array2D[];
E.    int[][] array2D[];

Answer: AD

QUESTION 14
Given the code fragment:
System.out.println (“Result:” +3+5);
System.out.println (“result:” + (3+5));
What is the result?

A.    Result: 8
Result: 8
B.    Result: 35
Result: 8
C.    Result: 8
Result: 35
D.    Result: 35
Result: 35

Answer: B

QUESTION 15
Given:
public class Main {
public static void main(String[] args) throws Exception {
doSomething();
}
private static void doSomething() throws Exception {
System.out.println(“Before if clause”);
if (Math.random() > 0.5) {
throw new Exception();
}
System.out.println (“After if clause”);
}
}
Which two are possible outputs?

A.    Before if clause
Exception in thread “main” java.lang.Exception
AtMain.doSomething (Main.java:8)
At Main.main (Main.java:3)
B.    Before if clause
Exceptionin thread “main” java.lang.Exception
At Main.doSomething (Main.java:8)
At Main.main (Main.java:3)
After if clause
C.    Exception in thread “main” java.lang.Exception
At Main.doSomething (Main.java:8)
At Main.main (Main.java:3)
D.    Before if clause
After if clause

Answer: AD


PassLeader 1Z0-803 Braindumps[7]

http://www.passleader.com/1z0-803.html