Adobe AD0-E716 Practice Test - Questions Answers, Page 4
List of questions
Question 31

The developer is required to convert a modules database scripts from old install/upgrade setup files to a data patches format and does not want to apply database changes that were already done by install/upgrade scripts.
The current module version is 1.5.4.
What would be the recommended solution to skip changes that were already applied via old format (install/upgrade scripts)?
Explanation:
According to the Develop data and schema patches guide for Magento 2 developers, data patches are classes that contain data modification instructions. They are defined in a <Vendor>/<Module_Name>/Setup/Patch/Data/<Patch_Name>.php file and implement MagentoFrameworkSetupPatchDataPatchInterface. Data patches can also implement Patchversioninterface to specify the module version that the patch is associated with. The getVersion() method returns the module version as a string. To skip changes that were already applied via old format (install/upgrade scripts), the developer should implement Patchversioninterface and return 1.5.4 on the getVersion() method. This way, the data patch will only be applied if the module version is greater than or equal to 1.5.4. Verified
Reference: https://devdocs.magento.com/guides/v2.3/extension-dev-guide/declarative-schema/data-patches.html
Question 32

An Adobe Commerce developer has created a module that adds a product attribute to all product types via a Data Patch-According to best practices, how would the developer ensure this product attribute is removed in the event that the module is uninstalled at a later date?
Explanation:
According to the Develop data and schema patches guide for Magento 2 developers, data patches can also implement PatchRevertabieinterface to provide rollback functionality for their changes. The revert() method contains the instructions to undo the data modifications made by the patch. To ensure that the product attribute is removed when the module is uninstalled, the developer should make the data patch implement PatchRevertabieinterface and implement the revert method to remove the product attribute using EavSetupFactory or AttributeRepositoryInterface. Verified
Reference: https://devdocs.magento.com/guides/v2.3/extension-dev-guide/declarative-schema/data-patches.html
Question 33

An Adobe Commerce developer successfully added a new column to the customers grid. This column needs the data to be formatted before showing its content in the grid.
According to best practices, how would the developer add the custom logic to render the column?
Question 34

An integration named Marketing is created on the Adobe Commerce instance. The integration has access on Magento_Customer:: customer resources and the access token is xxxxxx.
How would the rest API be called to search the customers?
Explanation:
According to the Magento Stack Exchange answer, UI components are used to render various elements on Magento admin pages, such as grids, forms, buttons, etc. UI components are defined in XML files that are located in the view/adminhtml/ui_component directory of each module. To add a custom logic to render a column in a grid, the developer should create a custom class extending MagentoUiComponentListingColumnsColumn and add the custom logic within the prepareDataSource method. This method receives an array of data sources and modifies them according to the column logic. The developer should also add an attribute class to the column node within the module's customer_listing.xml file and specify their custom class name as its value. Verified
Reference: https://magento.stackexchange.com/questions/317821/how-to-add-custom-logic-to-render-a-column-in-a-grid-in-magento-2
Question 35

An Adobe Commerce developer is tasked with adding an new export option for the order grid, they have added the following code for the export button within sales_order_grid.xml:
Upon testing, they are getting redirected, what would be a cause for this error?
Explanation:
The developer has to add a formkey for the new export option because the formkey is required for security reasons. Without the formkey, the request will be rejected and redirected to the dashboard page. Verified
Reference: [Magento 2.4 User Guide] [Magento 2.4 DevDocs]
Question 36

An Adobe Commerce developer is tasked to add a file field to a custom form in the administration panel, the field must accept only .PDF files with size less or equal than 2 MB. So far the developer has added the following code within the form component xml file, inside the fieldset node:
How would the developer implement the validations?
A)
Add the Validations Within the HyVendor\MyModule\Controller\Adminhtml\CustomEntity\UploadPdf Controller
B)
Add a virtual type forMyvendor\MyModuie\Modei\customPdfupioader specifying the aiiowedExtensions and the maxFiiesize for the constructor, within the module's di.xmi:
C)
Add the following code inside the<settings> node:
Explanation:
The developer can add a virtual type for Myvendor\MyModuie\Modei\customPdfupioader specifying the aiiowedExtensions and the maxFiiesize for the constructor, within the module's di.xmi. This way, the developer can reuse the existing file uploader class and customize it for the specific field without modifying the core code. Verified
Reference: [Magento 2.4 DevDocs] [Magento Stack Exchange]
Question 37

An Adobe Commerce developer wants to generate a list of products using ProductRepositorylnterf ace and search for products using a supplier_id filter for data that is stored in a standalone table (i.e., not in an EAV attribute).
Keeping maintainability in mind, how can the developer add the supplier ID to the search?
Explanation:
The developer can add a custom filter to the virtual type Magento\Catalog\Model\Api\SearchCriteria\CollectionProcessor\ProductFilterProce5sor for supplier_id field. In the custom filter, the developer can apply the needed join and filter to the passed $collection. This is the recommended way to extend the search criteria for products using dependency injection and plugins. Verified
Reference: [Magento 2.4 DevDocs] [Magento Stack Exchange]
Question 38

When researching some issues with the indexer, an Adobe Commerce developer is seeing errors in the logs similar to Memory size allocated for the temporary table is more than 20% of innodb_buffer_pool_size. It is suggested that the client update innodb_buf f er_pool_size or decrease the batch size value.
Why does decreasing the batch size value improve performance?
Explanation:
Decreasing the batch size value improves performance by reducing the memory usage for the temporary table. The batch size value determines how many rows of data are processed at a time by the indexer. A large batch size value can cause the allocated memory size for the temporary table to exceed 20% of innodb_buffer_pool_size, which can result in errors and slow down the indexing process. By lowering the batch size value, the indexer can process the data more efficiently and avoid memory issues. Verified
Reference: [Magento 2.4 DevDocs] [Magento Stack Exchange]
Question 39

An international merchant is complaining that changes are taking too long to be reflected on the frontend after a full product import.
Thinking it may be database issues, the Adobe Commerce developer collects the following entity counts:
* Categories: 900
* Products: 300k
* Customers: 700k
* Customer groups : 106
* Orders: 1600k
* Invoices: 500k
* Creditmemos: 50k
* Websites : 15
* Stores : 45
What is a probable cause for this?
Explanation:
The probable cause for the delay in reflecting the changes on the frontend after a full product import is the combination of the number of products, customer groups and websites. This leads to a huge amount of values being stored in the price index which is too large to be processed at a normal speed. The price index calculates the final price of each product for each customer group and website, taking into account various factors such as tax, discounts, catalog price rules, etc. When there are many products, customer groups and websites, the price index becomes very complex and time-consuming to update. Verified
Reference: [Magento 2.4 DevDocs] [Magento Stack Exchange]
Question 40

When checking the cron logs, an Adobe Commerce developer sees that the following job occurs daily: main.INFO: Cron Dob inventory_cleanup_reservations is successfully finished. However, the inventory_reservation table in the database is not emptied. Why are there records remaining in the inventory_reservation table?
Explanation:
The reason why there are records remaining in the inventory_reservation table is that only reservations no longer needed are removed by the cron job. The inventory_reservation table tracks the quantity of each product in each order and creates a reservation for each product when an order is placed, shipped, cancelled or refunded. The initial reservation has a negative quantity value and the subsequent reservations have positive values. When the order is complete, the sum of all reservations for the product is zero. The cron job removes only those reservations that have a zero sum from the table, leaving behind any reservations that are still needed for incomplete orders. Verified
Reference: [Magento 2.4 DevDocs] [Magento Stack Exchange]
Question