Tips For 100% Pass Exam 1Z0-803: PassLeader are providing updated and guaranteed 1Z0-803 169q braindumps for your Oracle 1Z0-803 Exam, we ensure the 1Z0-803 169q exam questions are the latest, and will help you passing exam easily. Visit passleader.com and get the free 1Z0-803 169q vce and pdf dumps with free VCE Player.
Vendor: Oracle
Exam Code: 1Z0-803
Exam Name: Java SE 7 Programmer I
QUESTION 106
Given:
1. interface Pet { }
2. class Dog implements Pet { }
3. 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();
Answer: ADE
QUESTION 107
Given the code fragment:
StringBuilder sb = new StringBuilder();
sb.append("World");
Which 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);
Answer: A
QUESTION 108
Given:
package pkg1;
class Bb { }
public class Ee {
private Ee() { }
}
package pkg2;
final class Ww;
package pkg3;
public abstract class Dd { void m() { } }
And,
1. package pkg4;
2. import pkg1.*;
3. import pkg2.*;
4. import pkg3.*;
5. // insert a class definition here
Which two class definitions, when inserted independently at line 5, enable the code to compile?
A. class Cc extends Bb { }
B. class Cc extends Ww { }
C. class Cc extends Ee { }
D. class Cc extends Dd { }
Answer: AD
QUESTION 109
Given:
1. public class Simple {
2. public float price;
3. public static void main (String [] args) {
4. Simple price = new Simple();
5. price = 4;
6. }
7. }
Which will make this code compile and run?
A. Change line 5 to:
price = 4f;
B. Change line 5 to:
price.price = 4;
C. Change line 5 to:
price = (float) 4;
D. Change line 5 to:
price = (Simple) 4;
E. The code compiles and runs properly; no changes are necessary.
Answer: B
QUESTION 110
Given the code fragment:
class Student {
String name;
int age;
}
And,
1. public class Test {
2. public static void main (String[] args) {
3. Student s1 = new Student();
4. Student s2 = new Student();
5. Student s3 = new Student();
6. s1 = s3;
7. s3 = s2;
8. s2 = null;
9. }
10. }
Which statement is true?
A. After line 8, three objects are eligible for garbage collection.
B. After line 8, two objects are eligible for garbage collection.
C. After line 8, one object is eligible for garbage collection.
D. After line 8, none of the objects are eligible for garbage collection.
Answer: A
QUESTION 111
Given:
public class Test {
public static void main (String[] args) {
char[] arr = {97, ‘\t’, ‘e’, ‘\n’, ‘i’, ‘\t’, ‘o’};
for (char var: arr) {
System.out.print(var);
}
System.out.print("\nThe length is :" + arr.length);
}
}
What is the result?
A. a e
The length is : 2
B. a e
i o
The length is : 4
C. aeio
The length is : 4
D. a e
i o
The length is : 7
E. Compilation fails.
Answer: D
QUESTION 112
Given the class definitrions:
class Shape { }
class Square extends Shape { }
Given the variable declarations:
Shape shape1 = null;
Square square1 = null;
Which four compile?
A. shape1 = (Square) new Square();
B. shape1 = new Square();
C. square1 = (Square) new Shape();
D. square1 = new Shape();
E. square1 = new Square();
shape1 = square1;
F. shape1 = new Shape();
square1 = shape1;
Answer: ABCE
http://www.passleader.com/1z0-803.html
QUESTION 113
Given the code fragments:
9. class Student {
10. int rollnumber;
11. String name;
12. List courses = new ArrayList();
13. // insert code fragment here
14. public String toString() {
15. return rollnumber + " : " + name + " : " + courses;
16. }
17. }
And,
public class Test {
public static void main (String[] args) {
List cs = new ArrayList();
cs.add("Java");
cs.add("C");
Student s = new Student(123,"Fred",cs);
System.out.println(s);
}
}
Which code fragment, when inserted at line 13, enables class Test to print 123 : Fred : [Java, C] ?
A. private Student(int i, String name, List cs) {
/* initialization code goes here */
}
B. public void Student(int i, String name, List cs) {
/* initialization code goes here */
}
C. Student(int i, String name, List cs) {
/* initialization code goes here */
}
D. Student(int i, String name, ArrayList cs) {
/* initialization code goes here */
}
Answer: C
QUESTION 114
Given:
public class Test2 {
public static void main (String[] args) {
int ar1[] = {2, 4, 6, 8};
int ar2[] = {1, 3, 5, 7, 9};
ar2 = ar1;
for (int e2 : ar2) {
System.out.print(" " + e2);
}
}
}
What is the result?
A. 2 4 6 8
B. 2 4 6 8 9
C. 1 3 5 7
D. 1 3 5 7 9
E. Compilation fails
F. An exception is thrown at runtime
Answer: A
QUESTION 115
Given:
public class Test2 {
public static void doChange(int[] arr) {
for (int pos=0; pos < arr.length; pos++) {
arr[pos] = arr[pos] + 1;
}
}
public static void main (String[] args) {
int[] arr = {10, 20, 30};
doChange(arr);
for (int x : arr) {
System.out.print(x + ", ");
}
doChange(arr);
System.out.print(arr[0] + ", " + arr[1] + ", " + arr[2]); }
}
What is the result?
A. 11, 21, 31, 11, 21, 31
B. 11, 21, 31, 12, 22, 32
C. 12, 22, 32, 12, 22, 32
D. 10, 20, 30, 10, 20, 30
Answer: B
QUESTION 116
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 117
Given:
public class Natural {
private int i;
void disp() {
while (i <= 5) {
for (int i = 1; i <= 5; ) {
System.out.print(i + " ");
i++;
}
i++;
}
}
public static void main (String args[]) {
new Natural().disp();
}
}
A. Prints 1 2 3 4 5 once
B. Prints 1 3 5 once
C. Prints 1 2 3 4 5 five times
D. Prints 1 2 3 4 5 six times
E. Compilation fails
Answer: D
QUESTION 118
Given:
public class CheckIt {
public static void main (String[] args) {
if (doCheck()) {
System.out.print("square ");
}
System.out.print("…");
}
public static int doCheck() {
return 0;
}
}
A. square …
B. …
C. Compilation fails.
D. An exception is through at runtime.
Answer: C
QUESTION 119
Given:
public class Test {
}
From which class does the Java compiler implicitly derive Test?
A. Object
B. Class
C. an anonymous class
D. Objects
Answer: A
QUESTION 120
Given:
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
Answer: CD
http://www.passleader.com/1z0-803.html