SlideShare a Scribd company logo
1 of 9
Download to read offline
WWW.SPRINGMOCKEXAMS.COM Page of1 9
Spring Certification Questions
Free on-line spring certification test available at
https://www.springmockexams.com
Enrol now to get full access to a set of four Spring Mock Exams using our exam
simulator.
ENROLLING NOW YOU WILL GET ACCESS TO 200 UNIQUE SPRING
CERTIFICATION QUESTIONS.
QUESTION 1
https://www.springmockexams.com/spring/mock/spring-mock-exam.html
Spring Certification Question: Which of the following is true regarding the @Autowired annotation?
Select Your Answer:
A: It is possible to provide all beans of a particular type from the ApplicationContext by adding the
annotation to a field or method that expects an array of that type.
B: Typed Maps can be autowired as long as the expected key type is String.
C: By default, the autowiring fails whenever zero candidate beans are available.
D: All of the above.
The answer is: D
Explanation:
A: public class MovieRecommender {
@Autowired
private MovieCatalog[] movieCatalogs;
// ...
}
B:public class MovieRecommender {
WWW.SPRINGMOCKEXAMS.COM Page of2 9
private Map<String, MovieCatalog> movieCatalogs;
@Autowired
public void setMovieCatalogs(Map<String, MovieCatalog> movieCatalogs) {
this.movieCatalogs = movieCatalogs;
}
// ...
}
C: This is true. If no candidate are available, an exception will be thrown.
D: They are all true.
QUESTION 2
Spring Certification Question: By default, when you use XmlWebApplicationContext, the
configuration will be taken from "/WEB-INF/applicationContext.xml" for the root context, and "/
WEB-INF/test-servlet.xml" for a context with the namespace "test-servlet". Which of those pieces
of code can override the default config location?
Select all that apply:
A:
<servlet>
<servlet-name>accounts</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/mvc-config.xml
</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
B:
<context-param>
</context-param>
<context-param>
<param-name>spring.profiles.active</param-name>
<param-value>jpa</param-value>
</context-param>
C:
<listener>
<listener-class>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/app-config.xml</param-value>
</listener-class>
WWW.SPRINGMOCKEXAMS.COM Page of3 9
</listener>
D: None of the above
The answers are: A, B
Explanation:
A:The config location defaults can be overridden via the "contextConfigLocation" context-param of
ContextLoader.
B:The config location defaults can be overridden via the servlet init-param of FrameworkServlet.
C:The listener section is used to define a ContextLoaderListener and it does not impact the
application context location.
D:A and B are true.
QUESTION 3
Spring Certification Question: Which are valid method signatures for the method
ClassPathXmlApplicationContext.getBean():
Select all that apply:
A: Object getBean(String name) throws BeansException.
B: <T> T getBean(String name, Class<T> requiredType) throws BeansException.
C: <T> T getBean(String name, String requiredType) throws BeansException.
D: <T> T getBean(Class<T> requiredType) throws BeansException.
E: All of the above.
The answers are: A,B,D
Explanation:
A: Return an instance, which may be shared or independent, of the specified bean name.
B: Behaves the same as getBean(String), but provides a measure of type safety by throwing a
BeanNotOfRequiredTypeException if the bean is not of the required type.
C: This method signature does not exist.
D: Return the bean instance that uniquely matches the given object type, if any.
E: Only A,B,D are true.
QUESTION 4
Spring Certification Question: Which of these is the best description of an AOP Aspect?
Select Your Answer:
A: A point in the execution of a program such as a method call or field assignment.
B: An expression that Selects one or more Join Points.
WWW.SPRINGMOCKEXAMS.COM Page of4 9
C: Code to be executed at a Join Point that has been Selected by a Pointcut.
D: A module that encapsulates pointcuts and advice.
E: None of the above.
The answer is: D
Explanation:
A: This is a Join Point.
B: This is a Pointcut.
C: This is an Advice.
D: This is an Aspect.
E: D is true.
QUESTION 5
Spring Certification Question: Which of the following are false regarding Spring AOP?
Select all that apply:
A: It can advice any Join Points.
B: Can only apply aspects to Spring Beans.
C: Spring adds behaviour using dynamic proxies if a Join Point is declared on a class.
D: If a Join Point is in a class with no interface, Spring will use CGLIB for weaving.
E: CGLIB proxies can be applied to final classes or methods.
The answers are: A, C, E
Explanation:
A: False. It can advice only public Join Points.
B: True. This one of the limitation.
C: False. Spring uses dynamic proxies if a Join Point is declared on an interface.
D: True. CGLIB is used for weaving class aspects.
E: False. It cannot be applied to final classes or methods.
QUESTION 6
Spring Certification Question: Which of the following is false regarding the following code and
HttpInvokerProxyFactoryBean?
<bean id="httpInvokerProxy"
class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">
WWW.SPRINGMOCKEXAMS.COM Page of5 9
<property name="serviceUrl" value="http://remotehost:8080/remoting/AccountService"/>
<property name="serviceInterface" value="example.AccountService"/>
</bean>
Select one answer:
A: This is client-side code.
B: Spring will translate your calls to HTTP POST requests.
C: HttpInvokerProxy uses Commons HttpClient by default.
D: Spring will send HTTP POST request to the defined URL which is http://remotehost:8080/
remoting/AccountService.
E: The service URL must be an HTTP URL exposing an HTTP invoker service.
The answer is: C
Explanation:
By default, the HttpInvokerProxy uses the J2SE HTTP functionality, but you can also use the
Commons HttpClient by setting the httpInvokerRequestExecutor property:
<property name="httpInvokerRequestExecutor">
<bean
class="org.springframework.remoting.httpinvoker.CommonsHttpInvokerRequestExecutor"/>
</property>
This is a difficult question but we found something similar on the real exam.
QUESTION 7
Spring Certification Question: Which of the following is true regarding the annotation
@RequestParam in the following piece of code:
@Controller
@RequestMapping("EDIT")
@SessionAttributes("site")
public class PetSitesEditController {
// ...
public void removeSite(@RequestParam("site") String site, ActionResponse response) {
this.petSites.remove(site);
response.setRenderParameter("action", "list");
}
// ...
}
!Select all that apply:
WWW.SPRINGMOCKEXAMS.COM Page of6 9
A: The @RequestParam annotation is used to extract a parameter from the HTTP response and
bind them to a method parameter.
B: The @RequestParam annotation can automatically perform type conversion.
C: Parameters using this annotation are required by default.
D: It differs from @PathVariable because with the latest you can extract value directly from the
request URL using the URI Templates.
E: All of the above.
The answers are: B, C, D
Explanation:
A: False. The @RequestParam annotation is used to bind request parameters to a method
parameter in your controller. This @Controller will be an entry point for mapping HTTP requests.
B: This is true. In this case, a request of the form http://localhost:8080/....../EDIT.html?site=xxx
would convert xxx in a string and assign it to the method parameter "site".
C: This is true as well, but you can specify that a parameter is optional by setting
@RequestParam's annotationâs ârequiredâ attribute to false (e.g., @RequestParam(value="id",
required=false)) making it optional.
D: This is true as well. @PathVariable can take advance from the usage of placeholders that will
extract the method parameter directly from the request URL. For instance:
@Controller
@RequestMapping(value = "/pets/{petId}", method = RequestMethod.GET, produces="application/
json")
@ResponseBody
public Pet getPet(@PathVariable String petId, Model model) {
// implementation omitted
}
E: Only B, C and D are true so this one is false.
QUESTION 8
Spring Certification Question: Which of the following are true regarding the following piece of
code?
<tx:annotation-driven/>
<bean id="txManager"
class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource"/>
</bean>
<jdbc:embedded-database id="dataSource">
<jdbc:script location="classpath:rewards/testdb/schema.sql"/>
<jdbc:script location="classpath:rewards/testdb/test-data.sql"/>
</jdbc:embedded-database>
Select all that apply:
A: It is declaring a container-managed datasource (via JNDI).
WWW.SPRINGMOCKEXAMS.COM Page of7 9
B: DataSourceTransactionManager it is a subclass of AbstractPlatformTransactionManager.
C: It is defining a Transaction manager with id txManager for supporting transaction management.
D: It is defining a bean Post-processor that proxies @Transactional annotated bean
<tx:annotation-driven/>.
E: None of the above.
The answers are: B, C, D
Explanation:
A: False, it is declaring a local datasource using the tags <jdbc:embedded-database> ... </
jdbc:embedded-database>. The preceding configuration creates an embedded HSQL database
populated with SQL from schema.sql and testdata.sql resources in the classpath. The database
instance is made available to the Spring container as a bean of type javax.sql.DataSource. This
bean can then be injected into data access objects as needed.
B: True. It is a PlatformTransactionManager implementation for a single JDBC DataSource. It binds
a JDBC Connection from the specified DataSource to the current thread, potentially allowing for
one thread-bound Connection per DataSource.
C: True, this is needed for providing Spring transaction support.
D: True. This is the most tricky question because the declaration of the bean post processor it is
hidden in the tag <tx:annotation-driven/>. Remember that you can mark any method with the
@Transactional annotation but the mere presence of the @Transactional annotation is not enough
to activate the transactional behavior. <tx:annotation-driven/> element switches on the
transactional behavior.
E: A is not true so this does not apply.
QUESTION 9
Spring Certification Question: The method "convertAndSend" of the jmsTemplate interface, it is
used to send an object to a destination, converting the object to a JMS message. Which of the
following are valid definitions of this method?
Select all that apply:
A: convertAndSend(Destination destination, Object message).
B: convertAndSend(Object message).
C: convertAndSend(String destinationName, Object message).
D: convertAndSend(Object message, Destination destination).
E: All of the above.
The answers are: A, B, C
Explanation:
A: Send the given object to the specified destination, converting the object to a JMS message with
a configured MessageConverter.
B: Send the given object to the default destination, converting the object to a JMS message with a
configured MessageConverter.
C: Send the given object to the specified destination, converting the object to a JMS message with
a configured MessageConverter.
WWW.SPRINGMOCKEXAMS.COM Page of8 9
D: There is no such method definition. This is a compiler error.
E: Only A,B,C are true.
QUESTION 10
Spring Certification Question: When using JMX which one is false regarding the following piece of
configuration?
<beans>
<bean id="exporter" class="org.springframework.jmx.export.MBeanExporter">
<property name="beans">
<map>
<entry key="bean:name=testBean1" value-ref="testBean"/>
</map>
</property>
</bean>
<bean id="testBean" class="org.springframework.jmx.JmxTestBean">
<property name="name" value="TEST"/>
<property name="age" value="100"/>
</bean>
</beans>
Select all that apply:
A: The bean "exporter" will export a bean to the JMX MBeanServer.
B: "testBean" bean is exposed as an MBean under the ObjectName bean:name=testBean1.
C: The bean "exporter" can be lazily initialized.
D: By default, all public properties of the bean are exposed as attributes and all public methods are
exposed as operations.
E: All of the above.
The answers are: C, E
Explanation:
A: This is exactly the aim of the exporter. The bean "testBean" will be exported as an MBean with
name of "testBean1".
B: This is true. The key of each entry in the beans Map is used as the ObjectName for the bean
referenced by the corresponding entry value by default.
C: This is false. Exporter bean must not be lazily initialized if the exporting is to happen. If you
configure a bean with the MBeanExporter that is also configured for lazy initialization, then the
MBeanExporter will not break this contract and will avoid instantiating the bean. Instead, it will
register a proxy with the MBeanServer and will defer obtaining the bean from the container until the
first invocation on the proxy occurs.
D: This is true. The default policy is to expose all properties and all public methods of the bean.
WWW.SPRINGMOCKEXAMS.COM Page of9 9
E: False. Only C is false of the above so this is false as well.

More Related Content

What's hot

TestNG Session presented in Xebia XKE
TestNG Session presented in Xebia XKETestNG Session presented in Xebia XKE
TestNG Session presented in Xebia XKEAbhishek Yadav
 
Setting up Page Object Model in Automation Framework
Setting up Page Object Model in Automation FrameworkSetting up Page Object Model in Automation Framework
Setting up Page Object Model in Automation Frameworkvaluebound
 
Page Object Model and Implementation in Selenium
Page Object Model and Implementation in Selenium  Page Object Model and Implementation in Selenium
Page Object Model and Implementation in Selenium Zoe Gilbert
 
Spring Framework - AOP
Spring Framework - AOPSpring Framework - AOP
Spring Framework - AOPDzmitry Naskou
 
Connecting Connect with Spring Boot
Connecting Connect with Spring BootConnecting Connect with Spring Boot
Connecting Connect with Spring BootVincent Kok
 
Introduction to Spring Boot!
Introduction to Spring Boot!Introduction to Spring Boot!
Introduction to Spring Boot!Jakub Kubrynski
 
Testing Spring Boot Applications
Testing Spring Boot ApplicationsTesting Spring Boot Applications
Testing Spring Boot ApplicationsVMware Tanzu
 
Hibernate presentation
Hibernate presentationHibernate presentation
Hibernate presentationManav Prasad
 
DSL, Page Object and Selenium – a way to reliable functional tests
DSL, Page Object and Selenium – a way to reliable functional testsDSL, Page Object and Selenium – a way to reliable functional tests
DSL, Page Object and Selenium – a way to reliable functional testsMikalai Alimenkou
 
Git interview questions | Edureka
Git interview questions | EdurekaGit interview questions | Edureka
Git interview questions | EdurekaEdureka!
 
Java Hibernate Programming with Architecture Diagram and Example
Java Hibernate Programming with Architecture Diagram and ExampleJava Hibernate Programming with Architecture Diagram and Example
Java Hibernate Programming with Architecture Diagram and Examplekamal kotecha
 
Spring boot introduction
Spring boot introductionSpring boot introduction
Spring boot introductionRasheed Waraich
 

What's hot (20)

TestNG Session presented in Xebia XKE
TestNG Session presented in Xebia XKETestNG Session presented in Xebia XKE
TestNG Session presented in Xebia XKE
 
Setting up Page Object Model in Automation Framework
Setting up Page Object Model in Automation FrameworkSetting up Page Object Model in Automation Framework
Setting up Page Object Model in Automation Framework
 
Page Object Model and Implementation in Selenium
Page Object Model and Implementation in Selenium  Page Object Model and Implementation in Selenium
Page Object Model and Implementation in Selenium
 
Java Spring Framework
Java Spring FrameworkJava Spring Framework
Java Spring Framework
 
Spring Framework - AOP
Spring Framework - AOPSpring Framework - AOP
Spring Framework - AOP
 
Connecting Connect with Spring Boot
Connecting Connect with Spring BootConnecting Connect with Spring Boot
Connecting Connect with Spring Boot
 
Introduction to Spring Boot!
Introduction to Spring Boot!Introduction to Spring Boot!
Introduction to Spring Boot!
 
Spring Boot
Spring BootSpring Boot
Spring Boot
 
Spring Boot
Spring BootSpring Boot
Spring Boot
 
Testing Spring Boot Applications
Testing Spring Boot ApplicationsTesting Spring Boot Applications
Testing Spring Boot Applications
 
Spring jdbc
Spring jdbcSpring jdbc
Spring jdbc
 
Hibernate presentation
Hibernate presentationHibernate presentation
Hibernate presentation
 
JPA and Hibernate
JPA and HibernateJPA and Hibernate
JPA and Hibernate
 
DSL, Page Object and Selenium – a way to reliable functional tests
DSL, Page Object and Selenium – a way to reliable functional testsDSL, Page Object and Selenium – a way to reliable functional tests
DSL, Page Object and Selenium – a way to reliable functional tests
 
Spring Boot
Spring BootSpring Boot
Spring Boot
 
Git interview questions | Edureka
Git interview questions | EdurekaGit interview questions | Edureka
Git interview questions | Edureka
 
Java Hibernate Programming with Architecture Diagram and Example
Java Hibernate Programming with Architecture Diagram and ExampleJava Hibernate Programming with Architecture Diagram and Example
Java Hibernate Programming with Architecture Diagram and Example
 
Spring boot
Spring bootSpring boot
Spring boot
 
Spring Data JPA
Spring Data JPASpring Data JPA
Spring Data JPA
 
Spring boot introduction
Spring boot introductionSpring boot introduction
Spring boot introduction
 

Viewers also liked

Spring Framework - Core
Spring Framework - CoreSpring Framework - Core
Spring Framework - CoreDzmitry Naskou
 
Java se 8 fundamentals
Java se 8 fundamentalsJava se 8 fundamentals
Java se 8 fundamentalsmegharajk
 
OCA Java SE 8 Exam Chapter 4 Methods Encapsulation
OCA Java SE 8 Exam Chapter 4 Methods EncapsulationOCA Java SE 8 Exam Chapter 4 Methods Encapsulation
OCA Java SE 8 Exam Chapter 4 Methods Encapsulationİbrahim Kürce
 
Spring Framework Petclinic sample application
Spring Framework Petclinic sample applicationSpring Framework Petclinic sample application
Spring Framework Petclinic sample applicationAntoine Rey
 

Viewers also liked (6)

Spring Framework - Core
Spring Framework - CoreSpring Framework - Core
Spring Framework - Core
 
Java 8 date & time api
Java 8 date & time apiJava 8 date & time api
Java 8 date & time api
 
1z0-808-certification-questions-sample
1z0-808-certification-questions-sample1z0-808-certification-questions-sample
1z0-808-certification-questions-sample
 
Java se 8 fundamentals
Java se 8 fundamentalsJava se 8 fundamentals
Java se 8 fundamentals
 
OCA Java SE 8 Exam Chapter 4 Methods Encapsulation
OCA Java SE 8 Exam Chapter 4 Methods EncapsulationOCA Java SE 8 Exam Chapter 4 Methods Encapsulation
OCA Java SE 8 Exam Chapter 4 Methods Encapsulation
 
Spring Framework Petclinic sample application
Spring Framework Petclinic sample applicationSpring Framework Petclinic sample application
Spring Framework Petclinic sample application
 

Similar to Spring Certification Questions

Spring certification-mock-exam
Spring certification-mock-examSpring certification-mock-exam
Spring certification-mock-examdmz networks
 
1z0 804 exam-java se 7 programmer ii
1z0 804 exam-java se 7 programmer ii1z0 804 exam-java se 7 programmer ii
1z0 804 exam-java se 7 programmer iiIsabella789
 
C# programming constructors
C# programming  constructorsC# programming  constructors
C# programming constructors성진 원
 
Quiz1 tonghop
 Quiz1 tonghop Quiz1 tonghop
Quiz1 tonghopDaewoo Han
 
BISH CS Modle Exit Exam.doc
BISH CS Modle Exit Exam.docBISH CS Modle Exit Exam.doc
BISH CS Modle Exit Exam.docAnimutGeremew3
 
Google.Test4prep.Professional-Data-Engineer.v2038q.pdf
Google.Test4prep.Professional-Data-Engineer.v2038q.pdfGoogle.Test4prep.Professional-Data-Engineer.v2038q.pdf
Google.Test4prep.Professional-Data-Engineer.v2038q.pdfssuser22b701
 
Comp 328 final guide
Comp 328 final guideComp 328 final guide
Comp 328 final guidekrtioplal
 
PEGA CSSA Dumps | PEGA 7.1 CSSA Dumps
PEGA CSSA  Dumps | PEGA 7.1 CSSA Dumps PEGA CSSA  Dumps | PEGA 7.1 CSSA Dumps
PEGA CSSA Dumps | PEGA 7.1 CSSA Dumps Ashock Roy
 
Cssa 7.2 Training And Dump
Cssa 7.2 Training And Dump Cssa 7.2 Training And Dump
Cssa 7.2 Training And Dump Santhoo Vardan
 
Oracle Certification 1Z0-1041 Questions and Answers
Oracle Certification 1Z0-1041 Questions and AnswersOracle Certification 1Z0-1041 Questions and Answers
Oracle Certification 1Z0-1041 Questions and Answersdouglascarnicelli
 
Ace exam guide_flex4
Ace exam guide_flex4Ace exam guide_flex4
Ace exam guide_flex4Ana Neves
 
gratisexam.com-Oracle.BrainDumps.1z0-061.v2016-10-10.by.Laura.75q.pdf
gratisexam.com-Oracle.BrainDumps.1z0-061.v2016-10-10.by.Laura.75q.pdfgratisexam.com-Oracle.BrainDumps.1z0-061.v2016-10-10.by.Laura.75q.pdf
gratisexam.com-Oracle.BrainDumps.1z0-061.v2016-10-10.by.Laura.75q.pdfNarReg
 
Prueba de conociemientos Fullsctack NET v2.docx
Prueba de conociemientos  Fullsctack NET v2.docxPrueba de conociemientos  Fullsctack NET v2.docx
Prueba de conociemientos Fullsctack NET v2.docxjairatuesta
 
Oracle Certified Associate (OCA) Java SE 8 Programmer II (1Z0-809) - Practice...
Oracle Certified Associate (OCA) Java SE 8 Programmer II (1Z0-809) - Practice...Oracle Certified Associate (OCA) Java SE 8 Programmer II (1Z0-809) - Practice...
Oracle Certified Associate (OCA) Java SE 8 Programmer II (1Z0-809) - Practice...Udayan Khattry
 

Similar to Spring Certification Questions (20)

Spring certification-mock-exam
Spring certification-mock-examSpring certification-mock-exam
Spring certification-mock-exam
 
1z0 804 exam-java se 7 programmer ii
1z0 804 exam-java se 7 programmer ii1z0 804 exam-java se 7 programmer ii
1z0 804 exam-java se 7 programmer ii
 
C# programming constructors
C# programming  constructorsC# programming  constructors
C# programming constructors
 
Quiz1 tonghop
 Quiz1 tonghop Quiz1 tonghop
Quiz1 tonghop
 
Let's talk about Certifications
Let's talk about CertificationsLet's talk about Certifications
Let's talk about Certifications
 
Ado1 exam dumps
Ado1 exam dumpsAdo1 exam dumps
Ado1 exam dumps
 
BISH CS Modle Exit Exam.doc
BISH CS Modle Exit Exam.docBISH CS Modle Exit Exam.doc
BISH CS Modle Exit Exam.doc
 
exa_cer_g23
exa_cer_g23exa_cer_g23
exa_cer_g23
 
Google.Test4prep.Professional-Data-Engineer.v2038q.pdf
Google.Test4prep.Professional-Data-Engineer.v2038q.pdfGoogle.Test4prep.Professional-Data-Engineer.v2038q.pdf
Google.Test4prep.Professional-Data-Engineer.v2038q.pdf
 
Comp 328 final guide
Comp 328 final guideComp 328 final guide
Comp 328 final guide
 
PEGA CSSA Dumps | PEGA 7.1 CSSA Dumps
PEGA CSSA  Dumps | PEGA 7.1 CSSA Dumps PEGA CSSA  Dumps | PEGA 7.1 CSSA Dumps
PEGA CSSA Dumps | PEGA 7.1 CSSA Dumps
 
Cssa 7.2 Training And Dump
Cssa 7.2 Training And Dump Cssa 7.2 Training And Dump
Cssa 7.2 Training And Dump
 
CORE JAVA
CORE JAVACORE JAVA
CORE JAVA
 
Vb.net
Vb.netVb.net
Vb.net
 
1z0 808[1]
1z0 808[1]1z0 808[1]
1z0 808[1]
 
Oracle Certification 1Z0-1041 Questions and Answers
Oracle Certification 1Z0-1041 Questions and AnswersOracle Certification 1Z0-1041 Questions and Answers
Oracle Certification 1Z0-1041 Questions and Answers
 
Ace exam guide_flex4
Ace exam guide_flex4Ace exam guide_flex4
Ace exam guide_flex4
 
gratisexam.com-Oracle.BrainDumps.1z0-061.v2016-10-10.by.Laura.75q.pdf
gratisexam.com-Oracle.BrainDumps.1z0-061.v2016-10-10.by.Laura.75q.pdfgratisexam.com-Oracle.BrainDumps.1z0-061.v2016-10-10.by.Laura.75q.pdf
gratisexam.com-Oracle.BrainDumps.1z0-061.v2016-10-10.by.Laura.75q.pdf
 
Prueba de conociemientos Fullsctack NET v2.docx
Prueba de conociemientos  Fullsctack NET v2.docxPrueba de conociemientos  Fullsctack NET v2.docx
Prueba de conociemientos Fullsctack NET v2.docx
 
Oracle Certified Associate (OCA) Java SE 8 Programmer II (1Z0-809) - Practice...
Oracle Certified Associate (OCA) Java SE 8 Programmer II (1Z0-809) - Practice...Oracle Certified Associate (OCA) Java SE 8 Programmer II (1Z0-809) - Practice...
Oracle Certified Associate (OCA) Java SE 8 Programmer II (1Z0-809) - Practice...
 

Recently uploaded

Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Disha Kariya
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...Sapna Thakur
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpinRaunakKeshri1
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDThiyagu K
 
The byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptxThe byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptxShobhayan Kirtania
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...anjaliyadav012327
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajanpragatimahajan3
 

Recently uploaded (20)

Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
The byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptxThe byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptx
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajan
 

Spring Certification Questions

  • 1. WWW.SPRINGMOCKEXAMS.COM Page of1 9 Spring Certification Questions Free on-line spring certification test available at https://www.springmockexams.com Enrol now to get full access to a set of four Spring Mock Exams using our exam simulator. ENROLLING NOW YOU WILL GET ACCESS TO 200 UNIQUE SPRING CERTIFICATION QUESTIONS. QUESTION 1 https://www.springmockexams.com/spring/mock/spring-mock-exam.html Spring Certification Question: Which of the following is true regarding the @Autowired annotation? Select Your Answer: A: It is possible to provide all beans of a particular type from the ApplicationContext by adding the annotation to a field or method that expects an array of that type. B: Typed Maps can be autowired as long as the expected key type is String. C: By default, the autowiring fails whenever zero candidate beans are available. D: All of the above. The answer is: D Explanation: A: public class MovieRecommender { @Autowired private MovieCatalog[] movieCatalogs; // ... } B:public class MovieRecommender {
  • 2. WWW.SPRINGMOCKEXAMS.COM Page of2 9 private Map<String, MovieCatalog> movieCatalogs; @Autowired public void setMovieCatalogs(Map<String, MovieCatalog> movieCatalogs) { this.movieCatalogs = movieCatalogs; } // ... } C: This is true. If no candidate are available, an exception will be thrown. D: They are all true. QUESTION 2 Spring Certification Question: By default, when you use XmlWebApplicationContext, the configuration will be taken from "/WEB-INF/applicationContext.xml" for the root context, and "/ WEB-INF/test-servlet.xml" for a context with the namespace "test-servlet". Which of those pieces of code can override the default config location? Select all that apply: A: <servlet> <servlet-name>accounts</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <init-param> <param-name>contextConfigLocation</param-name> <param-value> /WEB-INF/mvc-config.xml </param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> B: <context-param> </context-param> <context-param> <param-name>spring.profiles.active</param-name> <param-value>jpa</param-value> </context-param> C: <listener> <listener-class> <param-name>contextConfigLocation</param-name> <param-value>/WEB-INF/app-config.xml</param-value> </listener-class>
  • 3. WWW.SPRINGMOCKEXAMS.COM Page of3 9 </listener> D: None of the above The answers are: A, B Explanation: A:The config location defaults can be overridden via the "contextConfigLocation" context-param of ContextLoader. B:The config location defaults can be overridden via the servlet init-param of FrameworkServlet. C:The listener section is used to define a ContextLoaderListener and it does not impact the application context location. D:A and B are true. QUESTION 3 Spring Certification Question: Which are valid method signatures for the method ClassPathXmlApplicationContext.getBean(): Select all that apply: A: Object getBean(String name) throws BeansException. B: <T> T getBean(String name, Class<T> requiredType) throws BeansException. C: <T> T getBean(String name, String requiredType) throws BeansException. D: <T> T getBean(Class<T> requiredType) throws BeansException. E: All of the above. The answers are: A,B,D Explanation: A: Return an instance, which may be shared or independent, of the specified bean name. B: Behaves the same as getBean(String), but provides a measure of type safety by throwing a BeanNotOfRequiredTypeException if the bean is not of the required type. C: This method signature does not exist. D: Return the bean instance that uniquely matches the given object type, if any. E: Only A,B,D are true. QUESTION 4 Spring Certification Question: Which of these is the best description of an AOP Aspect? Select Your Answer: A: A point in the execution of a program such as a method call or field assignment. B: An expression that Selects one or more Join Points.
  • 4. WWW.SPRINGMOCKEXAMS.COM Page of4 9 C: Code to be executed at a Join Point that has been Selected by a Pointcut. D: A module that encapsulates pointcuts and advice. E: None of the above. The answer is: D Explanation: A: This is a Join Point. B: This is a Pointcut. C: This is an Advice. D: This is an Aspect. E: D is true. QUESTION 5 Spring Certification Question: Which of the following are false regarding Spring AOP? Select all that apply: A: It can advice any Join Points. B: Can only apply aspects to Spring Beans. C: Spring adds behaviour using dynamic proxies if a Join Point is declared on a class. D: If a Join Point is in a class with no interface, Spring will use CGLIB for weaving. E: CGLIB proxies can be applied to final classes or methods. The answers are: A, C, E Explanation: A: False. It can advice only public Join Points. B: True. This one of the limitation. C: False. Spring uses dynamic proxies if a Join Point is declared on an interface. D: True. CGLIB is used for weaving class aspects. E: False. It cannot be applied to final classes or methods. QUESTION 6 Spring Certification Question: Which of the following is false regarding the following code and HttpInvokerProxyFactoryBean? <bean id="httpInvokerProxy" class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">
  • 5. WWW.SPRINGMOCKEXAMS.COM Page of5 9 <property name="serviceUrl" value="http://remotehost:8080/remoting/AccountService"/> <property name="serviceInterface" value="example.AccountService"/> </bean> Select one answer: A: This is client-side code. B: Spring will translate your calls to HTTP POST requests. C: HttpInvokerProxy uses Commons HttpClient by default. D: Spring will send HTTP POST request to the defined URL which is http://remotehost:8080/ remoting/AccountService. E: The service URL must be an HTTP URL exposing an HTTP invoker service. The answer is: C Explanation: By default, the HttpInvokerProxy uses the J2SE HTTP functionality, but you can also use the Commons HttpClient by setting the httpInvokerRequestExecutor property: <property name="httpInvokerRequestExecutor"> <bean class="org.springframework.remoting.httpinvoker.CommonsHttpInvokerRequestExecutor"/> </property> This is a difficult question but we found something similar on the real exam. QUESTION 7 Spring Certification Question: Which of the following is true regarding the annotation @RequestParam in the following piece of code: @Controller @RequestMapping("EDIT") @SessionAttributes("site") public class PetSitesEditController { // ... public void removeSite(@RequestParam("site") String site, ActionResponse response) { this.petSites.remove(site); response.setRenderParameter("action", "list"); } // ... } !Select all that apply:
  • 6. WWW.SPRINGMOCKEXAMS.COM Page of6 9 A: The @RequestParam annotation is used to extract a parameter from the HTTP response and bind them to a method parameter. B: The @RequestParam annotation can automatically perform type conversion. C: Parameters using this annotation are required by default. D: It differs from @PathVariable because with the latest you can extract value directly from the request URL using the URI Templates. E: All of the above. The answers are: B, C, D Explanation: A: False. The @RequestParam annotation is used to bind request parameters to a method parameter in your controller. This @Controller will be an entry point for mapping HTTP requests. B: This is true. In this case, a request of the form http://localhost:8080/....../EDIT.html?site=xxx would convert xxx in a string and assign it to the method parameter "site". C: This is true as well, but you can specify that a parameter is optional by setting @RequestParam's annotationâs ârequiredâ attribute to false (e.g., @RequestParam(value="id", required=false)) making it optional. D: This is true as well. @PathVariable can take advance from the usage of placeholders that will extract the method parameter directly from the request URL. For instance: @Controller @RequestMapping(value = "/pets/{petId}", method = RequestMethod.GET, produces="application/ json") @ResponseBody public Pet getPet(@PathVariable String petId, Model model) { // implementation omitted } E: Only B, C and D are true so this one is false. QUESTION 8 Spring Certification Question: Which of the following are true regarding the following piece of code? <tx:annotation-driven/> <bean id="txManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"> <property name="dataSource" ref="dataSource"/> </bean> <jdbc:embedded-database id="dataSource"> <jdbc:script location="classpath:rewards/testdb/schema.sql"/> <jdbc:script location="classpath:rewards/testdb/test-data.sql"/> </jdbc:embedded-database> Select all that apply: A: It is declaring a container-managed datasource (via JNDI).
  • 7. WWW.SPRINGMOCKEXAMS.COM Page of7 9 B: DataSourceTransactionManager it is a subclass of AbstractPlatformTransactionManager. C: It is defining a Transaction manager with id txManager for supporting transaction management. D: It is defining a bean Post-processor that proxies @Transactional annotated bean <tx:annotation-driven/>. E: None of the above. The answers are: B, C, D Explanation: A: False, it is declaring a local datasource using the tags <jdbc:embedded-database> ... </ jdbc:embedded-database>. The preceding configuration creates an embedded HSQL database populated with SQL from schema.sql and testdata.sql resources in the classpath. The database instance is made available to the Spring container as a bean of type javax.sql.DataSource. This bean can then be injected into data access objects as needed. B: True. It is a PlatformTransactionManager implementation for a single JDBC DataSource. It binds a JDBC Connection from the specified DataSource to the current thread, potentially allowing for one thread-bound Connection per DataSource. C: True, this is needed for providing Spring transaction support. D: True. This is the most tricky question because the declaration of the bean post processor it is hidden in the tag <tx:annotation-driven/>. Remember that you can mark any method with the @Transactional annotation but the mere presence of the @Transactional annotation is not enough to activate the transactional behavior. <tx:annotation-driven/> element switches on the transactional behavior. E: A is not true so this does not apply. QUESTION 9 Spring Certification Question: The method "convertAndSend" of the jmsTemplate interface, it is used to send an object to a destination, converting the object to a JMS message. Which of the following are valid definitions of this method? Select all that apply: A: convertAndSend(Destination destination, Object message). B: convertAndSend(Object message). C: convertAndSend(String destinationName, Object message). D: convertAndSend(Object message, Destination destination). E: All of the above. The answers are: A, B, C Explanation: A: Send the given object to the specified destination, converting the object to a JMS message with a configured MessageConverter. B: Send the given object to the default destination, converting the object to a JMS message with a configured MessageConverter. C: Send the given object to the specified destination, converting the object to a JMS message with a configured MessageConverter.
  • 8. WWW.SPRINGMOCKEXAMS.COM Page of8 9 D: There is no such method definition. This is a compiler error. E: Only A,B,C are true. QUESTION 10 Spring Certification Question: When using JMX which one is false regarding the following piece of configuration? <beans> <bean id="exporter" class="org.springframework.jmx.export.MBeanExporter"> <property name="beans"> <map> <entry key="bean:name=testBean1" value-ref="testBean"/> </map> </property> </bean> <bean id="testBean" class="org.springframework.jmx.JmxTestBean"> <property name="name" value="TEST"/> <property name="age" value="100"/> </bean> </beans> Select all that apply: A: The bean "exporter" will export a bean to the JMX MBeanServer. B: "testBean" bean is exposed as an MBean under the ObjectName bean:name=testBean1. C: The bean "exporter" can be lazily initialized. D: By default, all public properties of the bean are exposed as attributes and all public methods are exposed as operations. E: All of the above. The answers are: C, E Explanation: A: This is exactly the aim of the exporter. The bean "testBean" will be exported as an MBean with name of "testBean1". B: This is true. The key of each entry in the beans Map is used as the ObjectName for the bean referenced by the corresponding entry value by default. C: This is false. Exporter bean must not be lazily initialized if the exporting is to happen. If you configure a bean with the MBeanExporter that is also configured for lazy initialization, then the MBeanExporter will not break this contract and will avoid instantiating the bean. Instead, it will register a proxy with the MBeanServer and will defer obtaining the bean from the container until the first invocation on the proxy occurs. D: This is true. The default policy is to expose all properties and all public methods of the bean.
  • 9. WWW.SPRINGMOCKEXAMS.COM Page of9 9 E: False. Only C is false of the above so this is false as well.