Explore topic-wise MCQs in Spring.

This section includes 20 Mcqs, each offering curated multiple-choice questions to sharpen your Spring knowledge and support exam preparation. Choose a topic below to get started.

1.

Test fixtures injected from the managed application context by annotating:-

A. @Autowired
B. @Resource
C. All of the mentioned
D. None of the mentioned
Answer» D. None of the mentioned
2.

AbstractDependencyInjectionSpringContextTests supports dependency injection.

A. auto-wires beans by type via setter methods
B. auto-wires beans by name via protected fields
C. none of the mentioned
D. all of the mentioned
Answer» D. all of the mentioned
3.

Spring JUnit 3 legacy support in releases prior to 2.5, your test class can extend the:-

A. AbstractDependencyInjectionSpringContextTests
B. AbstractSingleSpringContextTests
C. All of the mentioned
D. None of the mentioned
Answer» B. AbstractSingleSpringContextTests
4.

AbstractJUnit38SpringContext class also implements the ApplicationContextAware interface.

A. True
B. False
Answer» C.
5.

This class implements the ApplicationContextAware interface, so you can get access to the managed application context:-

A. AbstractJUnit38SpringContext
B. AbstractJUnit38Spring
C. AbstractJUnit38SpringContextTests
D. None of the mentioned
Answer» D. None of the mentioned
6.

ABSTRACTJUNIT38SPRINGCONTEXT_CLASS_ALSO_IMPLEMENTS_THE_APPLICATIONCONTEXTAWARE_INTERFACE.?$

A. True
B. False
Answer» C.
7.

AbstractDependencyInjectionSpringContextTests supports dependency injection.$

A. auto-wires beans by type via setter methods
B. auto-wires beans by name via protected fields
C. none of the mentioned
D. all of the mentioned
Answer» D. all of the mentioned
8.

Spring_JUnit_3_legacy_support_in_releases_prior_to_2.5,_your_test_class_can_extend_the:-$

A. AbstractDependencyInjectionSpringContextTests
B. AbstractSingleSpringContextTests
C. All of the mentioned
D. None of the mentioned
Answer» B. AbstractSingleSpringContextTests
9.

Annotation for TransactionalTestExecutionListener:-

A. @Transactional
B. @RunWith
C. @Run
D. None of the mentioned
Answer» B. @RunWith
10.

Starting from Spring 2.5, the TestContext framework provides a test execution listener related to transaction management:-

A. TransactionalTestExecutionListener
B. TransactionalTestExecution
C. All of the mentioned
D. None of the mentioned
Answer» B. TransactionalTestExecution
11.

TestContext support class AbstractJUnit4SpringContextTests, you can also have test fixtures injected from the managed application context.

A. True
B. False
Answer» B. False
12.

Test_fixtures_injected_from_the_managed_application_context_by_annotating:-

A. @Autowired
B. @Resource
C. All of the mentioned
D. None of the mentioned
Answer» D. None of the mentioned
13.

This class implements the ApplicationContextAware interface, so you can get access to the managed application context:?

A. AbstractJUnit38SpringContext
B. AbstractJUnit38Spring
C. AbstractJUnit38SpringContextTests
D. None of the mentioned
Answer» D. None of the mentioned
14.

Annotation for SpringJUnit4ClassRunner:-

A. @Run
B. @RunWith
C. All of the mentioned
D. None of the mentioned
Answer» C. All of the mentioned
15.

In JUnit4, to explicitly specify a Spring-specific test runner for running your test.

A. SpringJUnit4ClassRunner
B. SpringJUnit4Class
C. SpringJUnit4
D. None of the mentioned
Answer» B. SpringJUnit4Class
16.

Method to indicate that the application context is dirty.

A. getDirty()
B. setDirty()
C. all of the mentioned
D. none of the mentioned
Answer» C. all of the mentioned
17.

In JUnit 4, you can simply run your test with the test runner SpringJUnit4ClassRunner.

A. True
B. False
Answer» B. False
18.

Interface which can provide access to the managed application context through the protected field applicationContext:-

A. ApplicationContextAware
B. ApplicationContext
C. ApplicationContextAwareContext
D. None of the mentioned
Answer» B. ApplicationContext
19.

The TestContext framework provides two test execution listeners related to context management:-

A. DependencyInjectionTestExecutionListener
B. DirtiesContextTestExecutionListener
C. All of the mentioned
D. None of the mentioned
Answer» D. None of the mentioned
20.

Base class to access the managed application context through the inherited getApplicationContext() method.

A. AbstractSingleSpringContextTests
B. AbstractSingleSpring
C. Test context listener
D. Test execution listener
Answer» B. AbstractSingleSpring