Oracle Java SE 8 Programmer II (1z0-809 Korean Version) (1z0-809 Korean) Free Practice Test
Question 1
주어진 코드 조각:

1,2를 인쇄하기 위해 n1행에 어떤 문장을 삽입할 수 있습니까? 1,10; 2,20;?

1,2를 인쇄하기 위해 n1행에 어떤 문장을 삽입할 수 있습니까? 1,10; 2,20;?
Correct Answer: A
Explanation: Only visible for TestSimulate members. You can sign-up / login (it's free).
Question 2
주어진 코드 조각:
List<String> codes = Arrays.asList ("DOC", "MPEG", "JPEG");
codes.forEach (c -> System.out.print(c + " "));
String fmt = codes.stream()
.filter (s-> s.contains ("PEG"))
.reduce((s, t) -> s + t).get();
System.out.println("\n" + fmt);
결과는 무엇입니까?
List<String> codes = Arrays.asList ("DOC", "MPEG", "JPEG");
codes.forEach (c -> System.out.print(c + " "));
String fmt = codes.stream()
.filter (s-> s.contains ("PEG"))
.reduce((s, t) -> s + t).get();
System.out.println("\n" + fmt);
결과는 무엇입니까?
Correct Answer: C
Question 3
주어진 코드 조각:
Stream<List<String>> iStr= Stream.of (
Arrays.asList ("1", "John"),
Arrays.asList ("2", null)0;
Stream<<String> nInSt = iStr.flatMapToInt ((x) -> x.stream ());
nInSt.forEach (System.out :: print);
반환 결과;
};
str.stream()
.필터(테스트)
.findFirst()
.ifPresent(System.out :: 인쇄);
결과는 무엇입니까?
Stream<List<String>> iStr= Stream.of (
Arrays.asList ("1", "John"),
Arrays.asList ("2", null)0;
Stream<<String> nInSt = iStr.flatMapToInt ((x) -> x.stream ());
nInSt.forEach (System.out :: print);
반환 결과;
};
str.stream()
.필터(테스트)
.findFirst()
.ifPresent(System.out :: 인쇄);
결과는 무엇입니까?
Correct Answer: C
Question 4
주어진:
public class Product {
int id; int price;
public Product (int id, int price) {
this.id = id;
this.price = price;
}
Public String toString () { return id + ":" + price;)
}
및 코드 조각:
List<Product> products = new ArrayList <> (Arrays.asList(new Product(1, 10), new Product (2, 30), new Product (3, 20)); Product p = products.stream().reduce(new Product (4, 0), (p1, p2) -> { p1.price+=p2.price; return new Product (p1.id, p1.price);}); products.add(p); products.stream().parallel()
.reduce((p1, p2) - > p1.price > p2.price ? p1 : p2)
.ifPresent(System.out: :println);
결과는 무엇입니까?
public class Product {
int id; int price;
public Product (int id, int price) {
this.id = id;
this.price = price;
}
Public String toString () { return id + ":" + price;)
}
및 코드 조각:
List<Product> products = new ArrayList <> (Arrays.asList(new Product(1, 10), new Product (2, 30), new Product (3, 20)); Product p = products.stream().reduce(new Product (4, 0), (p1, p2) -> { p1.price+=p2.price; return new Product (p1.id, p1.price);}); products.add(p); products.stream().parallel()
.reduce((p1, p2) - > p1.price > p2.price ? p1 : p2)
.ifPresent(System.out: :println);
결과는 무엇입니까?
Correct Answer: D
Question 5
주어진:
책.자바:
공개 수업 도서 {
개인 문자열 읽기(문자열 bname) { "읽기" + bname 반환 }
}
전자책.자바:
공개 클래스 EBook 확장 도서 {
공개 클래스 문자열 읽기(문자열 URL) { "보기" + URL 반환 }
}
테스트.자바:
공개 클래스 테스트 {
공개 정적 무효 메인(String[] 인수) {
책 b1 = 새 책();
b1.read("자바 프로그래밍");
책 b2 = 새로운 전자책();
b2.read("http://ebook.com/ebook");
}
}
결과는 무엇입니까?
책.자바:
공개 수업 도서 {
개인 문자열 읽기(문자열 bname) { "읽기" + bname 반환 }
}
전자책.자바:
공개 클래스 EBook 확장 도서 {
공개 클래스 문자열 읽기(문자열 URL) { "보기" + URL 반환 }
}
테스트.자바:
공개 클래스 테스트 {
공개 정적 무효 메인(String[] 인수) {
책 b1 = 새 책();
b1.read("자바 프로그래밍");
책 b2 = 새로운 전자책();
b2.read("http://ebook.com/ebook");
}
}
결과는 무엇입니까?
Correct Answer: C
Question 6
주어진:

그리고 코드 조각:

candlist에 Candidate 객체가 포함되어 있다고 가정할 때, 어떤 코드 조각이 NewYork의 후보자들의 평균 연령을 계산합니까?

그리고 코드 조각:

candlist에 Candidate 객체가 포함되어 있다고 가정할 때, 어떤 코드 조각이 NewYork의 후보자들의 평균 연령을 계산합니까?
Correct Answer: A
Question 7
주어진 코드 조각:
9. Connection conn = DriveManager.getConnection(dbURL, userName, passWord);
10. String query = "SELECT id FROM Employee";
11. try (Statement stmt = conn.createStatement()) {
12. ResultSet rs = stmt.executeQuery(query);
13.stmt.executeQuery("SELECT id FROM Customer");
14. while (rs.next()) {
15. //process the results
16.System.out.println("Employee ID: "+ rs.getInt("id"));
17.}
18. } catch (Exception e) {
19. System.out.println ("Error");
20. }
다음과 같이 가정합니다.
필수 데이터베이스 드라이버는 클래스 경로에 구성됩니다.
dbURL, userName 및 passWord가 있는 적절한 데이터베이스에 액세스할 수 있습니다.
Employee 및 Customer 테이블을 사용할 수 있으며 각 테이블에는 몇 개의 레코드가 있는 id 열이 있으며 SQL 쿼리가 유효합니다.
이 코드 조각을 컴파일하고 실행한 결과는 무엇입니까?
9. Connection conn = DriveManager.getConnection(dbURL, userName, passWord);
10. String query = "SELECT id FROM Employee";
11. try (Statement stmt = conn.createStatement()) {
12. ResultSet rs = stmt.executeQuery(query);
13.stmt.executeQuery("SELECT id FROM Customer");
14. while (rs.next()) {
15. //process the results
16.System.out.println("Employee ID: "+ rs.getInt("id"));
17.}
18. } catch (Exception e) {
19. System.out.println ("Error");
20. }
다음과 같이 가정합니다.
필수 데이터베이스 드라이버는 클래스 경로에 구성됩니다.
dbURL, userName 및 passWord가 있는 적절한 데이터베이스에 액세스할 수 있습니다.
Employee 및 Customer 테이블을 사용할 수 있으며 각 테이블에는 몇 개의 레코드가 있는 id 열이 있으며 SQL 쿼리가 유효합니다.
이 코드 조각을 컴파일하고 실행한 결과는 무엇입니까?
Correct Answer: A
Question 8
주어진 코드 조각:
4. void doStuff() throws ArithmeticException, NumberFormatException, Exception {
5. if (Math.random() >-1 throw new Exception ("Try again");
6. }
and
24. try {
25. doStuff ( ):
26. } catch (ArithmeticException | NumberFormatException | Exception e) {
27. System.out.println (e.getMessage()); }
28. catch (Exception e) {
29. System.out.println (e.getMessage()); }
30. }
코드에서 Try again을 인쇄할 수 있는 수정 사항은 무엇입니까?
4. void doStuff() throws ArithmeticException, NumberFormatException, Exception {
5. if (Math.random() >-1 throw new Exception ("Try again");
6. }
and
24. try {
25. doStuff ( ):
26. } catch (ArithmeticException | NumberFormatException | Exception e) {
27. System.out.println (e.getMessage()); }
28. catch (Exception e) {
29. System.out.println (e.getMessage()); }
30. }
코드에서 Try again을 인쇄할 수 있는 수정 사항은 무엇입니까?
Correct Answer: B
Question 9
STUDENT 테이블의 구조가 주어졌을 때:
학생(ID INTEGER, 이름 VARCHAR)
주어진:
public class Test {
static Connection newConnection =null;
public static Connection get DBConnection () throws SQLException {
try (Connection con = DriveManager.getConnection(URL, username, password)) { newConnection = con;
}
return newConnection;
}
public static void main (String [] args) throws SQLException {
get DBConnection ();
Statement st = newConnection.createStatement();
st.executeUpdate("INSERT INTO student VALUES (102, 'Kelvin')");
}
}
다음과 같이 가정합니다.
필수 데이터베이스 드라이버는 클래스 경로에 구성됩니다.
URL, userName 및 passWord가 있는 적절한 데이터베이스에 액세스할 수 있습니다.
SQL 쿼리가 유효합니다.
결과는 무엇입니까?
학생(ID INTEGER, 이름 VARCHAR)
주어진:
public class Test {
static Connection newConnection =null;
public static Connection get DBConnection () throws SQLException {
try (Connection con = DriveManager.getConnection(URL, username, password)) { newConnection = con;
}
return newConnection;
}
public static void main (String [] args) throws SQLException {
get DBConnection ();
Statement st = newConnection.createStatement();
st.executeUpdate("INSERT INTO student VALUES (102, 'Kelvin')");
}
}
다음과 같이 가정합니다.
필수 데이터베이스 드라이버는 클래스 경로에 구성됩니다.
URL, userName 및 passWord가 있는 적절한 데이터베이스에 액세스할 수 있습니다.
SQL 쿼리가 유효합니다.
결과는 무엇입니까?
Correct Answer: D
Question 10
주어진 코드 조각:

그리고

결과는 무엇입니까?

그리고

결과는 무엇입니까?
Correct Answer: C
Question 11
2015년에는 미국 뉴욕의 일광 절약 시간제가 3월 8일 오전 2시에 시작됩니다. 결과적으로 오전 2시가 오전 3시가 됩니다.
주어진 코드 조각:

결과는 무엇입니까?
주어진 코드 조각:

결과는 무엇입니까?
Correct Answer: C