Which annotation is used to mark a class as a Spring Bean in the latest Spring Framework 6.0?
A@Component
B@Bean
C@Service
DAll of the above
Correct Answer:
D. All of the above
EXPLANATION
@Component, @Service, @Repository, and @Controller are all stereotype annotations that mark classes as Spring Beans. @Bean is used for method-level bean definition.
C@Component requires manual bean registration, while @Service auto-registers
DThere is no functional difference; they are completely interchangeable
Correct Answer:
A. @Component is generic, while @Service is semantically used for business logic classes
EXPLANATION
@Component is a generic stereotype, while @Service is a specialized annotation indicating the class contains business logic, improving code readability.
Which of the following correctly describes the lifecycle of a singleton-scoped Spring bean?
ACreated once per HTTP request and destroyed after the request completes
BCreated once when the ApplicationContext is initialized and persists throughout the application lifetime
CCreated every time it is referenced and destroyed immediately after use
DCreated in a separate thread context and shared across multiple threads
Correct Answer:
B. Created once when the ApplicationContext is initialized and persists throughout the application lifetime
EXPLANATION
Singleton beans are instantiated once per Spring container and reused for the application's lifetime, making them memory-efficient for stateless objects.
iGET offers 270+ free Java Programming MCQ questions covering all important topics. Each question is prepared by subject experts and comes with detailed explanations to help you understand concepts deeply, not just memorize answers.
Why prepare with iGET?
100% free access, timed mock tests, instant results with detailed analysis, topic-wise progress tracking, and bookmark feature for revision. Trusted by thousands of aspirants preparing for UPSC, SSC, Bank, Railway, NEET, JEE and other competitive exams across India.
How to use this page effectively
Start by selecting a difficulty level (Easy / Medium / Hard) or pick a specific topic from the topics strip. Attempt questions, check your answer instantly, read the explanation carefully, and bookmark tricky ones for later revision. For full exam-style practice, take a Mock Test from the right sidebar.
IGET AI
Online · Exam prep assistant
Hi! 👋 I'm your iget AI assistant.
Ask me anything about exam prep, MCQ solutions, study tips, or strategies! 🎯
iGET uses cookies for essential site functionality, analytics, and ads personalization (via Google AdSense). By clicking "Accept", you consent to our use of cookies.
Privacy Policy ·
Disclaimer