Java Basic


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











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: A

    Executors newWorkStealingPool() method to create a work-stealing thread pool using all available processors as its target parallelism level.


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











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: C

    Sequential stream and parallel stream are two types of stream provided by java.



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











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: A

    Traversing through forEach method of Iterable with anonymous class.


  1. What is the return type of lambda expression?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: C

    Lambda expression enables us to pass functionality as an argument to another method, such as what action should be taken when someone clicks a button.



  1. Which of the below is an incorrect annotation with respect to JUnits?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: D

    @Test is used to annotate method under test, @BeforeEach and @AfterEach are called before and after each method respectively. @BeforeClass and @AfterClass are called only once for each class.