Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Java Operators

Java Control Statements

Object Oriented Programming

Java Built-in Classes

Java File Handling

Java Error & Exceptions

Java Multithreading

Java Synchronization

Java Networking

Java Collections

Java Interfaces

Java Data Structures

Java Collections Algorithms

Advanced Java

Java Miscellaneous

Java APIs & Frameworks

Java Class References

Java Useful Resources

Java 8 Online Quiz



Following quiz provides Multiple Choice Questions (MCQs) related to Java 8. You will have to read all the given answers and click over the correct answer. If you are not sure about the answer then you can check the answer using Show Answer button. You can use Next Quiz button to check new set of questions in the quiz.

Questions and Answers

Q 1 - Which of the following functional interface represents an operation that accepts two input arguments, and returns a result?

A - BiConsumer<T,U>

B - BiFunction<T,U,R>

C - BinaryOperator<T>

D - BiPredicate<T,U>

Answer : B

Explanation

BiFunction<T,U> functional interface represents an operation that accepts two input arguments, and returns a result.

Q 2 - Which of the following functional interface represents an operation upon two double-valued operands and producing a double-valued result?

A - BooleanSupplier

B - Consumer<T>

C - DoubleBinaryOperator

D - DoubleConsumer

Answer : C

Explanation

DoubleBinaryOperator functional interface represents an operation upon two double-valued operands and producing a double-valued result.

Q 3 - Which of the following functional interface represents a function that accepts a double-valued argument and produces a long-valued result?

A - DoubleToLongFunction

B - DoubleUnaryOperator

C - Function<T,R>

D - IntBinaryOperator

Answer : A

Explanation

DoubleToLongFunction functional interface represents a function that accepts a double-valued argument and produces a long-valued result.

Q 4 - Which of the following functional interface represents an operation that accepts an object-valued and a double-valued argument, and returns no result?

A - LongToDoubleFunction

B - LongToIntFunction

C - LongUnaryOperator

D - ObjDoubleConsumer<T>

Answer : D

Explanation

ObjDoubleConsumer<T> functional interface represents an operation that accepts an object-valued and a double-valued argument, and returns no result.

Q 5 - Which of the following functional interface represents an operation that accepts an object-valued and a long-valued argument, and returns no result?

A - ObjIntConsumer<T>

B - ObjLongConsumer<T>

C - Predicate<T>

D - Supplier<T>

Answer : B

Explanation

ObjLongConsumer<T> functional interface represents an operation that accepts an object-valued and a long-valued argument, and returns no result.

Q 7 - Can you execute javascript code from java 8 code base?

A - true

B - false

Answer : A

Explanation

Yes! Using ScriptEngineManager, JavaScript code can be called and interpreted in Java.

Q 8 - Using lambda expression, you can refer to final variable or effectively final variable (which is assigned only once).

A - false

B - true

Answer : B

Explanation

Using lambda expression, you can refer to final variable or effectively final variable (which is assigned only once).

Q 9 - A stream provides a set of elements of specific type in a sequential manner.

A - true

B - false

Answer : A

Explanation

A stream provides a set of elements of specific type in a sequential manner. A stream gets/computes elements on demand. It never stores the elements.

Q 10 - The new date-time API in java 8 is immutable and does not have setter methods.

A - true

B - false

Answer : A

Explanation

The new date-time API in java 8 is immutable and does not have setter methods.

java8_questions_answers.htm
Advertisements