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 no result?

A - BiConsumer<T,U>

B - BiFunction<T,U,R>

C - BinaryOperator<T>

D - BiPredicate<T,U>

Answer : A

Explanation

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

Q 2 - Which of the following functional interface represents a predicate (Boolean-valued function) of two arguments?

A - BiConsumer<T,U>

B - BiFunction<T,U,R>

C - BinaryOperator<T>

D - BiPredicate<T,U>

Answer : D

Explanation

BiPredicate<T,U> functional interface represents a predicate (Boolean-valued function) of two arguments.

Q 3 - Which of the following functional interface represents a supplier of int-valued results?

A - IntConsumer

B - IntFunction<R>

C - IntPredicate

D - IntSupplier

Answer : D

Explanation

IntPredicate functional interface represents a supplier of int-valued results.

Q 4 - Which of the following functional interface represents an operation on a single long-valued operand that produces a long-valued result?

A - LongToDoubleFunction

B - LongToIntFunction

C - LongUnaryOperator

D - ObjDoubleConsumer<T>

Answer : C

Explanation

LongUnaryOperator functional interface represents an operation on a single long-valued operand that produces a long-valued result.

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

A - ObjIntConsumer<T>

B - ObjLongConsumer<T>

C - Predicate<T>

D - Supplier<T>

Answer : A

Explanation

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

Answer : C

Explanation

The 'filter' method is used to eliminate elements based on a criteria.

Q 7 - Which of the following API represents a simplified date-time API with no complexity of timezone handling in java8?

A - Local

B - Zoned

C - Both of the above.

D - None of the above.

Answer : A

Explanation

Local − Simplified date-time API with no complexity of timezone handling.

Q 8 - Which of the following is the correct lambda expression which add two numbers and return their sum?

A - (int a, int b) -> a + b;

B - (a, b) -> a + b

C - Both of the above.

D - None of the above.

Answer : C

Explanation

Both of the above options are correct.

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 - In which of the following type of Base64 encoding, Output is mapped to MIME friendly format?

A - Simple

B - URL

C - MIME

D - None of the above.

Answer : C

Explanation

MIME − Output is mapped to MIME friendly format. Output is represented in lines of no more than 76 characters each, and uses a carriage return '' followed by a linefeed ' ' as the line separator. No line separator is present to the end of the encoded output.

java8_questions_answers.htm
Advertisements