PROFESSIONAL DEVELOPER TEST POOL-1 (MAGENTO 2 CERTIFIED )

Description

POOL-1 30 question, This only my study notes, questions will NOT be found on the final exam. They might be similar. 60 questions 90mi 64% to pass Based on Magento Open Source (2.3) and Magento Commerce (2.3),
Станислав Матявин
Quiz by Станислав Матявин, updated more than 1 year ago More Less
Miska Red
Created by Miska Red about 5 years ago
Станислав Матявин
Copied by Станислав Матявин over 4 years ago
1040
3

Resource summary

Question 1

Question
You see this code in etc/adminhtml/routes.xml: <route id="mymodule" frontName="user-subscriptions"> <module name="MyCompany_MyModule" /> </route> You have placed a controller in Controller/Index/Subscribe.php. If you want to create layout XML instructions for this controller, what would be the layout XML's filename?
Answer
  • mymodule_index_subscribe.xml
  • mymodule_subscribe_[ACTION NAME].xml
  • user_subscriptions_index_subscribe.xml
  • user_subscriptions_subscribe_[ACTION NAME].xml

Question 2

Question
You have created a new product type, sample, and need to customize how it renders on the shopping cart page. Keeping maintainability in mind, how do you add a new renderer?
Answer
  • Create the layout file, checkout_cart_item_renderers.xml, reference the checkout.cart.item.renderers block and add a new block with an as="sample" attribute.
  • Override the cart/form.phtml template and add logic for the sample product type.
  • Create the layout file, checkout_cart_index.xml, and reference the checkout.cart.renderers block and add a block with the as="sample" attribute.
  • Create the layout file, checkout_cart_index.xml, and update the cart page's uiComponent to appropriately render the sample product type.

Question 3

Question
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?
Answer
  • 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.

Question 4

Question
What interface should a frontend controllers action implement?
Answer
  • \Magento\Framework\App\ActionInterface
  • \Magento\Frontend\Controller\ActionInterface
  • \Magento\Frontend\Controller\ControllerInterface
  • \Magento\Framework\App\ControllerInterface

Question 5

Question
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?
Answer
  • 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.

Question 6

Question
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?
Answer
  • 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

Question 7

Question
You are building a new module to add extra functionality to the Magento application. What files are required?
Answer
  • registration.php
  • etc/module.xml
  • composer.json
  • Setup/InstallSchema.php
  • etc/config.xml

Question 8

Question
You need to add the Google Tag Manager (GTM) to every page. What three steps do you take to accomplish this in MyCompany_MyModule?
Answer
  • 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.

Question 9

Question
You need to control access to a custom controller action. How do you tell Magento about this new control option?
Answer
  • 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.

Question 10

Question
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?
Answer
  • catalog_category_product
  • catalog_product_parent
  • catalog_category_product_index
  • catalog_category_product_relationship

Question 11

Question
How do you instruct Magento to enable a new module?
Answer
  • 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.

Question 12

Question
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?
Answer
  • 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.

Question 13

Question
You are updating a module to add extra functionality to the Magento application, Where would Magento look for modules?
Answer
  • app/code/VendorName/ModuleName
  • vendor/vendor-name/module-name
  • app/vendor/vendor-name/module-name
  • lib/vendor-name/module-name

Question 14

Question
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?
Answer
  • 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

Question 15

Question
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?
Answer
  • 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.

Question 16

Question
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 ?
Answer
  • 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

Question 17

Question
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 ?
Answer
  • 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

Question 18

Question
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(); ?
Answer
  • /Manufacturer/view/frontend/templates/content.phtml
  • /Manufacturer/Block/Index.php
  • /Manufacturer/Controller/Index/Index.php
  • /Manufacturer/view/frontend/layout/manufacturer_index_index.xml

Question 19

Question
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?
Answer
  • 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

Question 20

Question
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)
Answer
  • */di.xml
  • */events.xml
  • */config.xml
  • */plugins.xml

Question 21

Question
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?
Answer
  • 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.

Question 22

Question
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
Answer
  • 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.

Question 23

Question
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?
Answer
  • minor
  • major
  • patch
  • stable

Question 24

Question
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)
Answer
  • 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'),

Question 25

Question
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?
Answer
  • Magento\Framework\Console\CommandList
  • Magento\Framework\Console
  • Magento\Framework\CommandList
  • Magento\Framework\CommandList\Console

Question 26

Question
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?
Answer
  • 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.

Question 27

Question
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?
Answer
  • <?= $block->escapeJs($value) ?>
  • <?= $block->escapeJsVar($value) ?>
  • <?= $block->renderJs($value) ?>
  • <?= $block->escapeHtml($value) ?>

Question 28

Question
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?
Answer
  • 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().

Question 29

Question
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?
Answer
  • 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

Question 30

Question
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?
Answer
  • 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
Show full summary Hide full summary

Similar

PROFESSIONAL DEVELOPER TEST POOL-1 (MAGENTO 2 CERTIFIED )
Dario Dorfelli
SOLUTION SPECIALIST TEST-01 (MAGENTO 2 CERTIFIED )
Miska Red
Cloud Developer Exam Test-01(MAGENTO 2 CERTIFIED Professional )
Miska Red
PROFESSIONAL DEVELOPER TEST POOL-1 (MAGENTO 2 CERTIFIED )
test test
MAGENTO 2 CERTIFIED SOLUTION SPECIALIST PRACTICE TEST
Pankaj Sharma
Magento 2 Cloud
Oleksiy P
70-411 - MCSA: Administering Windows Server 2012 - Exam 4
Mike M
PROFESSIONAL DEVELOPER TEST POOL-02 (MAGENTO 2 CERTIFIED )
Dario Dorfelli
70-411 - MCSA: Administering Windows Server 2012 - Exam 3
Mike M
70-411 - MCSA: Administering Windows Server 2012 - Exam 6
Mike M
70-411 - MCSA: Administering Windows Server 2012 - Exam 5
Mike M