Q.1 The annotation used to import additional configuration classes is ___________.
A. @Import
B. @Include
C. @EnableImport
D. Any of the options
Ans : @Import
Q.2 @ConditionalOnClass({ DataSource.class, EmbeddedDatabaseType.class }) This configuration is only enabled when _______
A. Class in present in the classpath
B. Maven is being used
C. Java version 1.8 or above is used
D. Any of the options
Ans : Class in present in the classpath
Q.3 Specific Auto-Configuration classes cannot be disabled in Spring.
A. True
B. False
Ans : False
Q.4 Auto-configuration report can be logged to the console by enabling debug mode while starting the application.
A. True
B. False
Ans : True
Q.5 How to get the object of DAO in spring framework?
A. Using Spring Dependency injection
B. Using new keyword
Ans : Using Spring Dependency injection
Q.6 @RequestMapping annotation is used to map a HTTP request method (GET or POST) to a specific class or method in the controller which will handle the respective request.
A. True
B. False
Ans : True
Q.7 Which is the way to provide configuration metadata to Spring?
A. Java-based configuration
B. Annotation-based configuration
C. XML-based configuration file
D. All the options
Ans : All the options
Q.8 The embedded server that starts up with the Spring boot application is ____________.
A. Tomcat server
B. Weblogic server
C. None of the options
D. Server has to be configured
Ans : Tomcat server
Q.9 For which of the following criteria can Spring boot auto configuration be done?
A. Presence of a System Property
B. Presence or absence of a Spring Bean
C. Absence of configuration file
D. Availability of a particular class in classpath
E. All the options
Ans : All the options
Q.10 Spring boot follows Opinionated Defaults Configuration approach to reduce developer effort.
A. True
B. False
Ans : True
Q.11 mvn dependency:tree command is used to print tree representation of project alone.
A. True
B. False
Ans : False
Q.12 What is the role of ApplicationContextAware in Spring?
A. To make bean aware on the container
B. To perform Dependency injection
Ans : To make bean aware on the container
Q.13 The annotation to be added to automatically configure beans based on the classes added to the class path is ____________.
A. @EnableConfiguration
B. @EnableAutoConfiguration
C. @AutoConfiguration
D. None of the options
Ans : @EnableAutoConfiguration
Q.14 What is the default nature of the Beans defined in spring framework?
A. Singleton
B. Initialized
C. Final
D. Abstract
E. None of the options
Ans : Singleton
Q.15 Which of the following layers the @Controller annotation is used in?
A. Presentation layer
B. Service layer
C. Session layer
D. Business layer
Ans : Presentation layer
Q.16 What is the scope for business service class in Spring MVC?
A. session
B. Prototype
C. Singleton
D. request
Ans : Singleton
Q.17 The Gradle command to run a Spring boot executable app is ___________.
A. gradle run
B. gradle bootRun
C. Gradle springBootRun
D. None of the options
Ans : gradle bootRun
Q.18 The property to set the host server port in Spring app is ____________.
A. server.portName
B. server.port
C. host.port
D. port name
Ans : server.port
Q.19 The Maven command to run a Spring boot application is __________.
A. Mvn spring: run
B. mvn spring-boot:run
C. maven spring-boot:run
D. None of the options
Ans : mvn spring-boot:run
Q.20 Executable jar can be created in Spring boot using ______________.
A. Maven build
B. Gradle build
C. Both the options
D. None of the options
Ans : Both the options
Q.21 The @Controller annotation indicates ____________.
A. How to control the aspect programming
B. How to control the transaction management
C. How to control the dependency injection
D. That a particular class serves the role of a controller
Ans : That a particular class serves the role of a controller
Q.22 What is the scope of stateless bean in Spring?
A. Request
B. Prototype scope
C. Singleton scope
D. Session
Ans : Singleton scope