GoConqr has a new look! Let us know what you think.

Quiz

Core Spring 4.2 Certification Mock Exam

antoine.rey 50 questions 20,703 views 4.3 (3 ratings)

Take the quiz

This quiz has a time limit, so it opens in the usual player.

Questions in this quiz (50)

  1. 1Given the following Spring configuration file, what is the correct answer:

    <bean class="com.spring.service.MyServiceImpl">
    <property name="repository" ref="jpaDao"/>
    </bean>

    <bean class="com.spring.repository.JpaDao"/>
    1. AThe first declared bean MyServiceImpl is missing an id must be named myService
    2. BThe second declared bean JpaDao is missing an id must be named jpaDao
    3. CAnswers 1 and 2 are both rights
    4. DAnswers 1 and 2 are both wrong
  2. 2Given the Spring configuration file, which are the correct statements?
    <bean class="com.spring.service.BankServiceImpl"
    p:bankName="NationalBank">
    </bean>
    1. AThe p namespace has to be declared
    2. BBean id is bankServiceImpl
    3. CThe BankServiceImpl references a NationalBank bean
    4. DNationalBank is a scalar value
  3. 3What the name of the bean 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;
    }
    }
    1. AJpaClientRepository
    2. BjpaClientRepository
    3. CclientRepository
    4. DTwo beans are defined: a data souce and a repository
  4. 4How could you externalize constants from a Spring configuration file or a Spring annotation into a .properties file? Select one or more answers
    1. ABy using the <util:constant /> tag
    2. BBy declaring the ConstantPlaceholderConfigurer bean post processor
    3. CBy using the <context:property-placeholder /> tag
    4. DBy using the c: namespace
  5. 5What statement is not correct in live environment? Select a unique answer.
    1. AConstuctor and properties autowiring in the same bean are not compatible
    2. BA bean should have a default or a no-args constructor
    3. CThe <constructor-arg> tag could take type, name and index to reduce ambiguity
    4. DNone of the above
    5. EAll of the above
  6. 6What are the right affirmations about the @PostConstruct, @Resource and the @PreDestroy annotations?
    1. AThose annotations are specified in the JSR-250
    2. BThe Spring Framework embedded those annotations
    3. CThe <context:component-scan> tag enable them
    4. DThe <context:annotation-config > tag enable them
    5. EDeclaring the CommonAnnotationBeanPostProcessor enable them
  7. 7What is/are typically case(s) where you usually need to manually instantiated an ApplicationContext?
    1. AIn a web application
    2. BIn an integration test running with the SpringJUnit4ClassRunner
    3. CIn a standalone application started with a main method
    4. DNone of the above
  8. 8Select 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");
    1. AThe classpath: prefix could be omitted
    2. BPackage name using the dot character is not well formatted
    3. CThe slash character preceding com.example could be omit
    4. DAll of the above
    5. ENone of the above
  9. 9How to auto-inject into a field a Spring bean by its name? Select one or more answer choices.
    1. AWith the name attribute of the @Autowired annotation
    2. BBy using the single @Qualifier annotation
    3. CBy using both the @Autowired and the @Qualifier Spring annotations
    4. DBy using the @Autowired annotation and naming the field with the bean name
  10. 10What are the main advantages of using interfaces when designing business services? Select one or more answer choices.
    1. AMocking or stubbing the service
    2. BBe able to use the Spring auto-injection
    3. CCan do dependency checking
    4. DLoosely coupled code

Information

Description
Free mock exam for the Spring Professional certification based on the Spring Core 4.2 course
Language
English
Views
20,703
Rating
4.3 out of 5 · 3 ratings
Rate this quiz
Rate this quiz

Feedback

What is it about?

What do you think of the new look?

How do you like it?