Given:
Which two lines inserted in line 1 will allow this code to compile? (Choose two.)
A. protected void walk(){}
B. void walk(){}
C. abstract void walk();
D. private void walk(){}
E. public abstract void walk();
There is a copyServiceAPI that has the org.copyservice. spi. Copy interface
To use this service in a module, which module- info.java would be correct?
A. Option A
B. Option B
C. Option C
D. Option D
Given:
If file "App.config" is not found, what is the result?
A. Configuration is OK
B. The compilation fails.
C. Exception in thread "main" java.lang.Error:Fatal Error: Configuration File, App.config, is missing.
D. nothing
Given:
public class X {
}
and
public final class Y extends X {
}
What is the result of compiling these two classes?
A. The compilation fails because there is no zero args constructor defined in class X.
B. The compilation fails because either class X or class Y needs to implement the toString() method.
C. The compilation fails because a final class cannot extend another class.
D. The compilation succeeds.
Given: Automobile.java
Car.java
What must you do so that the code prints 4?
A. Remove the parameter from wheels method in line 3.
B. Add @Override annotation in line 2.
C. Replace the code in line 2 with Car ob = new Car();
D. Remove abstract keyword in line 1.
Given:
How many LocalDate objects are created in this example?
A. 2
B. 3
C. 4
D. 5
Given: After which line can we insert assert i < 0 || values[i] <= values[i + 1]; to verify that the values array is partially sorted?
A. after line 8
B. after line 6
C. after line 5
D. after line 10
Given:
var fruits = List.of("apple", "orange", "banana", "lemon");
You want to examine the first element that contains the character n. Which statement will accomplish this?
A. String result = fruits.stream().filter(f > f.contains("n")).findAny();
B. fruits.stream().filter(f > f.contains("n")).forEachOrdered(System.out::print);
C. Optional
D. Optional
Given:
What is the result?
A. The compilation fails.
B. 1.99,2.99,0
C. 1.99,2.99,0.0
D. 1.99,2.99
Given the code fragment:
Which two code fragments, independently, replace line 1 to implement the equivalent reduce operation? (Choose two.)
A. Integer sum = data.map(a -> a).reduce((a, b) -> a+b);
B. OptionalInt value = data.mapToInt(a -> a).parallel().reduce(0, (a, b) -> a+b); Integer sum = value.getAsInt();
C. int s = 0; Integer sum = data.map(a -> a).reduce(0, (a-> a + s));
D. OptionalInt value = data.mapToInt(a -> a).parallel().reduce((a, b) -> a+b); Integer sum = value.getAsInt();
E. Integer sum = data.mapToInt(a -> a).reduce(0, (a,b)->a+b));