반응형
자격증/OCJP_ExamB2018. 7. 9. 16:46QUESTION 13

QUESTION 13 Which two statements are true? (Choose two.) A. It is possible to synchronize static methods. B. When a thread has yielded as a result of yield(), it releases its locks. C. When a thread is sleeping as a result of sleep(), it releases its locks. D. The Object.wait() method can be invoked only from a synchronized context. E. The Thread.sleep() method can be invoked only from a synchro..

자격증/OCJP_ExamB2018. 7. 9. 16:39QUESTION 12

QUESTION 12 Given: 34. HashMap props = new HashMap(); 35. props.put("key45", "some value"); 36. props.put("key12", "some other value"); 37. props.put("key39", "yet another value"); 38. Set s = props.keySet(); 39. //insert code here What, inserted at line 39, will sort the keys in the props HashMap? A. Arrays.sort(s); B. s = new TreeSet(s); C. Collections.sort(s); D. s = new SortedSet(s); Solutio..

자격증/OCJP_ExamB2018. 7. 9. 16:28QUESTION 11

QUESTION 11 Given: import java.util.*;public class Explorer1 { public static void main(String[] args) { TreeSet s = new TreeSet(); TreeSet subs = new TreeSet(); for(int i = 606; i < 613; i++) if(i%2 == 0) s.add(i); subs = (TreeSet)s.subSet(608, true, 611, true); s.add(609); System.out.println(s + " " + subs); } } What is the result? A. Compilation fails. B. An exception is thrown at runtime. C. ..

자격증/OCJP_ExamB2018. 7. 9. 16:15QUESTION 10

QUESTION 10 Given: import java.util.*; public class Mapit { public static void main(String[] args) { Set set = new HashSet(); Integer i1 = 45; Integer i2 = 46; set.add(i1); set.add(i1); set.add(i2); System.out.print(set.size() + " "); set.remove(i1); System.out.print(set.size() + " "); i2 = 47; set.remove(i2); System.out.print(set.size() + " "); } } What is the result? A. 2 1 0 B. 2 1 1 C. 3 2 1..

자격증/OCJP_ExamB2018. 7. 9. 15:55QUESTION 9

QUESTION 9 Given: enum Example { ONE, TWO, THREE } Which statement is true? A. The expressions (ONE == ONE) and ONE.equals(ONE) are both guaranteed to be true. B. The expression (ONE < TWO) is guaranteed to be true and ONE.compareTo(TWO) is guaranteed to be less than one. C. The Example values cannot be used in a raw java.util.HashMap; instead, the programmer must use a java.util.EnumMap. D. The..

자격증/OCJP_ExamB2018. 7. 9. 15:38QUESTION 8

QUESTION 8 Given that the elements of a PriorityQueue are ordered according to natural ordering, and: import java.util.*; public class GetInLine { public static void main(String[] args) { PriorityQueue pq = new PriorityQueue(); pq.add("banana"); pq.add("pear"); pq.add("apple"); System.out.println(pq.poll() + " " + pq.peek()); } } What is the result? A. apple pear B. banana pear C. apple apple D...

반응형
image