Question
1.Which of the following is a type of bean injection? a. constructor and getter b. setter, getter and constructor c. constructor and setter d. all
1.Which of the following is a type of bean injection?
a. constructor and getter
b. setter, getter and constructor
c. constructor and setter
d. all of the above
e. none of the above
2. Which annotation is used to map the class with the specifiedURL name?
a. @Controller
b. @RestController
c. @RequestMapping
d. @ResponseBody
e. Both A and C
3. Which of the following best represents IOC and Dependencyinjection?
a. Design Pattern
b. Framework
c. Java Module
d. ORM
e. none of the above
4. The act of creating associations between different componentsof an application is known as:
a. collaborating
b. integrating
c. wiring
d. framing
e. All of the above
5. @Component annotation on a class indicates...
a. That a bean should be created for theclass
b. That a bean should not be created for theclass
c. That dependency injection should beenabled for the class
d. That dependency injection and autowiringshould be enabled for the class
e. None of the above
6. Which of the following is not a component of the Springframework?
a. ORM Integration
b.HTML/JSP
c. AOP
d..All of the above
e.None of the above
7. Which of the following correctly lists the Autowiretypes?
a. byName, byType, destructor andautodetect
b. byName, byMethod, constructor andautodetect
c. byName, byType, constructor andautodetect
d. all of the above
e. none of the above
8. Partial dependencies in spring could technically be achievedby...
a. constructor injection
b. setter injection
c. Spring AOP (Aspect OrientedProgramming)
d. Both A and B
e. None of the above
9. What are Spring Beans?
a. Controller classes
b. Service classes
c. Repository Classes
d. Any class that is managed by the SpringContainer
e. None of the above
10. The front controller that intercepts the incoming request inspring mvc is known as
a. DispatcherController
b. DistributorServlet
c. DispatcherServlet
d. DistinguishedServlet
e. None of the above
11. What is the default location of a local mavenrepository?
a. There is no default, the location isconfigured during maven installation.
b. ~/.m2.repo
c. ~/.m2/home/repository
d. ~/.m2/repository
e. none of the above
12. What is the default HTML template engine in Spring Boot
1.JSP
2.HTML
3.Thymeleaf
4.None of the above
13. How do you specify a bean name you want injected?
1.Use the @Quantity annotation
2.Use the @Profile annotation
3.Set the active profile in the application.properties file
4.all of the above
5.none of the above
14. What is the dependency needed to create a spring bootapplication?
a. spring-boot-start-web
b. spring-boot-maven-plugin
c. spring-boot-starter-test
d. All of the above
15. Which of the following is used by Maven
a. pom.xml
b. META_INF
c. config.xml
d. application.properties e. Allof the above
16. What are the different types of dependency injection?
a. XML
Annotation
Java Configurations
Groovy/Grails Config
b. Maven
Groovy
Gradle
c. Interface injection
Setter comparison
Interface comparison
d. Constructor
Setter
Interface
e. None of the above
17. What is the underlying basic concept or design pattern ofSpring
1.Factory Pattern
2.Singleton Pattern
3.Dependency Injection / Inversion of Control
4.Repository Design Pattern
5.All of the above
18. What is the starting point of a Spring Boot Application?
a. @SpringBootApplication
b. @Controller
c. @RestController
d. @Service
19. n what layer is the @Controller annotation used?
a. Service Layer
b. Session Layer
c. Presentation Layer
d. both b and c
e. None of the above
20. What two annotations can be used to access the Spring Beanlifecycle?
a. @AfterPropertiesSet
@Destroy
b. @PostConstruct
@PreDestroy
c. @PostProcessAfterInitialization
@AfterPropertySet
d. all of the above
e. none of the above
21. Which of the following Java Collection types can you injectin a Spring application?
a. List, Set, Map, or Properties tag
b. List, Set, Collection, map or Propertiestag
c. List, Set, Vector, Map, or Propertiestag
d. None of the above
e. None of the above
22. A company is designing the class hierarchy for various cacheimplementations:
Select all the answers that will result in a runtimeexception.
OptimizedDiskCache optimizedDiskCache = newOptimizedDiskCache();
Cache cache = (Cache) optimizedDiskCache;
MemoryCache memoryCache = new MemoryCache(); Cache cache =(Cache) memoryCache;
DiskCache diskCache = (DiskCache) cache;
OptimizedDiskCache optimizedDiskCache = newOptimizedDiskCache();
DiskCache diskCache = (DiskCache) optimizedDiskCache;
OptimizedDiskCache optimizedDiskCache = newOptimizedDiskCache();
Cache cache = (Cache) optimizedDiskCache;
DiskCache diskCache = (DiskCache) cache;
All of the above
23. What IDE can be used to work with a Spring Bootapplication?
a. Intellij
b. Spring Source Tool Suite (STS)
c. Eclipse
d. All of the above
e. Both A and B
24. Hibernate is a...
a. Database connectivity tool
b. ORM framework
c. Database Query Executor
d. None of the above
25. Which of the following statements is true?
a. BeanFactory extends ApplicationContext
b. ApplicationContext extends BeanFactory
c. BeanFactory implementsApplicationContext
d. ApplicationContext implementsBeanFactory
e. None of the above
26. Is the Dependency Inversion principle the same as DependencyInjection?
a. No, dependency inversion addressesabstractions. While dependency injection refers to the injection ofdependencies into classes.
b. No, dependency injection addressesabstractions. While dependency inversion refers to the injection ofabstract dependencies into classes.
c. Yes, the principles tenets of dependencyinversion and dependency injection are fundamentally the same.
d. No, while it is true dependency injection is aproper feature available in spring, dependency inversion is simplynot. e. both b and d
27. A bean can be requested by:
a. Use of the getBean() method
b. Reference from another bean usingautowiring
c. dependency injection
d. All of the above
e. None of the above
28. In Spring MVC, how many active controllers can bedefined?
a. 1 active controller
b. 2
c. Spring does not define controllers
d. Unlimited
e. None of the above
29. Which best describes Spring?
1.A open-source framework
2. A proprietary framework
3.A open-source MVC framework
4.none of the above
5.all of the above
30. What is inversion of control?
a. is the process of inverting the flow ofcontrol in a program.
b. the runtime environment (or framework)which injects dependencies
c. is equivalent to the dependency inversionprinciple
d. all of the above
e. a and b only
31. Which of the following statements is true for@RequestMapping annotation?
a. Used to map web requests onto specifichandler methods
b. Used to map web requests onto specifichandler classes
c. Typically applied to methods in acontroller.
d. both a and c
e. none of the above
32. If you have two beans of the same type, how does one specifythe preference for one bean over the other?
a.Configure the bean using annotation configurations and not xmlconfigurations
b.Add the profile on the bean using @Profileannotation
c.Two beans cannot be of the same type, this would createa conflict preventing the container from starting
d.none of the above
33. The logic performed by a controller often produces someinformation that needs to be carried to the user/browser. Thisinformation in spring mvc is known as ___________.
a. payload data
b. model
c. view
d. controller
e. None of the above
34. Spring Dependency Injection is useful because it makes yourcode...
a. simple
b. easier to test
c. easier to understand
d. All of the above
e. None of the above
35. What are two callback interfaces a developer can implementto tap into the beans lifecyce?
IMFSourceReaderCallback
MFCreateSourceReaderFromURL
ATLCallBack
Connectable
InitializingBean
DisposableBean
all of the above
none of the above
36. Which of the following are spring modules?
1. Spring Core module
2. Spring Web module
3. Spring Jar module
4. Spring Test modules
5. Spring Lightweight module
6. Spring Data Access module
37. Who is the original author of the SOLID principle?
a. Robert Hooke
b. Robert Martin
c. Rod Johnson
d. James Gosling
e. both b and c
38. Which of the following could act as a possible view inspring mvc?
a. HTML
b. JSP
c. Thymeleaf
d. All of the above
e. None of the above
Step by Step Solution
3.31 Rating (148 Votes )
There are 3 Steps involved in it
Step: 1
ANSWER AND STEP BY STEP EXPLANATION 1 d all of the above EXPLAIN All of the types of bean injections are constructor injection setter injection and getter injection 2 e Both A and C EXPLAIN The Contro...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started