All Matches
Solution Library
Expert Answer
Textbooks
Search Textbook questions, tutors and Books
Oops, something went wrong!
Change your search query and then try again
Toggle navigation
FREE Trial
S
Books
FREE
Tutors
Study Help
Expert Questions
Accounting
General Management
Mathematics
Finance
Organizational Behaviour
Law
Physics
Operating System
Management Leadership
Sociology
Programming
Marketing
Database
Computer Network
Economics
Textbooks Solutions
Accounting
Managerial Accounting
Management Leadership
Cost Accounting
Statistics
Business Law
Corporate Finance
Finance
Economics
Auditing
Hire a Tutor
AI Tutor
New
Search
Search
Sign In
Register
study help
computer science
oracle
Questions and Answers of
Oracle
Which of the following is required for all valid lambda expressions? A. ()B. ->C. {}D. Parameter data type(s)E. None of the above.
Fill in the blanks: The ______________ functional interface does not take any inputs, while the ______________ functional interface does not return any data. A. IntConsumer, LongSupplier B.
What is the result of executing the following application multiple times? A. Only the first stream prints the same order every time.B. Only the first and second streams print the same order every
A lambda expression for which of the following functional interfaces could be used to return a Double value? (Choose
What does the following output? A. 1 1B. 1 3C. 2 3D. The code does not compile due to line x.E. None of the above. var list new ArrayList (); list.add ("Austin"); list.add("Boston");
Identify the correct functional interfaces to fill in this table correctly. (Choose three.) A. Interface X is Predicate.B. Interface X is Supplier.C. Interface Y is Comparator.D. Interface Y is
What is a common reason for a stream pipeline not to run?A. The source doesn’t generate any items.B. There are no intermediate operations.C. The terminal operation is missing.D. The version of
Which functional interface takes a long value as an input argument and has an accept() method?A. LongConsumerB. LongFunctionC. LongPredicateD. LongSupplierE. None of the above.
Given a parallel Stream, which method would you use to obtain an equivalent serial Stream?A. unordered()B. reduce()C. concat()D. stream()E. boxed()F. None of the above
Which of the following is a valid lambda expression?A. r -> {return 1==2}B. (q) -> trueC. (x,y) -> {int test; return test>0;}D. a,b -> trueE. None of the above
Which are true of the following? (Choose two.) A. All of these will run without error.B. One of the lines fails to compile or throws an exception.C. Two of the lines fail to compile or throw an
Which of the following statements about DoubleSupplier and Supplier is not true?A. Both are functional interfaces.B. Both take zero parameters.C. Lambdas for both can return a double
Fill in the blank with the functional interface from java.util.function that allows the code to compile and print 3 at runtime. _____________ transformer = x ->
Which fills in the blank so the code is guaranteed to print 1?var stream = Stream.of(1, 2, 3);System.out.println(stream.__________);A. anyMatch()B. findAny()C. first()D. min()E. None of the
What is the result of the following? A. nullB. An empty String.C. MondayD. The code does not compile.E. The code compiles but throws an exception at runtime. 6: var list new ArrayList (); = 7:
Which functional interface, when filled into the blank, allows the class to compile? A. BiConsumerB. BiConsumerC. BiFunctionD. BiFunctionE. FunctionF. None of the above. package space; import
What best describes a reduction?A. A source operation that creates a small valueB. An intermediate operation where it filters the stream it receivesC. An intermediate operation where it
Which statements about the following application are correct? (Choose two.) A. The TicketTaker constructor does not compile.B. The performJob() method does not compile.C. The class
Suppose you have a stream with one element and the code stream.xxxx.forEach(System.out::println). Filling in xxxx from top to bottom in the table, how many elements can be printed out? Assume a valid
Assuming the proper generic types are used, which lambda expression can be assigned to a ToDoubleBiFunction functional interface reference? (Choose three.) A. (Integer a, Double b) -> {int c; return
Given a Stream, which method would you use to obtain an equivalent parallel Stream? A. getParallelStream()B. parallelStream()C. parallel()D. getParallel()E. parallels()F. None of the above
Rewrite this lambda that takes an int n using a constructor reference: n -> new ArrayList(n).A. ArrayList::newB. ArrayList::new()C. ArrayList::new(n)D. ArrayList::new[n]E. None of the above.
On a DoubleStream, how many of the methods average(), count(), max(), and sum() return an OptionalDouble? A. NoneB. OneC. TwoD. ThreeE. Four.
Which of the following is not a functional interface in the java.util.function package? (Choose
Five of the following six methods always produce the same result whether they are executed on an ordered serial or parallel stream. Which one does
In a stream pipeline, which can return a value other than a Stream?A. SourceB. Intermediate operationC. Terminal operationD. None of the above.
When working with a Stream, which of these types can be returned from the collect() terminal operator by passing arguments to Collectors.groupingBy()?A. Only MapB. Only MapC. Both Map and
What does the following output? A. [tire-][wheel-]B. tire-wheelC. [wheel-][tire-]D. wheel-tireE. None of the above.F. The code does not compile. 12: Set set = new HashSet (); 13:
What is the result of executing the following? A. The code runs without exception and prints two lines.B. The code runs without exception and prints four lines.C. The code does not compile due to
What is the output of the following application? A. 50B. 51C. The code does not compile because of the lambda expression.D. The code does not compile for a different reason.E. The code compiles
What are the three requirements for performing a parallel reduction with the collect()method, which takes a Collector argument. (Choose three.)A. The Collector argument is marked concurrent.B. The
What is true about the following code? (Choose two.) A. The code compiles successfully.B. One line does not compile.C. Two lines do not compile.D. Three lines do not compile.E. If any lines
Which functional interface returns a primitive value?A. BiPredicateB. CharSupplierC. LongFunctionD. UnaryOperatorE. TriDoublePredicateF. None of the above.
Given the following code snippet, which lambda expressions are the best choices for an accumulator? (Choose two.) A. (a,b) -> (a-b)B. (a,b) -> 5C. (a,b) -> i++D. (a,b) ->
Fill in the blanks so that both methods produce the same output for all inputs. A. isNotNull, isPresentB. ifPresent, isPresentC. isPresent, forEachD. isPresent, ifPresentE. None of the above.
Rewrite this lambda using a method reference: () -> Math.random(). A. Math.randomB. Math::randomC. Math::random()D. java.lang::Math.randomE. None of the above
Which operation can occur more than once in a stream pipeline? A. OriginB. SinkC. SourceD. Intermediate operationE. Terminal operationF. None of the above
What is true of the following code? A. Both streams are guaranteed to print the single character a.B. Both streams will print a single character of a, b, or c.C. Only one stream is guaranteed to
Which functional interface, when entered into the following blank, allows the class to compile? A. Consumer.B. ConsumerC. DoubleConsumerD. SupplierE. None of the above. } package groceries;
Which of the following is not a valid lambda expression? A. (Integer j, k) -> 5B. (p,q) -> p+qC. (Integer x, Integer y) -> x*yD. (left,right) -> {return "null";}E. All of these are valid.
What is the output of the following application? A. CatHat CatHatB. aCataHat HatCatC. The code does not compile because the stream in concat1() returns an Optional.D. The code does not compile
Which of the following three functional interfaces is not equivalent to the other two? A. BiFunctionB. BinaryOperatorC. DoubleFunctionD. None of the above. All three are equivalent.
Given the following code snippet, what changes should be made for the JVM to correctly process this as a concurrent reduction? (Choose two.) A. Replace HashSet with LinkedHashSet.B. Mark the
Fill in the blank so this code outputs three lines: A. String::isEmptyB. ! String::isEmptyC. String::! isEmptyD. String::isNotEmptyE. None of the above var list = new ArrayList ();
What does the following output? A. aB. The code runs successfully without any output.C. The code does not complete.D. The code compiles but throws an exception at runtime. var chars =
What is the expected output of the following code snippet? A. It does not compile.B. It throws an exception at runtime.C. It does not print any output at runtime.D. 345345E. 334455F. The
Given the following code snippet, what statement about the values printed on lines p1 and p2 is correct? A. They are always the same.B. They are sometimes the same.C. They are never the
Fill in the blanks so this code prints *8.0-8.0*? (Choose two.) A. averageAsDouble() in the first blankB. average().getAsDouble() in the first blankC. getAverage().get() in the first
Starting with DoubleConsumer and going downward, fill in the missing values for the table. A. 0, 1, 1, 1B. 0, 1, 0, 2C. 0, 2, 1, 2D. 1, 1, 0, 2E. 1, 1, 1, 1F. None of the above. Functional
Starting with DoubleConsumer and going downward, fill in the values for the table. For the following choices, assume R is a generic type. A. double, int, long, RB. double, R, long, RC. R, int,
What is a possible output of the following application? A. {1975=[Escort], 1967=[ Mustang, Thunderbird]}B. {Escort=[1975], Thunderbird=[1967], Mustang=[1967]}C. The code does not compile.D. The
How many lines does this code output? A. Two.B. Four.C. The code does not compile.D. The code compiles but throws an exception at runtime. var list = new LinkedList (); list.add("Archie");
Which lambda expression can replace the instance of new BiologyMaterial() in the Scientist class and produce the same results under various inputted values? A. (p,q) -> q==null ? p :
What is true of the following? (Choose two.) A. The output is 2 bark.B. The output is 2 meow.C. The output is 4 bark.D. The output is 4 meow.E. If "meow" was replaced by a null reference, the
Which statement about a source in a Stream is true?A. The source is mandatory in a stream pipeline.B. The source is only allowed to return primitives.C. The source must be retrieved by calling the
Given an IntStream, which method would you use to obtain an equivalent parallel Stream?A. parallel()B. parallelStream()C. parallels()D. getParallel()E. getParallelStream()F. None of the above
Which can fill in the blank to have the code print true? A. anyMatchB. allMatchC. noneMatchD. None of the above. var stream Stream. iterate(1, i > i+1); -> var b = stream.__(i -> i > 5);
Which of the following fills in the blank so that the code outputs one line but uses a poor practice? A. peek(System.out::println)B. peek(System.out::println).findFirst()C. peek(r ->
What is the output of the following application? A. XXXXXB. The code does not compile because of the lambda expression.C. The code does not compile for a different reason.D. The code compiles,
What is the expected output of the following code snippet? A. It does not compile.B. It throws an exception at runtime.C. It does not print any output at runtime.D. It prints four numbers twice
Which statements about the findAny() method applied to a stream are correct? (Choose three.).A. It always returns the first element on an ordered serial stream.B. It may return any element on an
Which functional interface has a get() method? A. ConsumerB. FunctionC. SupplierD. UnaryOperatorE. None of the above.
Why can’t String::charAt be used as a method reference within a Function?A. Method references can only be used on static methods.B. The charAt() method takes an int rather than Integer
Given the following independent stream operations, which statements are correct? (Choose three.) A. The first stream operation compiles.B. The second stream operation compiles.C. The third stream
Which method reference can replace the lambda on the first line so the output is the same?BiPredicate pred = (a,b) -> a.contains(b);System.out.println(pred.test("fish",
Assuming Scanner is a valid class that implements AutoCloseable, what is the expected output of the following code? A. 1245B. 125C. 1234 followed by a stack traceD. 124 followed by a stack
What is the result of compiling and executing the following application? A. The code compiles and runs without printing anything.B. The code compiles, but a stack trace is printed at
Fill in the blanks: The ___________________ keyword is used in method declarations, while the ___________________ keyword is used to send an exception to the surrounding process.A. throwing,
Given the following keywords, in which order could they be used? (Choose two.)A. try, finallyB. catch, try, finallyC. try, catch, catch, finallyD. finally, catch, tryE. try, finally,
What is the output of the following application? A. 0B. Caught!C. The code does not compile because LostBallException is not handled or declared in the main() method.D. The code does not compile
Fill in the blanks: A try statement ______________ a catch or a finally block, while a try-withresources statement ______________.A. is not required to contain, is not required to contain
How many constructors in WhaleSharkException compile in the following class? A. NoneB. OneC. TwoD. Three package friendly; public class WhaleSharkException extends Exception { public
What is the output of the following application? A. ABCB. ABDC. ABC followed by a stack traceD. ABD followed by a stack traceE. AD followed by a stack traceF. None of the above. package game;
What is the output of the following application? A. This just in!B. The code does not compile because of line r1.C. The code does not compile because of line r2.D. The code does not compile
How many lines of text does the following program print? A. One.B. Two.C. The code does not compile because of line y1.D. The code does not compile because of line y2.E. The code does not
Which of the following types are not recommended to catch in your application?(Choose two.)A. ExceptionB. CheckedExceptionC. ThrowableD. RuntimeExceptionE. UncheckedExceptionF. Error
How many of these custom exceptions are unchecked exceptions? A. NoneB. OneC. TwoD. ThreeE. FourF. Five class ColoringException class CursiveException class DrawingException class
How many lines of text does the following program print? A. One.B. Two.C. Three.D. The code does not compile.E. None of the above. package bee; class SpellingException extends RuntimeException
Which statements about try-with-resources are false? (Choose two.) A. If more than one resource is used, the resources are closed in the order they were created.B. Parentheses are used for the
What is the output of the following code? A. 123B. 123 followed by an exception stack trace.C. 1234D. 1234 followed by an exception stack trace.E. The code does not compile.F. None of the
What is the output of the following application? A. Awake!B. Awake! followed by a stack traceC. Does not compile because of line x1D. Does not compile because of line x2E. Does not compile
Which of the following exception types must be handled or declared by the method in which they are thrown? (Choose
Which of the following diagrams of java.lang classes shows the inheritance model properly? A. B. C. Throwable RuntimeException D. Throwable Error Object Exception RuntimeException Throwable
Which statement best describes how a class that implements the AutoCloseable interface should be written? (Choose two.)A. The close() method is optional since the AutoCloseable interface defines a
Which exception classes, when inserted into the blank in the Problems class, allow the code to compile? A. ExceptionB. RuntimeExceptionC. MissingFoodExceptionD. MissingMoneyException,
Which statements about Closeable and AutoCloseable are true? (Choose two.)A. AutoCloseable extends Closeable.B. Closeable extends AutoCloseable.C. The close() method in a class that implements
Which expressions, when inserted into the blank in the following class, allow the code to compile? (Choose two.) A. Exception a | RuntimeException fB. IllegalStateException | TideException
Which statement about the following program is correct? A. One exception is thrown to the caller at runtime.B. Two exceptions are thrown to the caller at runtime.C. More than two exceptions are
Which of the following are the best scenarios in which to use and catch an exception?(Choose two.).A. The computer caught fire.B. A network connection goes down.C. A caller passes invalid data to
What is the output of the following application? A. beatB. beat!C. Not supportedD. The code does not compile.E. The code compiles, but a stack trace is printed at runtime.F. None of the above.
What is the result of compiling and executing the following class? A. It prints one line.B. It prints two lines.C. It prints three lines.D. It prints four lines.E. It does not compile due to an
Which of the following are not true of using a try-with-resources statement? (Choose two.).A. It shortens the amount of code a developer must write.B. It is possible to close a resource before the
How many of the following are valid exception declarations? A. ZeroB. OneC. TwoD. ThreeE. FourF. Five class Error extends Exception {} class X extends IllegalArgumentException {} class
Assuming Scanner is a valid class that implements AutoCloseable, what is the expected output of the following application? A. Opening!WallsB. The code does not compile because of line p1.C. The
If a try statement has catch blocks for both ClassCastException and RuntimeException, then which of the following statements is correct? A. The catch blocks for these two exception types can be
What is the output of the following application? A. 145B. 1345C. 1235D. The code does not compile.E. The code compiles but throws an exception at runtime.F. None of the above. package game;
What is the output of the following application? A. HelloB. The code does not compile because of the ReadSign class.C. The code does not compile because of the MakeSign class.D. The code does
What is the output of the following application? A. YB. XYC. ZYD. The code does not compile.E. The code compiles, but a stack trace is printed at runtime.F. None of the above. package office;
Which of the following statements about finally blocks are true? (Choose two.)A. Every line of the finally block is guaranteed to be executed.B. The finally block is executed only if the related
What is the output of the following application? A. 24B. 21834C. 23418D. 23481E. 28134F. The code does not compile. package what; class FunEvent implements AutoCloseable { private final int
Showing 500 - 600
of 1045
1
2
3
4
5
6
7
8
9
10
11