/10
8 votes, 3.9 avg
332
Created on

Spring Quiz - Feb Week 3,2020

Spring quiz helps us to increase our knowledge

1 / 10

Is it the correct way to declare the bean and assing a way to the constructor (assing value using the type)?

XML:

<bean id="exampleBean" class="examples.ExampleBean">    <constructor-arg type="java.lang.String" value="7500000"/>    <constructor-arg type="java.lang.String" value="42"/></bean>

Class:

public class ExampleBean {    // Number of years to calculate the Ultimate Answer    private int years;    // The Answer to Life, the Universe, and Everything    private String ultimateAnswer;    public ExampleBean(int years, String ultimateAnswer) {        this.years = years;        this.ultimateAnswer = ultimateAnswer;    }}

 

2 / 10

In spring bean, if we want to assign an empty string value to bean then which of the following way is correct?

I.e : exampleBean.setEmail("");

3 / 10

Which of the following syntax is true to call the init() method at the time of bean initialization?

4 / 10

The ApplicationContext is a complete superset of the __________.

5 / 10

Which annotation can be used to import additional configuration classes?

6 / 10

Which of the following is correct way to declare a bean in spring XML based configuration?

7 / 10

which annotation indicates that a specific parameter, return value, or field can be?

8 / 10

In spring bean, if we want to assign a null value to bean then which of the following way is correct?

I.e : exampleBean.setEmail(null);

9 / 10

In this Spring XML based configurations, __________ attribute can explicitly force one or more beans to be initialized before the bean using this element is initialized.?

10 / 10

Is it the correct way to declare the bean and assing a way to the constructor (assing value using the index)?

XML:

<bean id="exampleBean" class="examples.ExampleBean">    <constructor-arg index="0" value="7500000"/>    <constructor-arg index="1" value="42"/></bean>

Class:

public class ExampleBean {    // Number of years to calculate the Ultimate Answer    private int years;    // The Answer to Life, the Universe, and Everything    private String ultimateAnswer;    public ExampleBean(int years, String ultimateAnswer) {        this.years = years;        this.ultimateAnswer = ultimateAnswer;    }}

 

Please fill the following details to show the result.

Your score is

The average score is 54%

0%

Please rate this quiz