| Snaprecruit.com

| Snaprecruit.com

Interview question based on skill :

Take as many assements as you can to improve your validate your skill rating

Total Questions: 20

1. Which method is used to create a directory with fileattributes?

Correct Answer is : Files.createDirectory(path, fileAttributes)

2. Which method can be used to check fileAccessiblity?

Correct Answer is : isReadable(path), isWritable(path), and isExecutable(path)

3. How can we delete all files in a directory?

Correct Answer is : Files.delete(path)

4. How to copy the file from one location to other?

Correct Answer is : Files.copy(source, target)

5. How can we get the size of specified file?

Correct Answer is : size(path)

6. How to read entire file in one line using java 8?

Correct Answer is : Files.readAllLines()

7. How can we create a symbolic link to file?

Correct Answer is : createSymbolicLink()

8. How can we filter lines based on content?

Correct Answer is : lines.filter()

9. Which jar provides FileUtils which contains methods for file operations?

Correct Answer is : apache commons

10. Which feature of java 7 allows to not explicitly close IO resource?

Correct Answer is : AutoCloseable

11. Which of the following is not introduced with Java 8?

Correct Answer is : Serialization

12. What is the purpose of BooleanSupplier function interface?

Correct Answer is : represents supplier of Boolean-valued results

13. What is the return type of lambda expression?

Correct Answer is : Function

14. Which is the new method introduced in java 8 to iterate over a collection?

Correct Answer is : StringList.forEach()

15. What are the two types of Streams offered by java 8?

Correct Answer is : sequential and parallel

16. Which feature of java 8 enables us to create a work stealing thread pool using all available processors at its target?

Correct Answer is : newWorkStealingPool

17. What does Files.lines(Path path) do?

Correct Answer is : It reads all the lines from a file as a Stream

18. What is Optional object used for?

Correct Answer is : Optional is used to represent null with absent value

19. What is the substitute of Rhino javascript engine in Java 8?

Correct Answer is : Nashorn

20. What does SAM stand for in the context of Functional Interface?

Correct Answer is : Single Abstract Method