OCJP(Java 6) 기출문제 연습 8(71~80)
PC나 스마트폰에서도 동일하게 실행되므로 장소를 가리지 않고 OCJP(JAVA 6) 국제 자격증을 목표로 학습할 수 있다.
QUESTION 71
Given:
3. import java.util.*;
4. public class G1 {
5. public void takeList(List<? extends String> list) {
6. // insert code here
7. }
8. }
Which three code fragments, inserted independently at line 6, will compile? (Choose three.)
B,C,D
설명없음
QUESTION 72
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<String> pq = new PriorityQueue<String>();
pq.add("banana");
pq.add("pear");
pq.add("apple");
System.out.println(pq.poll() + " " + pq.peek());
}
}
What is the result?
D
설명없음
QUESTION 73
Given:
enum Example { ONE, TWO, THREE }
Which statement is true?
A
설명없음
QUESTION 74
Given:
import java.util.*;
public class Mapit {
public static void main(String[] args) {
Set<Integer> set = new HashSet<Integer>();
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?
B
설명없음
QUESTION 75
Given:
import java.util.*;
public class Explorer1 {
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(609);
System.out.println(s + " " + subs);
}
}
What is the result?
F
설명없음
QUESTION 76
Given:
import java.util.*;
public class Quest {
public static void main(String[] args) {
String[] colors = {"blue", "red", "green", "yellow", "orange"};
Arrays.sort(colors);
int s2 = Arrays.binarySearch(colors, "orange");
int s3 = Arrays.binarySearch(colors, "violet");
System.out.println(s2 + " " + s3);
}
}
What is the result?
C
Next item index: (-(number of itens)-1)
ZZZ
QUESTION 77
Given:
HashMap props = new HashMap();
props.put("key45", "some value");
props.put("key12", "some other value");
props.put("key39", "yet another value");
Set s = props.keySet();
//insert code here
What, inserted at line 39, will sort the keys in the props HashMap?
B
설명없음
QUESTION 78
Which two statements are true? (Choose two.)
A,D
설명없음
QUESTION 79
Given:
public class TestOne implements Runnable {
public static void main (String[] args) throws Exception {
Thread t = new Thread(new TestOne());
t.start();
System.out.print("Started");
t.join();
System.out.print("Complete");
}
public void run() {
for (int i = 0; i < 4; i++) {
System.out.print(i);
}
}
}
What can be a result?
E
설명없음
QUESTION 80
Which three will compile and run without exception? (Choose three.)
C,E,F
설명없음