Magento Extension Interview Question-Answer

Q.1 What is the CLI command to list all the commands?

       A. magento cli_all

       B. magento list

       C. magento cli_list

       D. magento list_all

Ans : magento list


Q.2 _________ is a software design pattern that allows a class to specify its dependencies without having to construct them.

       A. Events and observers

       B. Plugins

       C. Dependency injection

Ans : Dependency injection


Q.3 In which file you can define your dependency for a class in Magento?

       A. system.xml

       B. webapi.xml

       C. acl.xml

       D. di.xml

Ans : di.xml


Q.4 cache:flush command removes all the cache, including the third-party libraries cache data.

       A. True

       B. False

Ans : True


Q.5 When the dependency inversion principle is applied, it means high-level classes are not working directly with low-level classes.

       A. True

       B. False

Ans : True


Q.6 cache:clean command removes all the cache, including the third-party libraries cache data.

       A. True

       B. False

Ans : False


Q.7 Which of the following is incorrect regarding the dependency inversion principle?

       A. Your high-level classes should use the interfaces of low-level classes instead of working with them directly.

       B. None of the options

       C. Using interfaces in your code reduces the risk of incompatibility bugs when Magento changes the underlying implementation of those interfaces.

       D. Reduces code dependency using abstractions in your code.

Ans : Your high-level classes should use the interfaces of low-level classes instead of working with them directly.


Q.8 ______ CLI command is used to uninstall a module.

       A. php bin/magento unistall -m module

       B. php bin/magento module-unistall

       C. php bin/magento module:unistall

Ans : php bin/magento module:unistall


Q.9 ____ method return value will substitute the original method return value.

       A. around

       B. after

       C. before

       D. None of the options

Ans : before


Q.10 Proxy initiates dependency in ______ approach.

       A. Publish-subscribe

       B. lazy load

       C. Data render

Ans : lazy load


Q.11 Newable objects cannot be injected.

       A. True

       B. False

Ans : True


Q.12 ______ blocks generate the actual content for the display, where you need to assign to one of the structural blocks for frontend display.

       A. Structural blocks

       B. Content blocks

Ans : Content blocks


Q.13 Observers names can be similar in an event definition.

       A. True

       B. False

Ans : False


Q.14 Events are dispatched using MagentoFrameworkEventMaganer class.

       A. True

       B. False

Ans : True


Q.15 What are the parameters of the around method?

       A. subject and proceed

       B. subject, value and proceed

       C. subject and result

       D. subject, proceed and original method parameters

Ans : subject, proceed and original method parameters


Q.16 What is the first step in creating a custom system.xml?

       A. Creating ACL

       B. Adding default config value

       C. Creating custom system configuration

       D. None of the options

Ans : Creating custom system configuration


Q.17 You have to call _________ function to dispatch an event from the event manager class.

       A. event

       B. system

       C. observer

       D. dispatch

Ans : dispatch


Q.18 Interceptor is used for running plugins.

       A. True

       B. False

Ans : True


Q.19 Name the two parameters used by the after method.

       A. subject and result

       B. result and proceed

       C. subject and value

       D. None of the options

Ans : subject and result


Q.20 _____ method is used to replace the original method entirely.

       A. after

       B. before

       C. around

       D. None of the options

Ans : before


Q.21 Events are dispatched by _________ when certain actions are trigerred.

       A. Templates

       B. Plugins

       C. Modules

       D. Themes

Ans : Modules


Q.22 Name the two parameters used by the before method.

       A. result and value

       B. subject and value

       C. subject and proceed

       D. subject and result

Ans : result and value


Q.23 What are the types of dependencies?

       A. Newable

       B. Injectable

       C. Both injectable and newable

Ans : Both injectable and newable


Q.24 What all are things that you can configure using di.xml file?

       A. Connect plugin to class

       B. Create virtual type

       C. Link an injectable interface with correct implementation

       D. All the options

Ans : All the options


Q.25 ObjectManager class is located at which directory?

       A. vendor/magento/backend/ObjectManager

       B. vendor/magento/framework/ObjectManager

       C. vendor/magento/backend/

       D. vendor/magento/frontend/

Ans : vendor/magento/backend/ObjectManager


Q.26 _______ is the DI manager that finds the correct implementations which are required for the original object.

       A. dependency injection

       B. di.xml

       C. ObjectManager

       D. system.xml

Ans : ObjectManager


Q.27 Where does the global di.xml reside in magento directory?

       A. frontend/etc/di.xml

       B. module/etc/di.xml

       C. app/etc/di.xml

Ans : module/etc/di.xml


Q.28 Interceptor class gets generated programmatically when the object manager tries to call the instance of the class.

       A. True

       B. False

Ans : True


Leave a Comment