Java 8 Online Quiz


Advertisements

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 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 predicate (Boolean-valued function) of one int-valued argument?

A - IntConsumer

B - IntFunction<R>

C - IntPredicate

D - IntSupplier

Answer : C

Explanation

IntPredicate functional interface represents a predicate (Boolean-valued function) of one int-valued argument.

Q 4 - Which of the following functional interface represents a supplier of long-valued results?

A - LongConsumer

B - LongFunction<R>

C - LongPredicate

D - LongSupplier

Answer : D

Explanation

LongSupplier functional interface represents a supplier of long-valued results.

Q 5 - Which of the following functional interface represents a predicate (Boolean-valued function) of one argument?

A - ObjIntConsumer<T>

B - ObjLongConsumer<T>

C - Predicate<T>

D - Supplier<T>

Answer : C

Explanation

Predicate<T> functional interface represents a predicate (Boolean-valued function) of one argument.

Answer : C

Explanation

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

Q 7 - Which of the following class implements a decoder for decoding byte data using the Base64 encoding scheme in Java8?

A - Base64.Decoder

B - Base64.Encoder

C - Base64Decoder

D - Base64Encoder

Answer : A

Explanation

static class Base64.Decoder - This class implements a decoder for decoding byte data using the Base64 encoding scheme as specified in RFC 4648 and RFC 2045.

Q 8 - Lambda expressions are used primarily to define inline implementation of a functional interface.

A - true

B - false

Answer : A

Explanation

Lambda expressions are used primarily to define inline implementation of a functional interface.

Q 9 - Stream operations do the iterations internally over the source elements provided.

A - false

B - true

Answer : B

Explanation

Stream operations do the iterations internally over the source elements provided, in contrast to Collections where explicit iteration is required.

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