Magento Shiksha
Quiz : Magento Knowledge Test
1. Where are plugins defined in a Magento 2 module?
(a) routes.xml
(b) module.xml
(c) di.xml
(d) webapi.xml
2. 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
3. What is the purpose of virtualType in Magento 2 DI configuration?
(a) To define a class that doesn’t exist physically but uses another class as its base
(b) To make a class abstract
(c) To create a singleton object automatically
(d) To define plugins for abstract classes
4. 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
5. In Magento 2, Dependency Injection primarily helps in:
(a) Reducing database queries
(b) Removing layout dependencies
(c) Replacing class dependencies at runtime without modifying code
(d) Improving frontend performance
6. In Magento 2, if multiple plugins are defined on the same class, the execution order is controlled by:
(a) pluginOrder tag
(b) sortOrder attribute
(c) sequence.xml
(d) Alphabetical order of module names
7. 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
8. 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
9. In Magento 2, what is the purpose of the generated folder?
(a) Stores compiled classes and dependency injection generated files
(b) Stores static content like CSS and JS
(c) Stores cache and logs
(d) Stores backup copies of modules
10. In Magento 2, which file is used to declare routes for a custom module?
(a) routes.xml in etc/frontend or etc/adminhtml
(b) webapi.xml in etc
(c) di.xml in etc
(d) module.xml in etc
Submit