This is a timed quiz.
You have 1 hour 29 minutes to complete the 28 questions in this quiz.
You are building an tool that imports products from an ERP. There are 20 columns of additional information that are associated with each product. This extra information must also be associated with an update time to know when to refresh the data. Keeping maintainability in mind, how do you build this into Magento?
Utilize an extension attribute.
Override the Product model and add the fields.
Create a separate model and build code to associate the two record types.
Create 20 EAV attributes and check their updated_at column.
What interface should a frontend controllers action implement?
\Magento\Framework\App\ActionInterface
\Magento\Frontend\Controller\ActionInterface
\Magento\Frontend\Controller\ControllerInterface
\Magento\Framework\App\ControllerInterface
You are making some major adjustments to a core Magento class (ClassA). These adjustments are only necessary when utilized from a specific Magento class (ClassB). You have created MyClass that contains the needed customizations. Keeping upgradeability in mind, how do you configure di.xml to make the substitution happen?
Ensure that MyClass extends ModuleA and set the <argument/>, for ModuleB to point to your new class in di.xml.
Set a <preference/> for ModuleA to be replaced by MyClass
Create a rewrite node that injects MyClass into ClassB.
Create a virtual type that extends ModuleB, specifying an <argument/> for MyClass.
You are customizing the display of product details page. On this page ur customer need to change the url in which the product category name will be appear as http://mystore.com/women/tops-women/helena-hooded-fleece.html , Keeping ,maintainability in mind ,How to get product url with category?
Admin -> Stores -> Configuration -> Catalog -> Catalog -> Search Engine Optimization -> "Use Categories Path for Product URLs" set to "Yes"
It is not possible to display Categories name on product url
$product->setCategoryId($categoryId)->getProductUrl();
You Can Build category URL path \vendor\magento\module-catalog-url-rewrite\Model\CategoryUrlPathGenerator.php
You are building a new module to add extra functionality to the Magento application. What files are required?
registration.php
etc/module.xml
composer.json
Setup/InstallSchema.php
etc/config.xml
You need to add the Google Tag Manager (GTM) to every page. What three steps do you take to accomplish this in MyCompany_MyModule?
Add into view/frontend/layout/default.xml.
Create view/frontend/layout/default.xml.
Create view/frontend/templates/script.phtml and add GTM code.
Run bin/magento create:module:template script.phtml
Copy vendor/module-catalog/view/template/script.phtml to view/template/script.phtml and add GTM script.
You need to control access to a custom controller action. How do you tell Magento about this new control option?
Create etc/acl.xml and add <resource id="MyCompany_MyModule::customAction" ... />
In the controller, implement the _isAllowed method.
Create etc/adminhtml/acl.xml and add <acl id="MyCompany_MyModule::customAction" ... />
Use the CLI to add the new resource option.
You are trying to determine why a product is not appearing in a category. What table does Magento on the frontend to locate the relationship between a category and its products?
catalog_category_product
catalog_product_parent
catalog_category_product_index
catalog_category_product_relationship
How do you instruct Magento to enable a new module?
bin/magento module:enable MyCompany_MyModule
Magento automatically enables all new modules.
Go to Admin > System > Module Management.
Add MyCompany_MyModule to the setup_module table.
As you are scanning folder in the vendor/module-catalog directory, you see a directory that is named Ui. What is this folder's purpose?
It contains UI component data providers and component information.
It contains templates, CSS and JS pertinent to the module.
It contains the block PHP files that render HTML onto the frontend.
It is not a normal folder and further investigation is necessary to determine the purpose.
You are updating a module to add extra functionality to the Magento application, Where would Magento look for modules?
app/code/VendorName/ModuleName
vendor/vendor-name/module-name
app/vendor/vendor-name/module-name
lib/vendor-name/module-name
You are reviewing a module to some special functionality to the Magento 2 application, You see directory /Console, What task you think in this directory contain script for this modules?
contains CLI commands
contains any PHP classes exposed to the API
contains cron job definitions.
contains section files
open directory /Console & check script what code contaib
You are reviewing a module to some special functionality to the Magento 2 application, You see directory /CustomerData, What task you think in this directory contain script for this modules?
Contains section files that works with the data stored on the client side.
contains aggregated functionality.
contains localization files.
contains view files, including static view files, design templates, email templates, and layout files.
You are building a new module to add extra functionality to the Magento application.You want to works with CustomerData the data stored on the client side. Where initialized sections Cart and Directory-data are on the server side via the classes ?
Magento\Checkout\CustomerData\Cart and Magento\Checkout\CustomerData\DirectoryData
Magento\Checkout\Api\Cart and Magento\Checkout\Api\DirectoryData
Magento\Checkout\Block\Cart and Magento\Checkout\Block\DirectoryData
Magento\Checkout\Plugin\Cart and Magento\Checkout\Plugin\DirectoryData
Magento and third-party developers can find it difficult to track and report the dependencies that customized extensions have on other extensions. To address these issues, the Magento system introduces service contracts. What is a Service Contracts - Data interfaces ?
set of PHP interfaces that are defined for a module includes data interfaces
set of API interfaces that are defined for a module includes web APIs
set of UI Library that are defined for a module includes ui content
set of JS Library that are defined for a module includes js Library
You have created a module to show manufacturer-list, but in your page need to show Pagination that already ready in your block. Keeping maintainability in mind, where you call echo $block->getPagerHtml(); ?
/Manufacturer/view/frontend/templates/content.phtml
/Manufacturer/Block/Index.php
/Manufacturer/Controller/Index/Index.php
/Manufacturer/view/frontend/layout/manufacturer_index_index.xml
You have created a module to show manufacturer-list,Your customer need url as www.storeurl/manufacturer which file are mendatory to show correct url?
Controller: /Manufacturer/Controller/Index/Index.php
Block: /Manufacturer/Block/Index.php
Layout: Manufacturer/view/frontend/layout/manufacturer_index_index.xml
Templates:/Manufacturer/view/templates/content.phtml
Layout: Manufacturer/view/frontend/layout/index_index.xml
Layout: Manufacturer/view/frontend/layout/manufacturer.xml
You are facing a bug, which is supposedly caused by the customization of \Magento\Catalog\Api\ProductRepositoryInterface::save(). To resolve the issue, you decide to find all logic which customizes this method. Which two places do you search for customization declarations? (Choose 2)
*/di.xml
*/events.xml
*/config.xml
*/plugins.xml
You are implementing a customization of the sales management within a module MyCompany_MySalesProcess. You have created several event observers to add the custom functionality. Each observer is a separate class, but they require some common functionality. How do you implement the common functionality in the event observers, keeping maintainability and testability in mind?
You create a regular class implementing the common functionality as public methods and use constructor injection to make them available to the observers.
You create a trait with the common methods and use the trait in the observer classes.
You create a regular class implementing the common functionality as public static methods and call those from the observers.
You create an abstract class AbstractObserver with the common methods and extend the observer classes from it.
A custom module is performing an optimized custom query for quote items. The class applies the query customizations on the select object of a quote item collection instance. public function __construct( \Magento\Quote\Model\ResourceModel\Quote\Item\Collection $collection) { $this->collection = $collection; } public function fetchData() { $select = $this->collection->getSelect(); ... code modifying $select... return $this->collection->getData(); } You are tasked to resolve an issue where the query sometimes does not deliver the expected results. You have debugged the problem and found another class is also using a quote item collection and is loading the collection before the custom module. How do you resolve the issue, keeping maintainability in mind
You change the argument type to \Magento\Quote\Model\ResourceModel\Quote\Item\CollectionFactory and instantiate the collection using $collectionFactory->create();
You remove the constructor argument and use ObjectManager::getInstance()- >create(\Magento\Quote\Model\ResourceModel\Quote\Item\Collection::class) to instantiate the collection instead.
You inject \Magento\Framework\DB\Select instead of the collection and perform the desired query independently of the collection.
You inject \Magento\Quote\Api\CartItemRepositoryInterface because low level query customizations are not allowed.
In a custom module you implement the interface \Magento\Framework\App\Config\DataInterface. /** Configuration data storage @api */ interface DataInterface { public function getValue($path); public function setValue($path, $value); } What version constraint for magento/framework do you add to your module’s composer.json file?
minor
major
patch
stable
You are building CLI that use the console to create a customer account with our custom command as like php bin/magento customer:user:create --customer-firstname="Mahin" --customer-lastname="Rahman" --customer-email="mahin@example.com" --customer-password="mahin@123" --website="1" using: protected function configure() { $this->setName('customer:user:create') ->setDescription('Create new customer') ->setDefinition($this->getOptionsList()); } protected function getOptionsList(){ return [ ------------------]; } Which below Option are not required in blank? (Choose 2)
new InputOption(Customer::KEY_SENDEMAIL, 0, InputOption::VALUE_OPTIONAL, '(1/0) Send email? (default 0)')
new InputOption(Customer::KEY_STORE, null, InputOption::VALUE_REQUIRED, '(Required) Store ID'),
new InputOption(Customer::KEY_PASSWORD, null, InputOption::VALUE_REQUIRED, '(Required) Customer password'),
new InputOption(Customer::KEY_EMAIL, null, InputOption::VALUE_REQUIRED, '(Required) Customer email'),
new InputOption(Customer::KEY_LASTNAME, null, InputOption::VALUE_REQUIRED, '(Required) Customer last name'),
new InputOption(Customer::KEY_FIRSTNAME, null, InputOption::VALUE_REQUIRED, '(Required) Customer first name'),
new InputOption(Customer::KEY_WEBSITE, null, InputOption::VALUE_REQUIRED, '(Required) Website ID'),
You are building CLI that use the console to create a customer account with our custom command, Adding a new command to CLI is based on passing on the argument from the XML level to the class . Dependency Injection comes in handy here. you create the file app/code/Mycompany/Customer/etc/di.xml with the following content: <type name="---------------------"> </type> What is the correct in below?
Magento\Framework\Console\CommandList
Magento\Framework\Console
Magento\Framework\CommandList
Magento\Framework\CommandList\Console
You are creating a new indexer which must run after the targetrule_product_rule index process. When you run bin/magento indexer:reindex, your rule always runs first creating inaccurate data. What is the resolution?
Use a dependencies node in your indexer configuration
Specify the sortOrder in your indexer configuration.
Use a plugin on the IndexManager class to change load order.
Create a bash script to execute each indexer in the correct order.
You need to render a product attribute’s raw value as a variable in a script tag. This value will be used to initialize an application on the frontend. How do you render this value?
<?= $block->escapeJs($value) ?>
<?= $block->escapeJsVar($value) ?>
<?= $block->renderJs($value) ?>
<?= $block->escapeHtml($value) ?>
You need to add a new column to the sales_shipment and the sales_shipment_grid tables. Other than utilizing the default addColumn methods, what way is automatic?
Utilize the SalesSetup class’ addAttribute method.
On the default EavSetup class, utilize the addColumn method.
On the ModuleDataSetupInterface, call $setup->getSales()->addColumn().
Ensure your UpgradeSchema class extends CoreSetup and call $this->addSalesColumns().
You are creating a module that will be sold on the Magento Marketplace. You wish for this module to be easily extensible, and decide to add the capability for other developers to utilize extension attributes. What is the minimum update necessary to enable this capability?
Add the getExtensionAttributes() method and implement ExtensionAttributesInterface in each model.
Create an ExtensionAttributeInterface for each model.
Ensure each model extends Magento\Framework\Model\AbstractExtensibleModel.
Configure your models in etc/extension_attributes.xml
There is a custom extension called MyCompany_MyModule. It has the following layout customization declared in MyCompany/MyModule/view/frontend/layout/default.xml: <referenceContainer name=”content”> <block class=”Magento\Framework\View\Element\Template” name=”my.block” template=”MyCompany_MyModule::my_template.phtml” cacheable=”false”/> </referenceContainer> What will be the result of the customization?
All store front pages will be non-cacheable
Only the default landing page will be non-cacheable
my.block on the default landing page only will be cached using ESI.
my.block on the all store front pages will be cached using ESI