Magento 2 Certified Associate Developer practice questions, page 4 of 4, with answer review and explanations.
Question 16
A third-party module uses a layout update that changes the template path for a core block from product/view/addto/compare.phtml of the Magento_Catalog module to custom/view/addto/compare.phtml of your custom module. The merchant has a customized version of this template in their custom theme. What is a consequence of this setup?
If the custom module is removed, the custom template will no longer apply
This setup will throw an IllegalStateException
If a preference for the core block is set, the template will no longer apply
If another module is installed which also customizes the same core template, the templates will be rendered sequentially
Question 17
You are adding a child node to the product.info block using the XML: How will this block be rendered?
Child block nodes are automatically rendered as HTML
By calling $block->getChildHtml('mynewblock') in the parent block's template
The layout is invalid since block elements cannot be nested
Automatically if the block class Custom implements the _toHtml method
Question 18
You are implementing a before plugin in MyCompany_Magic. It will intercept the same method that MyCompany_Admission is already intercepting using a before plugin: Topmenu::getBlockHtml Which two actions are required to ensure the new plugin will execute last? (Choose two.)
Include a sortOrder=ג€20ג€ on the new plugin in MyCompany_Magic's etc/di.xml file
Configure plugin sequencing for both plugins in MyCompany_Magic's etc/plugin_sequence.xml file
Set a sortOrder=ג€10ג€ for MyCompany_Admission's plugin in MyCompany_Magic's etc/di.xml
Add MyCompany_Admission as a dependency in MyCompany_Magic's etc/module.xml file
Question 19
In the module located at app/code/MyCompany/MyModule there is a JS module in the file view/frontend/web/register.js. The Magento base URL is https://magento.host/ and the luma theme with the en_US locale is used. What is the public URL for this file?
During a code review of a module MyCompany_PaymentCurrencies you see a configuration field declared in the file etc/adminhtml/system.xml: What is the consequence of the attribute showInStore being set to 0?
The field value will not be accessible on the store front by calling ScopeConfigInterface::getValue() with a $scopeType argument of 'store'.
The input field will not be visible if a store view scope is selected in the system configuration
The input field will only be visible if a website's default store scope is selected in the system configuration
The input field will be disabled if a store view scope is selected in the system configuration