

MCQOPTIONS
Saved Bookmarks
This section includes 16 Mcqs, each offering curated multiple-choice questions to sharpen your Spring knowledge and support exam preparation. Choose a topic below to get started.
1. |
Which Attribute is used to specify the bean declared? |
A. | factory-bean |
B. | scope |
C. | getBean |
D. | declareBean |
Answer» B. scope | |
2. |
Instance Factory method main purpose is to encapsulate the object-creation process in a method of another object instance. |
A. | True |
B. | False |
Answer» B. False | |
3. |
Snippet of Code: What will be the output:- |
A. | BeanCreationException |
B. | IllegalArgumentException |
C. | New Product will be created |
D. | None of the mentionedView Answer |
Answer» D. None of the mentionedView Answer | |
4. |
One factory class can also hold more than one factory method True/False? |
A. | True |
B. | False |
Answer» B. False | |
5. |
The bean instance is mentioned by the factory-method attribute, while the factory method is signified by the factory-bean attribute? |
A. | True |
B. | False |
Answer» C. | |
6. |
Bean’s naming convention:- starts with lowercase, camelcase from then on.? |
A. | True |
B. | False |
Answer» B. False | |
7. |
A bean can have more than one name using multiple id attributes? |
A. | True |
B. | False |
Answer» B. False | |
8. |
What will be the output?Snippet of Code: |
A. | BeanCreationException |
B. | Bean Created |
C. | ClassPathException |
D. | None of the mentionedView Answer |
Answer» B. Bean Created | |
9. |
Exception thrown by factory method? |
A. | IllegalArgumentException |
B. | IndexOutofBoundException |
C. | ClassPathNotFoundException |
D. | BeanCreationException |
Answer» E. | |
10. |
Purpose of Static Factory Method? |
A. | Static method to create an object |
B. | Initialize bean |
C. | All of the mentioned |
D. | None of the mentioned |
Answer» B. Initialize bean | |
11. |
Which attribute is used to specify static factory-method? |
A. | factory-method |
B. | default-init method |
C. | destroy method |
D. | lazy-init method |
Answer» B. default-init method | |
12. |
Which of the following method can be used to used to instantiate a method? |
A. | static factory method |
B. | default-init method |
C. | destroy method |
D. | lazy-init method |
Answer» B. default-init method | |
13. |
Which attribute is used to specify class name of the bean? |
A. | name |
B. | id |
C. | class |
D. | constructor-args |
Answer» D. constructor-args | |
14. |
Beans can be created by which of the following properties? |
A. | Scope |
B. | Property |
C. | Class |
D. | It’s own constructor |
Answer» E. | |
15. |
A_BEAN_CAN_HAVE_MORE_THAN_ONE_NAME_USING_MULTIPLE_ID_ATTRIBUTES??$ |
A. | True |
B. | False |
Answer» B. False | |
16. |
BeanCreationExceptio? |
A. | Bean Created |
B. | ClassPathException |
C. | None of the mentioned |
Answer» B. ClassPathException | |