Home / CSE MCQs / Java 8 ::

CSE MCQs :: Java 8

  1. Which of the following functional interface represents a function that accepts a double-valued argument and produces a long-valued result?
  2. A.
    DoubleToLongFunction
    B.
    DoubleUnaryOperator
    C.
    Function
    D.
    IntBinaryOperator

  3. Nashorn the new JavaScript engine is an implementation of
  4. A.
    javax.engine.Engine
    B.
    javax.script.Engine
    C.
    javax.javaScript.Engine
    D.
    javax.script.ScriptEngine

  5. Code for Java 8 essentially used to be
  6. A.
    Declarative
    B.
    Imperative
    C.
    Subjective
    D.
    None

  7. What does SAM stand for in context of Functional Interface?
  8. A.
    Single Ambivalue Method
    B.
    Single Abstract Method
    C.
    Simple Active Markup
    D.
    Simple Abstract Markup

  9. A pipeline is a sequence of what operations in java 8
  10. A.
    multi-threading
    B.
    concurrent
    C.
    consequent
    D.
    stream

  11. The newly introduced Streams API is available in which package of java 8:
  12. A.
    java.io.streams
    B.
    java.io.stream
    C.
    java.util.streams
    D.
    java.util.stream

  13. In Java 8 Interfaces, methods can be:
  14. A.
    default
    B.
    abstract
    C.
    all
    D.
    None

  15. A method within a class is only accessible by classes that are defined within the same package as the class of the method. Which one of the following is used to enforce such restriction?
  16. A.
    Declare the method with the keyword public
    B.
    Declare the method with the keyword private
    C.
    Declare the method with the keyword protected
    D.
    Do not declare the method with any accessibility modifiers

  17. Which of the following gets introduced with Java 8?
  18. A.
    Lambda expression
    B.
    Compact profiles
    C.
    Stream API
    D.
    Only first two

  19. What is the Optional object used for?
  20. A.
    Optional is used for optional runtime argument
    B.
    Optional is used for optional spring profile
    C.
    Optional is used to represent null with absent value
    D.
    Optional means its not mandatory for method to return object