Loading

Quipoin Menu

Learn • Practice • Grow

spring / Spring Configuration
mcq
Direction: Choose the correct option

Q1.

What are the ways to configure Spring container?
A. XML configuration
B. Java-based configuration
C. Annotation-based configuration
D. All of the above
Direction: Choose the correct option

Q2.

Which annotation marks a class as a configuration class?
A. @Configuration
B. @Component
C. @SpringBootApplication
D. @Config
Direction: Choose the correct option

Q3.

What does the @Bean annotation indicate?
A. That a method produces a bean to be managed by Spring
B. That a class is a Spring bean
C. That a field should be injected
D. That a method should be called after bean creation
Direction: Choose the correct option

Q4.

How do you enable component scanning in Java configuration?
A. @ComponentScan
B. @EnableComponentScan
C. @ScanComponents
D. @ComponentScanning
Direction: Choose the correct option

Q5.

Which annotation is used to import another configuration class?
A. @Import
B. @Include
C. @ImportResource
D. @ConfigurationImport
Direction: Choose the correct option

Q6.

What is the purpose of @PropertySource?
A. To load properties files into Spring Environment
B. To define bean properties
C. To set system properties
D. To configure data source
Direction: Choose the correct option

Q7.

Which interface can be used to access property values in Spring?
A. Environment
B. Properties
C. PropertyResolver
D. All of the above
Direction: Choose the correct option

Q8.

What does @Value('${property.name}') do?
A. Injects the value of a property from properties file
B. Defines a bean
C. Sets a field value to a constant
D. None
Direction: Choose the correct option

Q9.

What is the role of @Profile annotation?
A. To conditionally enable beans based on active profiles
B. To define bean scope
C. To specify bean name
D. To mark a test profile
Direction: Choose the correct option

Q10.

How do you activate a profile in Spring?
A. Set spring.profiles.active system property
B. Use @ActiveProfiles in tests
C. Programmatically set environment
D. All of the above