iGET

Java Programming - MCQ Practice Questions

Practice free Java Programming multiple-choice questions with detailed answers and explanations. Perfect for competitive exam preparation.

958 questions | 100% Free

Q.441Medium

Which of the following correctly uses a method reference as an alternative to a lambda expression?

Q.442Medium

Which stream operation uses a lambda expression to transform elements from one type to another?

Q.443Medium

Which of the following lambda expressions is INVALID in Java?

Q.444Medium

A stream processes a list of strings and applies a lambda to convert them to uppercase. Which intermediate operation should be used?

Q.445Medium

Consider the following code: List<String> fruits = Arrays.asList("apple", "banana", "cherry"); fruits.removeIf(s -> s.length() > 5); What will be the contents of 'fruits' list after execution?

Q.446Medium

A Spring application requires constructor-based dependency injection for a mandatory dependency. Which approach is best?

Q.447Medium

What is the default scope of a Spring Bean?

Q.448Medium

Which of the following best describes IoC (Inversion of Control) in Spring?

Q.449Medium

A developer needs to inject a bean only if it exists, otherwise skip injection. Which annotation should be used?

Q.450Medium

What is the role of ApplicationContext in Spring Framework?

Q.451Medium

Which annotation is used to define configuration classes in Spring that replace XML configuration?

Q.452Medium

Consider a scenario where multiple beans of the same type exist. How can you specify which bean to inject?

Q.453Medium

What is the difference between @Bean and @Component annotations?

Q.454Medium

A Spring Boot application starts with ClassPathXmlApplicationContext('application.xml'). What does this do?

Q.455Medium

Which Spring concept ensures that the same bean instance is reused throughout the application lifecycle?

Q.456Medium

In a Spring Boot application, what does the @SpringBootApplication annotation combine?

Q.457Medium

Consider a scenario where you have two bean implementations of the same interface. How would you specify which one to inject using Spring annotations?

Q.458Medium

What is the role of PropertySource annotation in Spring Framework?

Q.459Medium

In Spring Data JPA, what does the @Repository annotation signify?

Q.460Medium

What is the function of the BeanFactory interface in Spring?