최신 Java SE 1z0-830 무료샘플문제:
1. Given:
java
String s = " ";
System.out.print("[" + s.strip());
s = " hello ";
System.out.print("," + s.strip());
s = "h i ";
System.out.print("," + s.strip() + "]");
What is printed?
A) [,hello,hi]
B) [ , hello ,hi ]
C) [,hello,h i]
D) [ ,hello,h i]
2. Which two of the following aren't the correct ways to create a Stream?
A) Stream stream = Stream.of();
B) Stream stream = Stream.ofNullable("a");
C) Stream stream = new Stream();
D) Stream<String> stream = Stream.builder().add("a").build();
E) Stream stream = Stream.generate(() -> "a");
F) Stream stream = Stream.empty();
G) Stream stream = Stream.of("a");
3. A module com.eiffeltower.shop with the related sources in the src directory.
That module requires com.eiffeltower.membership, available in a JAR located in the lib directory.
What is the command to compile the module com.eiffeltower.shop?
A) css
CopyEdit
javac -path src -p lib/com.eiffel.membership.jar -d out -m com.eiffeltower.shop
B) bash
CopyEdit
javac -source src -p lib/com.eiffel.membership.jar -d out -m com.eiffeltower.shop
C) css
CopyEdit
javac --module-source-path src -p lib/com.eiffel.membership.jar -s out -m com.eiffeltower.shop
D) css
CopyEdit
javac --module-source-path src -p lib/com.eiffel.membership.jar -d out -m com.eiffeltower.shop
4. Given:
java
var counter = 0;
do {
System.out.print(counter + " ");
} while (++counter < 3);
What is printed?
A) 0 1 2 3
B) 1 2 3 4
C) 1 2 3
D) An exception is thrown.
E) 0 1 2
F) Compilation fails.
5. Given:
java
Object myVar = 0;
String print = switch (myVar) {
case int i -> "integer";
case long l -> "long";
case String s -> "string";
default -> "";
};
System.out.println(print);
What is printed?
A) long
B) nothing
C) string
D) It throws an exception at runtime.
E) integer
F) Compilation fails.
질문과 대답:
질문 # 1 정답: C | 질문 # 2 정답: C,D | 질문 # 3 정답: D | 질문 # 4 정답: E | 질문 # 5 정답: F |