Java MCQs with answers Page - 480

Here, you will find a collection of MCQ questions on Java. Go through these questions to enhance your preparation for upcoming examinations and interviews.

To check the correct answer, simply click the View Answer button provided for each question.

Have your own questions to contribute? Click the button below to share your MCQs with others!

+ Add Question

A

Admin • 833.24K Points
Coach

Q. Which functional interface accepts two arguments and returns a result?

  • (A) Function
  • (B) BiFunction
  • (C) Supplier
  • (D) Consumer

A

Admin • 833.24K Points
Coach

Q. What is the main benefit of using functional interfaces in Java?

  • (A) Supports multiple inheritance
  • (B) Enables lambda expressions
  • (C) Allows method overloading
  • (D) Simplifies polymorphism

A

Admin • 833.24K Points
Coach

Q. Which interface is marked as functional even though it has `default` methods?

  • (A) Comparable
  • (B) Runnable
  • (C) Predicate
  • (D) Consumer

A

Admin • 833.24K Points
Coach

Q. Which functional interface method returns void?

  • (A) Supplier.get()
  • (B) Function.apply()
  • (C) Consumer.accept()
  • (D) Predicate.test()

A

Admin • 833.24K Points
Coach

Q. In which Java version were functional interfaces introduced?

  • (A) Java 6
  • (B) Java 7
  • (C) Java 8
  • (D) Java 9

A

Admin • 833.24K Points
Coach

Q. Which functional interface is preferred for computations that may fail with an exception?

  • (A) Supplier
  • (B) Runnable
  • (C) Callable
  • (D) Function