iGET

Java Programming - MCQ Practice Questions

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

951 questions | 100% Free

Q.901Medium

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

Q.902Medium

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

Q.903Medium

What is the role of ApplicationContext in Spring Framework?

Q.904Medium

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

Q.905Medium

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

Q.906Medium

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

Q.907Medium

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

Q.908Medium

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

Q.909Hard

An enterprise application needs different bean implementations based on environment (dev/prod). Which approach is most suitable?

Q.910Hard

What happens when a prototype-scoped bean has a dependency on a singleton-scoped bean in Spring?

Q.911Hard

In Spring Framework 2024-25, which feature allows lazy initialization of beans?

Q.912Hard

A microservices architecture uses Spring with circular dependency between ServiceA and ServiceB. What is the best solution?

Q.913Easy

In Spring Framework, what is the primary purpose of the @Autowired annotation?

Q.914Easy

Which of the following correctly describes the lifecycle of a singleton-scoped Spring bean?

Q.915Easy

What is the difference between @Component and @Service annotations in Spring?

Q.916Medium

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

Q.917Medium

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.918Medium

What is the role of PropertySource annotation in Spring Framework?

Q.919Medium

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

Q.920Easy

What is the primary advantage of using Spring Dependency Injection over manual object creation?