Java 9 Mock Test



This section presents you various set of Mock Tests related to Java 9. You can download these sample mock tests at your local machine and solve offline at your convenience. Every mock test is supplied with a mock test key to let you verify the final score and grade yourself.

Questions and Answers

Java 9 Mock Test II

Answer : C

Explanation

Both of the options are correct.

Answer : C

Explanation

Both of the options are correct.

Answer : C

Explanation

Both of the options are correct.

Q 4 - Which of the following is a not valid member of interface till Java 7?

A - Constant variable

B - Abstract method

C - Default method.

D - All of the above.

Answer : C

Explanation

Default method support is added in Java 8.

Q 5 - Which of the following is a not valid member of interface till Java 7?

A - Constant variable

B - Abstract method

C - Static method.

D - All of the above.

Answer : C

Explanation

Static method support is added in Java 8.

Q 6 - Which of the following is a not valid member of interface till Java 8?

A - Private method

B - Default method

C - Static method.

D - All of the above.

Answer : A

Explanation

Private method support is added in Java 9.

Q 7 - Which of the following is a not valid member of interface till Java 8?

A - Private static method

B - Default method

C - Static method

D - All of the above.

Answer : A

Explanation

Private static method support is added in Java 9.

Q 8 - Which of the following is a not valid member of interface till Java 8?

A - Private static methods

B - Default method

C - Static methods

D - All of the above.

Answer : A

Explanation

Private static method support is added in Java 9.

Q 9 - Which of the following is a valid member of interface in Java 9?

A - Private static methods

B - private methods

C - Both of the above

D - None of the above

Answer : C

Explanation

Private static method and private method support is added in Java 9.

Answer : C

Explanation

In Java 9 Process API which is responsible to control and manage operating system processes has been improved considerably. ProcessHandle Class now provides process's native process ID, start time, accumulated CPU time, arguments, command, user, parent process, and descendants.

Answer : C

Explanation

ProcessHandle class also provides method to check processes' liveness and to destroy processes. It has onExit method, the CompletableFuture class can perform action asynchronously when process exits.

Answer : C

Explanation

takeWhile method takes all the values until the predicate returns false. It returns, in case of ordered stream, a stream consisting of the longest prefix of elements taken from this stream matching the given predicate.

Answer : C

Explanation

dropWhile method throw away all the values at the start until the predicate returns true. It returns, in case of ordered stream, a stream consisting of the remaining elements of this stream after dropping the longest prefix of elements matching the given predicate.

Answer : C

Explanation

iterate method now has hasNext predicate as paremeter which stops the loop once hasNext predicate returns false.

Answer : C

Explanation

ofNullable method is introduced to prevent NullPointerExceptions and to avoid null checks for streams. This method returns a sequential Stream containing single element, if non-null, otherwise returns an empty Stream.

Answer Sheet

Question Number Answer Key
1 C
2 C
3 C
4 C
5 C
6 A
7 A
8 A
9 C
10 C
11 C
12 C
13 C
14 C
15 C
java9_questions_answers.htm
Advertisements