Method Reference MCQs with answers Page - 1

You will find multiple-choice questions (MCQs) related to #Method Reference here. Go through these questions to prepare effectively for your upcoming exams and interviews.

To view the correct answer for any question, simply click the "Show Answer" button.

Have a question to share? Click on "Add Question" to contribute!

A

Admin • 802.91K Points
Coach

Q. Which operator is used for method references in Java?

  • (A) ->
  • (B) ::
  • (C) =>
  • (D) %%

A

Admin • 802.91K Points
Coach

Q. Which type of method reference is demonstrated by `String::toUpperCase`?

  • (A) Static method reference
  • (B) Instance method reference of an arbitrary object
  • (C) Constructor reference
  • (D) Instance method reference of a specific object

A

Admin • 802.91K Points
Coach

Q. What is the purpose of a method reference in Java?

  • (A) To create anonymous classes
  • (B) To reference methods without executing them
  • (C) To invoke methods immediately
  • (D) To define interfaces

A

Admin • 802.91K Points
Coach

Q. Which method reference type is demonstrated by `System.out::println`?

  • (A) Static method reference
  • (B) Instance method reference of a specific object
  • (C) Constructor reference
  • (D) Instance method of an arbitrary object

A

Admin • 802.91K Points
Coach

Q. What does `ClassName::new` represent in Java?

  • (A) Static method reference
  • (B) Instance method reference
  • (C) Constructor reference
  • (D) Field reference

A

Admin • 802.91K Points
Coach

Q. What type of method reference is `Math::abs`?

  • (A) Static method reference
  • (B) Instance method reference of an arbitrary object
  • (C) Constructor reference
  • (D) Instance method of a specific object

A

Admin • 802.91K Points
Coach

Q. What does the method reference `this::methodName` refer to?

  • (A) Static method
  • (B) Method of current object
  • (C) Constructor
  • (D) Superclass method

A

Admin • 802.91K Points
Coach

Q. Which functional interface is often used with method references that return a value?

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

A

Admin • 802.91K Points
Coach

Q. Which method reference matches a lambda expression like `s -> s.toLowerCase()`?

  • (A) String::toUpperCase
  • (B) String::toLowerCase
  • (C) Object::toString
  • (D) String::trim

A

Admin • 802.91K Points
Coach

Q. Which type of method reference is represented by `Object::toString`?

  • (A) Static method reference
  • (B) Instance method reference of an arbitrary object
  • (C) Instance method of specific object
  • (D) Constructor reference
What's Tag

As you may know, questions are organized under broad categories. Each category can include various types of questions. For example, the "History" category might contain questions about the Revolt of 1857, Shivaji Maharaj, Ancient History, Buddhism, and more.

To further refine this organization, we've introduced tags, which act as sub-categories to group questions more specifically.

Verified users can add tags to any question. If you have any suggestions regarding this system, we'd love to hear from you. Contact Us

Learn More