2014 Latest Oracle 1Z0-851 Exam Demo Free Download!

QUESTION 1
Given a pre-generics implementation of a method:
public static int sum(List list) {
int sum = 0;
for ( Iterator iter = list.iterator(); iter.hasNext(); ) {
int i = ((Integer)iter.next()).intValue();
sum += i;
}
return sum;
}
What three changes allow the class to be used with generics and avoid an unchecked warning? (Choose three.)

A.    Remove line 14.
B.    Replace line 14 with “int i = iter.next();”.
C.    Replace line 13 with “for (int i : intList) {“.
D.    Replace line 13 with “for (Iterator iter : intList) {“.
E.    Replace the method declaration with “sum(List<int> intList)”.
F.    Replace the method declaration with “sum(List<Integer> intList)”.

Answer: ACF

QUESTION 2
A programmer has an algorithm that requires a java.util.List that provides an efficient implementation of add(0, object), but does NOT need to support quick random access. What supports these requirements?

A.    java.util.Queue
B.    java.util.ArrayList
C.    java.util.LinearList
D.    java.util.LinkedList

Answer: D

QUESTION 3
Given:
// insert code here
private N min, max;
public N getMin() { return min; }
public N getMax() { return max; }
public void add(N added) {
if (min == null || added.doubleValue() < min.doubleValue())
min = added;
if (max == null || added.doubleValue() > max.doubleValue())
max = added;
}
}
Which two, inserted at line 11, will allow the code to compile? (Choose two.)

A.    public class MinMax<?> {
B.    public class MinMax<? extends Number> {
C.    public class MinMax<N extends Object> {
D.    public class MinMax<N extends Number> {
E.    public class MinMax<? extends Object> {
F.    public class MinMax<N extends Integer> {

Answer: DF

QUESTION 4
Given:
import java.util.*;
public class Explorer2 {
public static void main(String[] args) {
TreeSet<Integer> s = new TreeSet<Integer>();
TreeSet<Integer> subs = new TreeSet<Integer>();
for(int i = 606; i < 613; i++)
if(i%2 == 0) s.add(i);
subs = (TreeSet)s.subSet(608, true, 611, true);
s.add(629);
System.out.println(s + ” ” + subs);
}
}
What is the result?

A.    Compilation fails.
B.    An exception is thrown at runtime.
C.    [608, 610, 612, 629] [608, 610]
D.    [608, 610, 612, 629] [608, 610, 629]
E.    [606, 608, 610, 612, 629] [608, 610]
F.    [606, 608, 610, 612, 629] [608, 610, 629]

Answer: E

QUESTION 5
Given:
public class Score implements Comparable<Score> {
private int wins, losses;
public Score(int w, int l) { wins = w; losses = l; }
public int getWins() { return wins; }
public int getLosses() { return losses; }
public String toString() {
return “<” + wins + “,” + losses + “>”;
}
// insert code here
}
Which method will complete this class?

A.    public int compareTo(Object o){/*more code here*/}
B.    public int compareTo(Score other){/*more code here*/}
C.    public int compare(Score s1,Score s2){/*more code here*/}
D.    public int compare(Object o1,Object o2){/*more code here*/}

Answer: B

QUESTION 6
Given:
public class Person {
private name;
public Person(String name) {
this.name = name;
}
public int hashCode() {
return 420;
}
}
Which statement is true?

A.    The time to find the value from HashMap with a Person key depends on the size of the map.
B.    Deleting a Person key from a HashMap will delete all map entries for all keys of type Person.
C.    Inserting a second Person object into a HashSet will cause the first Person object to be removed
as a duplicate.
D.    The time to determine whether a Person object is contained in a HashSet is constant and does
NOT depend on the size of the map.

Answer: A

QUESTION 7
Given:
import java.util.*;
public class SortOf {
public static void main(String[] args) {
ArrayList<Integer> a = new ArrayList<Integer>();
a.add(1); a.add(5); a.add(3);
Collections.sort(a);
a.add(2);
Collections.reverse(a);
System.out.println(a);
}
}
What is the result?

A.    [1, 2, 3, 5]
B.    [2, 1, 3, 5]
C.    [2, 5, 3, 1]
D.    [5, 3, 2, 1]
E.    [1, 3, 5, 2]
F.    Compilation fails.
H.    An exception is thrown at runtime.

Answer: C

QUESTION 8
Given
public interface Status {
/* insert code here */ int MY_VALUE = 10;
}
Which three are valid on line 12? (Choose three.)

A.    final
B.    static
C.    native
D.    public
E.    private
F.    abstract
G.    protected

Answer: ABD

QUESTION 9
Given:
class Atom {
Atom() { System.out.print(“atom “); }
}
class Rock extends Atom {
Rock(String type) { System.out.print(type); }
}
public class Mountain extends Rock {
Mountain() {
super(“granite “);
new Rock(“granite “);
}
public static void main(String[] a) { new Mountain(); }
}
What is the result?

A.    Compilation fails.
B.    atom granite
C.    granite granite
D.    atom granite granite
E.    An exception is thrown at runtime.
F.    atom granite atom granite

Answer: F

QUESTION 10
Click the Exhibit button. Which three statements are true? (Choose three.)
 clip_image001
A.    Compilation fails.
B.    The code compiles and the output is 2.
C.    If lines 16, 17 and 18 were removed, compilation would fail.
D.    If lines 24, 25 and 26 were removed, compilation would fail.
E.    If lines 16, 17 and 18 were removed, the code would compile and the output would be 2.
F.    If lines 24, 25 and 26 were removed, the code would compile and the output would be 1.

Answer: BEF

QUESTION 11
Given:
class Line {
public class Point { public int x,y;}
public Point getPoint() { return new Point(); }
}
class Triangle {
public Triangle() {
// insert code here
}
}
Which code, inserted at line 16, correctly retrieves a local instance of a Point object?

A.    Point p = Line.getPoint();
B.    Line.Point p = Line.getPoint();
C.    Point p = (new Line()).getPoint();
D.    Line.Point p = (new Line()).getPoint();

Answer: D

QUESTION 12
Given:
class Alpha {
public void foo() { System.out.print(“Afoo “); }
}
public class Beta extends Alpha {
public void foo() { System.out.print(“Bfoo “); }
public static void main(String[] args) {
Alpha a = new Beta();
Beta b = (Beta)a;
a.foo();
b.foo();
}
}
What is the result?

A.    Afoo Afoo
B.    Afoo Bfoo
C.    Bfoo Afoo
D.    Bfoo Bfoo
E.    Compilation fails.
H.    An exception is thrown at runtime.

Answer: D

QUESTION 13
Click the Exhibit button. Which statement is true about the classes and interfaces in the exhibit?
 clip_image001[4]

A.    Compilation will succeed for all classes and interfaces.
B.    Compilation of class C will fail because of an error in line 2.
C.    Compilation of class C will fail because of an error in line 6.
D.    Compilation of class AImpl will fail because of an error in line 2.

Answer: C

QUESTION 14
Which two code fragments correctly create and initialize a static array of int elements? (Choose two.)

A.    static final int[] a = { 100,200 };
B.    static final int[] a; static { a=new int[2]; a[0]=100; a[1]=200; }
C.    static final int[] a = new int[2]{ 100,200 };
D.    static final int[] a; static void init() { a = new int[3]; a[0]=100; a[1]=200; }

Answer: AB

QUESTION 15
Given:
interface Foo { int bar(); }
public class Sprite {
public int fubar( Foo foo ) { return foo.bar(); }
public void testFoo() {
fubar(
// insert code here
);
}
}
Which code, inserted at line 15, allows the class Sprite to compile?

A.    Foo { public int bar() { return 1; }
B.    new Foo { public int bar() { return 1; }
C.    new Foo() { public int bar() { return 1; }
D.    new class Foo { public int bar() { return 1; }

Answer: C

QUESTION 16
Given:
class Alligator {
public static void main(String[] args) {
int []x[] = {{1,2}, {3,4,5}, {6,7,8,9}};
int [][]y = x;
System.out.println(y[2][1]);
}
}
What is the result?

A.    2
B.    3
C.    4
D.    6
E.    7
F.    Compilation fails.

Answer: E
Passing your Oracle 1Z0-851 Exam by using the latest 1Z0-851 Exam Dump Full Version: http://www.braindump2go.com/1z0-851.html

         

Categories Oracle Exam

Post Author: mavis

Categories

Archives

Cisco Exam Dumps Download

200-301 PDF and VCE Dumps

200-901 PDF and VCE Dumps

350-901 PDF and VCE Dumps

300-910 PDF and VCE Dumps

300-915 PDF and VCE Dumps

300-920 PDF and VCE Dumps

350-401 PDF and VCE Dumps

300-410 PDF and VCE Dumps

300-415 PDF and VCE Dumps

300-420 PDF and VCE Dumps

300-425 PDF and VCE Dumps

300-430 PDF and VCE Dumps

300-435 PDF and VCE Dumps

350-401 PDF and VCE Dumps

350-401 PDF and VCE Dumps

350-801 PDF and VCE Dumps

300-810 PDF and VCE Dumps

300-815 PDF and VCE Dumps

300-820 PDF and VCE Dumps

300-835 PDF and VCE Dumps

350-801 PDF and VCE Dumps

200-201 PDF and VCE Dumps

350-601 PDF and VCE Dumps

300-610 PDF and VCE Dumps

300-615 PDF and VCE Dumps

300-620 PDF and VCE Dumps

300-625 PDF and VCE Dumps

300-635 PDF and VCE Dumps

600-660 PDF and VCE Dumps

350-601 PDF and VCE Dumps

352-001 PDF and VCE Dumps

350-701 PDF and VCE Dumps

300-710 PDF and VCE Dumps

300-715 PDF and VCE Dumps

300-720 PDF and VCE Dumps

300-725 PDF and VCE Dumps

300-730 PDF and VCE Dumps

300-735 PDF and VCE Dumps

350-701 PDF and VCE Dumps

350-501 PDF and VCE Dumps

300-510 PDF and VCE Dumps

300-515 PDF and VCE Dumps

300-535 PDF and VCE Dumps

350-501 PDF and VCE Dumps

010-151 PDF and VCE Dumps

100-490 PDF and VCE Dumps

810-440 PDF and VCE Dumps

820-445 PDF and VCE Dumps

840-450 PDF and VCE Dumps

820-605 PDF and VCE Dumps

700-805 PDF and VCE Dumps

700-070 PDF and VCE Dumps

600-455 PDF and VCE Dumps

600-460 PDF and VCE Dumps

500-173 PDF and VCE Dumps

500-174 PDF and VCE Dumps

200-401 PDF and VCE Dumps

644-906 PDF and VCE Dumps

600-211 PDF and VCE Dumps

600-212 PDF and VCE Dumps

600-210 PDF and VCE Dumps

600-212 PDF and VCE Dumps

700-680 PDF and VCE Dumps

500-275 PDF and VCE Dumps

500-285 PDF and VCE Dumps

600-455 PDF and VCE Dumps

600-460 PDF and VCE Dumps

Microsoft Exams Will Be Retired

AZ-103(retiring August 31, 2020)

AZ-203(retiring August 31, 2020)

AZ-300(retiring August 31, 2020)

AZ-301(retiring August 31, 2020)

77-419(retiring June 30, 2020)

70-333(retiring January 31, 2021)

70-334(retiring January 31, 2021)

70-339(retiring January 31, 2021)

70-345(retiring January 31, 2021)

70-357(retiring January 31, 2021)

70-410(retiring January 31, 2021)

70-411(retiring January 31, 2021)

70-412(retiring January 31, 2021)

70-413(retiring January 31, 2021)

70-414(retiring January 31, 2021)

70-417(retiring January 31, 2021)

70-461(retiring January 31, 2021)

70-462(retiring January 31, 2021)

70-463(retiring January 31, 2021)

70-464(retiring January 31, 2021)

70-465(retiring January 31, 2021)

70-466(retiring January 31, 2021)

70-467(retiring January 31, 2021)

70-480(retiring January 31, 2021)

70-483(retiring January 31, 2021)

70-486(retiring January 31, 2021)

70-487(retiring January 31, 2021)

70-537(retiring January 31, 2021)

70-705(retiring January 31, 2021)

70-740(retiring January 31, 2021)

70-741(retiring January 31, 2021)

70-742(retiring January 31, 2021)

70-743(retiring January 31, 2021)

70-744(retiring January 31, 2021)

70-745(retiring January 31, 2021)

70-761(retiring January 31, 2021)

70-762(retiring January 31, 2021)

70-764(retiring January 31, 2021)

70-765(retiring January 31, 2021)

70-767(retiring January 31, 2021)

70-768(retiring January 31, 2021)

70-777(retiring January 31, 2021)

70-778(retiring January 31, 2021)

70-779(retiring January 31, 2021)

MB2-716(retiring January 31, 2021)

MB6-894(retiring January 31, 2021)

MB6-897(retiring January 31, 2021)

MB6-898(retiring January 31, 2021)