Spring Quiz Test 4, Spring Online Quiz Series 4, Spring Online Test
Finish Quiz
0 of 20 questions completed
Questions:
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
Information
Spring Quiz Test 4, Spring Online Quiz Series 4, Spring Online Test, Free Java OOPs Quiz, Online Java, online Test Quiz 4. Spring Online Quiz 4 Question and Answers 2047. Java online Test Quiz 4. Java OOPs Quiz 4 Free Mock Test 2019. Spring Online Quiz 4 Question and Answers in PDF. The Java online mock test paper is free for all students. Spring Online is very useful for exam preparation and getting for Rank. Spring Online Quiz 4 Question and Answers in English. Java OOPs Mock test for topic via OOPs Mode. Here we are providing Spring Online Quiz in English Now Test your self for “Spring Online in English” Exam by using below quiz…
This paper has 20 questions.
Time allowed is 25 minutes.
The Java OOPs Mock Test is Very helpful for all students. Now Scroll down below n click on “Start Quiz” or “Start Test” and Test yourself.
You have already completed the quiz before. Hence you can not start it again.
Quiz is loading...
You must sign in or sign up to start the quiz.
You have to finish following quiz, to start this quiz:
Results
0 of 20 questions answered correctly
Your time:
Time has elapsed
You have reached 0 of 0 points, (0)
Average score |
|
Your score |
|
Categories
- Not categorized 0%
Pos. | Name | Entered on | Points | Result |
---|---|---|---|---|
Table is loading | ||||
No data available | ||||
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- Answered
- Review
-
Question 1 of 20
1. Question
How could you externalize constants from a Spring configuration file or a Spring annotation into a
.properties file? Select one or more answersCorrect
1. The
tag enables to reference a Java constant or
enumeration into a spring configuration file
2. ConstantPlaceholderConfigurer does not exist. You may think about the PropertyPlaceholderConfigurer bean post processor.
3. Thetag activates the
replacement of ${…} placeholders, resolved against the specified properties file.
4. The c: namespace is for simplifying constructor syntax (since Spring 3.1) and don´t provide
such feature.Incorrect
1. The
tag enables to reference a Java constant or
enumeration into a spring configuration file
2. ConstantPlaceholderConfigurer does not exist. You may think about the PropertyPlaceholderConfigurer bean post processor.
3. Thetag activates the
replacement of ${…} placeholders, resolved against the specified properties file.
4. The c: namespace is for simplifying constructor syntax (since Spring 3.1) and don´t provide
such feature. -
Question 2 of 20
2. Question
What statement is not correct in live environment? Select a unique answer.
Correct
1. You may auto-wiring properties by constructor, setter or properties in the same bean
2. Thetag helps to instanciated a bean without default or no-args constructor
3. Thetag could take type and index to reduce ambiguity, but not name which requires debug symbols. Incorrect
1. You may auto-wiring properties by constructor, setter or properties in the same bean
2. Thetag helps to instanciated a bean without default or no-args constructor
3. Thetag could take type and index to reduce ambiguity, but not name which requires debug symbols. -
Question 3 of 20
3. Question
How to auto-inject into a field a bean by its name? Select one or more response.
Correct
Incorrect
-
Question 4 of 20
4. Question
What are the main advantages of using interfaces when designing business services? Select answer.
Correct
1. With modern mock API like Mockito or EasyMock, interfaces are not mandatory for mocking or stubbing the service. But using interface remains easier when you have to manually mock the service in unit test.
2. Auto-injection is possible with class. Spring uses CGLIB.
3. Dependency checking is an advantage of dependencies injection.Incorrect
1. With modern mock API like Mockito or EasyMock, interfaces are not mandatory for mocking or stubbing the service. But using interface remains easier when you have to manually mock the service in unit test.
2. Auto-injection is possible with class. Spring uses CGLIB.
3. Dependency checking is an advantage of dependencies injection. -
Question 5 of 20
5. Question
Given the following Spring configuration file, what is the correct answer:
Correct
Those beans are anonymous because no id is supplied explicitly. Thus Spring container generates a unique id for that bean. It uses the fully qualified class name and appends a number to them. However, if you want to refer to that bean by name, through the use of the ref element you must provide a name. To be correct, the 2nd bean has to declare a jpaDao id attribute in order to be reference by the repository property of the first bean.
Incorrect
Those beans are anonymous because no id is supplied explicitly. Thus Spring container generates a unique id for that bean. It uses the fully qualified class name and appends a number to them. However, if you want to refer to that bean by name, through the use of the ref element you must provide a name. To be correct, the 2nd bean has to declare a jpaDao id attribute in order to be reference by the repository property of the first bean.
-
Question 6 of 20
6. Question
What one is not the right affirmations about the @PostConstruct, @Resource and the @PreDestroy annotations?
Correct
Incorrect
-
Question 7 of 20
7. Question
Given the Spring configuration file, which are the correct statements?
p:bankName=”NationalBank”>
Correct
Incorrect
-
Question 8 of 20
8. Question
How is named the bean that is defined in the following configuration class. Select a single answer.
@Configuration
public class ApplicationConfig {
@Autowired
private DataSource dataSource;
@Bean
ClientRepository clientRepository() {
ClientRepository accountRepository = new JpaClientRepository();
accountRepository.setDataSource(dataSource);
return accountRepository;
}
}Correct
The @Bean annotation defines a String bean with the id clientRepository. JpaClientRepository is the implementation class of the bean. The data source is injected and is not declared in this class.
Incorrect
The @Bean annotation defines a String bean with the id clientRepository. JpaClientRepository is the implementation class of the bean. The data source is injected and is not declared in this class.
-
Question 9 of 20
9. Question
What is/are typically case(s) where you usually need to manually instanciated an ApplicationContext?
Correct
1. In a web application, the ContextLoaderListener is in charge to create an WebApplicationContext.
2. In an integration test based on Spring, the SpringJUnit4ClassRunner creates the application context for you. The @ContextConfiguration annotation allows to specified application context configuration files.
3. In a main method, you have to instanciated a class implementing the ApplicationContext interface (examples: ClassPathXmlApplicationContext or FileSystemXmlApplicationContext)Incorrect
1. In a web application, the ContextLoaderListener is in charge to create an WebApplicationContext.
2. In an integration test based on Spring, the SpringJUnit4ClassRunner creates the application context for you. The @ContextConfiguration annotation allows to specified application context configuration files.
3. In a main method, you have to instanciated a class implementing the ApplicationContext interface (examples: ClassPathXmlApplicationContext or FileSystemXmlApplicationContext) -
Question 10 of 20
10. Question
Select the right statement about referring a Spring configuration file inside the package
com.example.myapp in the below example?
ApplicationContext context = new
ClassPathXmlApplicationContext(“classpath:/com.example.myapp.config.xml”);Correct
1. When using the ClassPathXmlApplicationContext, the classpath: prefix is default one so you could omit it
2. In a Spring location resource, package separator is a slash and not a dot. Thus the com/example/myapp/config.xml syntax has to be used.
3. ClassPathXmlApplicationContext starts looking from root of the classpath regardless of whether specify “/”Incorrect
1. When using the ClassPathXmlApplicationContext, the classpath: prefix is default one so you could omit it
2. In a Spring location resource, package separator is a slash and not a dot. Thus the com/example/myapp/config.xml syntax has to be used.
3. ClassPathXmlApplicationContext starts looking from root of the classpath regardless of whether specify “/” -
Question 11 of 20
11. Question
What are the main advantage(s) for using Spring when writing unit tests?
Correct
What are the main advantage(s) for using Spring when writing unit tests?
1. You don´t need Spring container to writer unit test
2. Refer to the answer number 1.
3. The org.springframework.mock package provides mock classes like MockHttpSession or MockHttpContext. They could be helpful for unit test in the presentation layer and when you don´t use any mock framework such as Mockity or EasyMock.Incorrect
What are the main advantage(s) for using Spring when writing unit tests?
1. You don´t need Spring container to writer unit test
2. Refer to the answer number 1.
3. The org.springframework.mock package provides mock classes like MockHttpSession or MockHttpContext. They could be helpful for unit test in the presentation layer and when you don´t use any mock framework such as Mockity or EasyMock. -
Question 12 of 20
12. Question
Select one correct answer about spring bean life cycle.
Correct
1. In the bean lifecycle, method annotated with @PostConstruct is called after the properties set step and the BeanPostProcessors#postProcessBeforeInitialization step
2. Destroy methods of prototype beans are never called
3. In the bean lifecycle, the afterPropertiesSet callback method of the InitializingBean is called after the method annotated with the @PostConstruct annotation and before the init-method declared in the XML configuration file.
4. In the bean lifecycle, the method annotated with the @PreDestroy annotation is called before the destroy callback of the DisposableBean interface and before the destroy-method declared in the XML configuration file.Incorrect
1. In the bean lifecycle, method annotated with @PostConstruct is called after the properties set step and the BeanPostProcessors#postProcessBeforeInitialization step
2. Destroy methods of prototype beans are never called
3. In the bean lifecycle, the afterPropertiesSet callback method of the InitializingBean is called after the method annotated with the @PostConstruct annotation and before the init-method declared in the XML configuration file.
4. In the bean lifecycle, the method annotated with the @PreDestroy annotation is called before the destroy callback of the DisposableBean interface and before the destroy-method declared in the XML configuration file. -
Question 13 of 20
13. Question
Select correct statement about transactional support of the spring test module.
Correct
Incorrect
-
Question 14 of 20
14. Question
What is/are typically case(s) where you usually need to manually instanciated an ApplicationContext?
Correct
Incorrect
-
Question 15 of 20
15. Question
What is right about the spring test module?
Correct
Incorrect
-
Question 16 of 20
16. Question
Select correct statement about developing integration test with Spring support.
Correct
1. The Spring context is cached across tests unless you use @DirtiesContext annotation
2. With the Spring test module, dependency injection is available in test case. So you may autowired the bean to test
3. By default, a @ContextConfiguration annoted class inherits the spring context configuration file locations defined by an annotated superclass. The inheritLocations of this attribute allows to change this default behavior.
4. If no context configuration file is provided to the @ContextConfiguration annotation, Spring use a file convention naming. It try to load a file named with the test class name and suffices by the “-context.xml” suffice (i.e. MyDaoTest-context.xml)Incorrect
1. The Spring context is cached across tests unless you use @DirtiesContext annotation
2. With the Spring test module, dependency injection is available in test case. So you may autowired the bean to test
3. By default, a @ContextConfiguration annoted class inherits the spring context configuration file locations defined by an annotated superclass. The inheritLocations of this attribute allows to change this default behavior.
4. If no context configuration file is provided to the @ContextConfiguration annotation, Spring use a file convention naming. It try to load a file named with the test class name and suffices by the “-context.xml” suffice (i.e. MyDaoTest-context.xml) -
Question 17 of 20
17. Question
What are the features of the XML
Correct
1. Use
to enable @Transactional annotation scanning
2. Useto enable detection of @Aspect bean
3. Turns onor to enable @Autowiring annotation Incorrect
1. Use
to enable @Transactional annotation scanning
2. Useto enable detection of @Aspect bean
3. Turns onor to enable @Autowiring annotation -
Question 18 of 20
18. Question
What statement is not correct in live environment? Select a unique answer.
Correct
Incorrect
-
Question 19 of 20
19. Question
Which one is not correct about the advantages for using Spring when writing integration tests?
Correct
Mocking or stubbing is more frequent in unit tests than in integration tests. And Spring does not provide any implementation or abstraction of mock framework.
Incorrect
Mocking or stubbing is more frequent in unit tests than in integration tests. And Spring does not provide any implementation or abstraction of mock framework.
-
Question 20 of 20
20. Question
Given the following configuration class, what are correct affirmations? Select one or more answers.
public class ApplicationConfig {
private DataSource dataSource;
@Autowired
public ApplicationConfig(DataSource dataSource) {
this.dataSource = dataSource;
}
@Bean(name=”clientRepository”)
ClientRepository jpaClientRepository() {
return new JpaClientRepository();
}
}Correct
1. In order to be taken into account by Spring, the ApplicationConfig class has to be annotated with the @Configuration annotation
Incorrect
1. In order to be taken into account by Spring, the ApplicationConfig class has to be annotated with the @Configuration annotation