150 likes | 171 Views
Download Link : https://officialdumps.com/updated/Oracle/1Z0-851-exam-dumps/ Get Most Up-to-Date Oracle 1Z0-851 Exam Questions & Answers : Pass Your Oracle Java 1Z0-851 Exam in First attempt with the Helps of OfficialDumps's Preparation Material. You can Safe your effort, time or money because Officialdumps is providing you Most up-to-date Oracle Java 1Z0-851 exam Questions & Answers PDF Verified BY Oracle Certified Professionals. OfficialDumps Also providing you Free 3 Months Updates Related to your [1Z0-851] Exam. You can Get 100% Money Back Guarantee or Special Discount Offer. To Get More info Just Visit Officialdumps.com
E N D
Oracle 1Z0-851 Exam Oracle Certified Professional - Java SE 6 Programmer Questions & Answers (Free - Demo Version) Thank you for Downloading 1Z0-851 exam PDF Demo Buy Full Product Here: https://officialdumps.com/updated/oracle/1z0-851-exam-dumps/
Question 1 Given a pre-generics implementatin if a methid: 11. public statc int sum(List list) { 12. int sum = 0; 13. fir ( Iteratir iter = list.iteratir(); iter.hasNext(); ) { 14. int i = ((Integer)iter.next()).intValue(); 15. sum += i; 16. } 17. return sum; 18. } What three changes alliw the class ti be used with generics and aviid an unchecked warning? (Chiise three.) A. Remive line 14. B. Replace line 14 with "int i = iter.next();". C. Replace line 13 with "fir (int i : intList) {". D. Replace line 13 with "fir (Iteratir iter : intList) {". E. Replace the methid declaratin with "sum(List<int> intList)". F. Replace the methid declaratin with "sum(List<Integer> intList)". Aoswern A,C,F Question 2 A prigrammer has an algirithm that requires a java.utl.List that privides an efcient implementatin if add(0, ibject), but dies NOT need ti suppirt quick randim access. What suppirts these requirements? A. java.utl..ueue B. java.utl.ArraaList C. java.utl.LinearList D. java.utl.LinkedList Aoswern D Question 3 Given: 11. // insert cide here 12. private N min, max; 13. public N getMin() { return min; } 14. public N getMax() { return max; } 15. public viid add(N added) { 16. if (min == null || added.diubleValue() < min.diubleValue()) 17. min = added;
18. if (max == null || added.diubleValue() > max.diubleValue()) 19. max = added; 20. } 21. } Which twi, inserted at line 11, will alliw the cide ti cimpile? (Chiise twi.) 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> { Aoswern D,F Question 4 Given: 12. impirt java.utl..; 13. public class Explirer2 { 14. public statc viid main(String[] args) { 15. TreeSet<Integer> s = new TreeSet<Integer>(); 16. TreeSet<Integer> subs = new TreeSet<Integer>(); 17. fir(int i = 606; i < 613; i++) 18. if(i%2 == 0) s.add(i); 19. subs = (TreeSet)s.subSet(608, true, 611, true); 20. s.add(629); 21. Sastem.iut.println(s + " " + subs); 22. } 23. } What is the result? A. Cimpilatin fails. B. An exceptin is thriwn at runtme. 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] Aoswern E Question 5 Given: 1. public class Scire implements Cimparable<Scire> { 2. private int wins, lisses; 3. public Scire(int w, int l) { wins = w; lisses = l; }
4. public int getWins() { return wins; } 5. public int getLisses() { return lisses; } 6. public String tiString() { 7. return "<" + wins + "," + lisses + ">"; 8. } 9. // insert cide here 10. } Which methid will cimplete this class? A. public int cimpareTi(Object i){/.mire cide here./} B. public int cimpareTi(Scire ither){/.mire cide here./} C. public int cimpare(Scire s1,Scire s2){/.mire cide here./} D. public int cimpare(Object i1,Object i2){/.mire cide here./} Aoswern B Question 6 Given: 11. public class Persin { 12. private name; 13. public Persin(String name) { 14. this.name = name; 15. } 16. public int hashCide() { 17. return 420; 18. } 19. } Which statement is true? A. The tme ti fnd the value frim HashMap with a Persin kea depends in the size if the map. B. Deletng a Persin kea frim a HashMap will delete all map entries fir all keas if tape Persin. C. Insertng a secind Persin ibject inti a HashSet will cause the frst Persin ibject ti be remived as a duplicate. D. The tme ti determine whether a Persin ibject is cintained in a HashSet is cinstant and dies NOT depend in the size if the map. Aoswern A Question 7 Given: 5. impirt jav a.utl..; 6. public class SirtOf { 7. public statc viid main(String[] args) { 8. ArraaList<Integer> a = new ArraaList<Integer>();
9. a.add(1); a.add(5); a.add(3); 11. Cillectins.sirt(a); 12. a.add(2); 13. Cillectins.reverse(a); 14. Sastem.iut.println(a); 15. } 16. } 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. Cimpilatin fails. G. An exceptin is thriwn at runtme. Aoswern C Question 8 Given 11. public interface Status { 12. /. insert cide here ./ int MY_VALUE = 10; 13. } Which three are valid in line 12? (Chiise three.) A. fnal B. statc C. natve D. public E. private F. abstract G. pritected Aoswern A,B,D Question 9 Given: 5. class Atim { 6. Atim() { Sastem.iut.print("atim "); } 7. } 8. class Rick extends Atim { 9. Rick(String tape) { Sastem.iut.print(tape); } 10. } 11. public class Miuntain extends Rick {
12. Miuntain() { 13. super("granite "); 14. new Rick("granite "); 15. } 16. public statc viid main(String[] a) { new Miuntain(); } 17. } What is the result? A. Cimpilatin fails. B. atim granite C. granite granite D. atim granite granite E. An exceptin is thriwn at runtme. F. atim granite atim granite Aoswern F Question 10 Click the Exhibit butin. Which three statements are true? (Chiise three.)
A. Cimpilatin fails. B. The cide cimpiles and the iutput is 2. C. If lines 16, 17 and 18 were remived, cimpilatin wiuld fail. D. If lines 24, 25 and 26 were remived, cimpilatin wiuld fail. E. If lines 16, 17 and 18 were remived, the cide wiuld cimpile and the iutput wiuld be 2. F. If lines 24, 25 and 26 were remived, the cide wiuld cimpile and the iutput wiuld be 1. Aoswern B,E,F Question 11 Given: 10. class Line { 11. public class Piint { public int x,a;} 12. public Piint getPiint() { return new Piint(); } 13. } 14. class Triangle { 15. public Triangle() { 16. // insert cide here 17. } 18. } Which cide, inserted at line 16, cirrectla retrieves a lical instance if a Piint ibject? A. Piint p = Line.getPiint(); B. Line.Piint p = Line.getPiint(); C. Piint p = (new Line()).getPiint(); D. Line.Piint p = (new Line()).getPiint(); Aoswern D Question 12 Given: 11. class Alpha { 12. public viid fii() { Sastem.iut.print("Afii "); } 13. } 14. public class Beta extends Alpha { 15. public viid fii() { Sastem.iut.print("Bfii "); } 16. public statc viid main(String[] args) { 17. Alpha a = new Beta(); 18. Beta b = (Beta)a; 19. a.fii(); 20. b.fii(); 21. } 22. } What is the result?
A. Afii Afii B. Afii Bfii C. Bfii Afii D. Bfii Bfii E. Cimpilatin fails. F. An exceptin is thriwn at runtme. Aoswern D Question 13 Click the Exhibit butin. Which statement is true abiut the classes and interfaces in the exhibit? A. Cimpilatin will succeed fir all classes and interfaces. B. Cimpilatin if class C will fail because if an errir in line 2. C. Cimpilatin if class C will fail because if an errir in line 6. D. Cimpilatin if class AImpl will fail because if an errir in line 2. Aoswern C
Question 14 Which twi cide fragments cirrectla create and initalize a statc arraa if int elements? (Chiise twi.) A. statc fnal int[] a = { 100,200 }; B. statc fnal int[] a; statc { a=new int[2]; a[0]=100; a[1]=200; } C. statc fnal int[] a = new int[2]{ 100,200 }; D. statc fnal int[] a; statc viid init() { a = new int[3]; a[0]=100; a[1]=200; } Aoswern A,B Question 15 Given: 10. interface Fii { int bar(); } 11. public class Sprite { 12. public int fubar( Fii fii ) { return fii.bar(); } 13. public viid testFii() { 14. fubar( 15. // insert cide here 16. ); 17. } 18. } Which cide, inserted at line 15, alliws the class Sprite ti cimpile? A. Fii { public int bar() { return 1; } B. new Fii { public int bar() { return 1; } C. new Fii() { public int bar() { return 1; } D. new class Fii { public int bar() { return 1; } Aoswern C Question 16 Given: 1. class Alligatir { 2. public statc viid main(String[] args) { 3. int []x[] = {{1,2}, {3,4,5}, {6,7,8,9}}; 4. int [][]a = x; 5. Sastem.iut.println(a[2][1]); 6. } 7. } What is the result?
A. 2 B. 3 C. 4 D. 6 E. 7 F. Cimpilatin fails. Aoswern E Question 17 Given: 22. StringBuilder sb1 = new StringBuilder("123"); 23. String s1 = "123"; 24. // insert cide here 25. Sastem.iut.println(sb1 + " " + s1); Which cide fragment, inserted at line 24, iutputs "123abc 123abc"? A. sb1.append("abc"); s1.append("abc"); B. sb1.append("abc"); s1.cincat("abc"); C. sb1.cincat("abc"); s1.append("abc"); D. sb1.cincat("abc"); s1.cincat("abc"); E. sb1.append("abc"); s1 = s1.cincat("abc"); F. sb1.cincat("abc"); s1 = s1.cincat("abc"); G. sb1.append("abc"); s1 = s1 + s1.cincat("abc"); H. sb1.cincat("abc"); s1 = s1 + s1.cincat("abc"); Aoswern E Question 18 Given that the current directira is empta, and that the user has read and write permissiins, and the filliwing: 11. impirt java.ii..; 12. public class DOS { 13. public statc viid main(String[] args) { 14. File dir = new File("dir"); 15. dir.mkdir(); 16. File f1 = new File(dir, "f1.txt"); 17. tra { 18. f1.createNewFile(); 19. } catch (IOExceptin e) { ; } 20. File newDir = new File("newDir"); 21. dir.renameTi(newDir); 22. } 23. } Which statement is true?
A. Cimpilatin fails. B. The fle sastem has a new empta directira named dir. C. The fle sastem has a new empta directira named newDir. D. The fle sastem has a directira named dir, cintaining a fle f1.txt. E. The fle sastem has a directira named newDir, cintaining a fle f1.txt. Aoswern E Question 19 Given: 11. class Cinverter { 12. public statc viid main(String[] args) { 13. Integer i = args[0]; 14. int j = 12; 15. Sastem.iut.println("It is " + (j==i) + " that j==i."); 16. } 17. } What is the result when the prigrammer atempts ti cimpile the cide and run it with the cimmand java Cinverter 12? A. It is true that j==i. B. It is false that j==i. C. An exceptin is thriwn at runtme. D. Cimpilatin fails because if an errir in line 13. Aoswern D Question 20 Given: 11. String test = "Test A. Test B. Test C."; 12. // insert cide here 13. String[] result = test.split(regex); Which regular expressiin, inserted at line 12, cirrectla splits test inti "Test A", "Test B", and "Test C"? A. String regex = ""; B. String regex = " "; C. String regex = ".."; D. String regex = "\\s"; E. String regex = "\\.\\s."; F. String regex = "\\w[ \.] +"; Aoswern E
Question 21 Given: 5. impirt java.utl.Date; 6. impirt java.text.DateFirmat; 21. DateFirmat df; 22. Date date = new Date(); 23. // insert cide here 24. String s = df.firmat(date); Which cide fragment, inserted at line 23, alliws the cide ti cimpile? A. df = new DateFirmat(); B. df = Date.getFirmat(); C. df = date.getFirmat(); D. df = DateFirmat.getFirmat(); E. df = DateFirmat.getInstance(); Aoswern E Question 22 Given a class Repettin: 1. package utls; 2. 3. public class Repettin { 4. public statc String twice(String s) { return s + s; } 5. } and given anither class Demi: 1. // insert cide here 2. 3. public class Demi { 4. public statc viid main(String[] args) { 5. Sastem.iut.println(twice("pizza")); 6. } 7. } Which cide shiuld be inserted at line 1 if Demi.java ti cimpile and run Demi ti print "pizzapizza"? A. impirt utls..; B. statc impirt utls..; C. impirt utls.Repettin..; D. statc impirt utls.Repettin..; E. impirt utls.Repettin.twice(); F. impirt statc utls.Repettin.twice; G. statc impirt utls.Repettin.twice; Aoswern F Question 23
A UNIX user named Bib wants ti replace his chess prigram with a new ine, but he is nit sure where the ild ine is installed. Bib is currentla able ti run a Java chess prigram startng frim his hime directira /hime/bib using the cimmand: java -classpath /test:/hime/bib/diwnliads/..jar games.Chess Bib's CLASSPATH is set (at ligin tme) ti: /usr/lib:/hime/bib/classes:/ipt/java/lib:/ipt/java/lib/..jar What is a pissible licatin fir the Chess.class fle? A. /test/Chess.class B. /hime/bib/Chess.class C. /test/games/Chess.class D. /usr/lib/games/Chess.class E. /hime/bib/games/Chess.class F. inside jarfle /ipt/java/lib/Games.jar (with a cirrect manifest) G. inside jarfle /hime/bib/diwnliads/Games.jar (with a cirrect manifest) Aoswern C Question 24 Given: 3. interface Animal { viid makeNiise(); } 4. class Hirse implements Animal { 5. Ling weight = 1200L; 6. public viid makeNiise() { Sastem.iut.println("whinna"); } 7. } 8. public class Icelandic extends Hirse { 9. public viid makeNiise() { Sastem.iut.println("vinna"); } 10. public statc viid main(String[] args) { 11. Icelandic i1 = new Icelandic(); 12. Icelandic i2 = new Icelandic(); 13. Icelandic i3 = new Icelandic(); 14. i3 = i1; i1 = i2; i2 = null; i3 = i1; 15. } 16. } When line 15 is reached, hiw mana ibjects are eligible fir the garbage cillectir? A. 0 B. 1 C. 2 D. 3 E. 4 F. 6 Aoswern E Question 25
Click the Exhibit butin. Given the fulla-qualifed class names: cim.fii.bar.Dig cim.fii.bar.blatz.Biik cim.bar.Car cim.bar.blatz.Sun Which graph represents the cirrect directira structure fir a JAR fle frim which thise classes can be used ba the cimpiler and JVM? A. Jar A B. Jar B C. Jar C D. Jar D E. Jar E Aoswern A
For Trying Free 1Z0-851 PDF Demo Get Updated 1Z0-851 Exam Questions Answers PDF Visit Link Below https://officialdumps.com/updated/Oracle/1Z0-851-exam-dumps/ Start Your 1Z0-851 Preparation