| Sno. | Question | Options | Marks |
|---|---|---|---|
| 1. | In Magento 2, the preference tag in di.xml is used to: |
(a). Replace one class implementation with another globally (b). Set constructor arguments dynamically (c). Define a plugin for a class (d). Inject dependencies into controller actions |
-0 |
| 2. | In Magento 2, which file defines module dependencies and version? |
(a). registration.php (b). di.xml (c). module.xml (d). config.xml |
1 |
| 3. | What happens if two plugins with the same sortOrder are declared for a method? |
(a). Magento throws an error (b). Only the first plugin runs (c). Execution order becomes unpredictable (d). Magento merges them automatically |
1 |
| 4. | What is the main purpose of a Plugin in Magento 2? |
(a). To override core files directly (b). To intercept public method calls and modify input/output (c). To add new database tables (d). To manage static content deployment |
1 |
| 5. | Which of the following correctly describes a ViewModel in Magento 2? |
(a). A helper class for templates defined via layout.xml (b). A block class replacement for controllers (c). A data provider for UI components only (d). A frontend model for product attributes |
-0 |
| 6. | Which file is mainly used to configure Dependency Injection in a custom module? |
(a). config.xml (b). routes.xml (c). di.xml (d). module.xml |
1 |
| 7. | Which Magento 2 mode provides the best performance but does not allow automatic code generation? |
(a). Developer Mode (b). Production Mode (c). Default Mode (d). Maintenance Mode |
1 |
| 8. | If two classes require the same dependency, Magento 2: |
(a). Creates two separate objects every time (b). Always uses Object Manager directly (c). Reuses the same instance if the dependency is marked as shared (d). Throws an error unless defined in system.xml |
1 |
| 9. | Which is NOT a valid type of Dependency Injection in Magento 2? |
(a). Constructor Injection (b). Method Injection (c). Property Injection (d). Interface Injection |
1 |
| 10. | Which method type in a plugin allows you to modify both the arguments before execution and the return value after execution? |
(a). before method (b). after method (c). around method (d). All of the above |
-0 |
| Total Marks:7/10 | Percentage:70% | ||