Author name: admin

Which of the following interfaces is NOT a functional interface in Java?

Which of the following interfaces is NOT a functional interface in Java? a) Runnable b) Callable c) Comparator d) Iterable Answer: d) Iterable Explanation: The Iterable interface is not a functional interface in Java because it has more than one abstract method. A functional interface is defined as an interface that has exactly one abstract […]

Which of the following interfaces is NOT a functional interface in Java? Read More »

Which interface in Java is a marker interface for lambda expressions?

Which interface in Java is a marker interface for lambda expressions? a) Serializable b) FunctionalInterface c) Runnable d) Callable Answer: b) FunctionalInterface Explanation: The FunctionalInterface annotation in Java is a marker interface that indicates that an interface is intended to be a functional interface, meaning it has exactly one abstract method. This annotation helps to

Which interface in Java is a marker interface for lambda expressions? Read More »

What is the difference between a lambda expression and an anonymous class in Java?

What is the difference between a lambda expression and an anonymous class in Java? a) Lambda expressions can be used with any interface b) Anonymous classes are more efficient than lambda expressions c) Lambda expressions are more concise than anonymous classes d) There is no difference between the two Answer: c) Lambda expressions are more

What is the difference between a lambda expression and an anonymous class in Java? Read More »

Which functional interface in Java takes two arguments and returns a result?

Which functional interface in Java takes two arguments and returns a result? a) Function b) BiFunction c) Consumer d) Predicate Answer: b) BiFunction Explanation: The BiFunction functional interface in Java is used to represent a function that takes two arguments and returns a result. It is similar to the Function interface but operates on two

Which functional interface in Java takes two arguments and returns a result? Read More »

Which functional interface is commonly used with lambda expressions in Java?

Which functional interface is commonly used with lambda expressions in Java? a) Runnable b) Callable c) Function d) Serializable Answer: c) Function Explanation: The Function interface is one of the most commonly used functional interfaces with lambda expressions in Java. It represents a function that takes a single argument and returns a result. The Function

Which functional interface is commonly used with lambda expressions in Java? Read More »

What is the syntax for a basic lambda expression in Java?

What is the syntax for a basic lambda expression in Java? a) (parameters) -> expression b) (expression) -> parameters c) {expression} -> parameters d) (parameters) => expression Answer: a) (parameters) -> expression Explanation: The basic syntax for a lambda expression in Java is (parameters) -> expression. This syntax is straightforward: the parameters are enclosed in

What is the syntax for a basic lambda expression in Java? Read More »

Which JDBC feature introduced in JDBC 4.x allows working with XML data directly?

Which JDBC feature introduced in JDBC 4.x allows working with XML data directly? a) SQLXML interface b) XMLHandler c) XMLProcessor d) XMLSupport Answer: a) SQLXML interface Explanation: The SQLXML interface, introduced in JDBC 4.x, allows working with XML data directly within a database. This interface provides methods for reading, writing, and processing XML data, enabling

Which JDBC feature introduced in JDBC 4.x allows working with XML data directly? Read More »

Which JDBC feature allows handling large result sets efficiently?

Which JDBC feature allows handling large result sets efficiently? a) Streaming ResultSets b) Batch ResultSets c) Cached ResultSets d) Paged ResultSets Answer: a) Streaming ResultSets Explanation: Streaming ResultSets in JDBC allow handling large result sets efficiently by fetching rows one by one as needed, instead of loading the entire result set into memory at once.

Which JDBC feature allows handling large result sets efficiently? Read More »

Scroll to Top