ASSOCIATE DEVELOPER EXAM TEST POOL-02 (MAGENTO 2 CERTIFIED)

Description

This only my study notes, questions will NOT be found on the final exam. They might be similar. 60 questions 90mi 68% to pass Based on Magento Open Source (2.3) and Magento Commerce (2.3),
Miska Red
Quiz by Miska Red, updated more than 1 year ago
Miska Red
Created by Miska Red over 4 years ago
2706
3

Resource summary

Question 1

Question
You are customizing a third-party module and need to prevent an event handler from triggering. Keeping upgradeability in mind, how do you do this?
Answer
  • Create an observer in events.xml with the same name and specify the disabled="true" attribute.
  • Create a plugin that will disable the 3rd-party's event observer method.
  • Override the event observer's class.
  • Comment the observer from the 3rd-party's module.

Question 2

Question
When writing a model triad (model, resource model, collection), what is the correct way to save a model to the database?
Answer
  • Call the save method in the resource model class.
  • Call the save method in the collection class.
  • Call the save method in the model class.
  • Call the save method in the repository.

Question 3

Question
When creating a new data provider collection for a uiComponent, what class must you extend?
Answer
  • Magento\Framework\View\Element\UiComponent\DataProvider\SearchResult
  • Magento\Framework\View\UiComponent\ViewCollection
  • Magento\Framework\ViewDataProvider\UiComponent\CollectionProvider
  • Magento\Framework\UiComponent\ComponentCollection

Question 4

Question
You are tasked with creating a widget that will render a product’s price using the Magento price rendering system. How do you do this?
Answer
  • Retrieve the product.price.render.default block and call the render method.
  • Use the protected property, $priceRenderer injected in the $context in the Template.
  • Trigger the catalog_product_render_price event, attaching the product as event data.
  • Use dependency injection to get an instance of the Magento\Framework\Pricing\Renderer class and call the renderPrice method.

Question 5

Question
What must be done differently to properly generate a URL in the Magento backend?
Answer
  • Generate the URL from an instance of \Magento\Backend\Model\UrlInterface.
  • Ensure that the controller is configured for the correct ACL path.
  • Instead of calling the getUrl() method, you must call the getBackendUrl() method
  • Nothing: generating URLs in the frontend and backend are the same.

Question 6

Question
You need to add a residential / commercial destination selector to the shipping address on the checkout.What are the steps needed to add this selector? 2
Answer
  • Add new column to the sales_order_address table.
  • Create a checkout_index_index.xml file and add the uiComponent details.
  • Add a Javascript mixin to render the selector.
  • Override \Magento\Block\Checkout\ShippingAddress and add a getter for the selector value.

Question 7

Question
Keeping maintainability in mind, how do you add a new link to the customer account sidebar?
Answer
  • Create customer_account.xml and add a block to the customer_account_navigation.
  • Create a plugin for the customer Navigation class.
  • Create customer_account_index.xml and add the link to the uiComponent configuration in jsLayout
  • Create customer_account_index.xml and add a block to the sidebar container.

Question 8

Question
You need to implement a fallback for VAT ID validation to prevent downtime should the validator service be unavailable. How do you add the fallback?
Answer
  • Create an after plugin for Magento\Customer\Model\Vat::checkVatNumber method.
  • Override the Magento\Quote\Model\VatValidator::validate method.
  • Observe the customer_validate_vat_id_after event.
  • Change the Stores > Configuration > Customer > VAT Validation Fallback method to be “Regex”

Question 9

Question
You need to add a date column to a uiComponent in a Magento admin grid. What three actions must you take to successfully implement this? 3
Answer
  • Specify the Date module for the class attribute.
  • Set the date type for the dataType setting.
  • Specify the date component for the component attribute.
  • Utilize the date node type.
  • Add a data/config/dateFormat node.

Question 10

Question
You have created a custom customer attribute that displays the last time that the customer made a purchase, stored in UTC. This attribute needs to be visible in the Customer grid. The column is visible, but, when it is loaded, only the date is visible—not the time. You have verified that both the date and time are stored in the database. Keeping user experience in mind, what is the solution?
Answer
  • Add a new column to the customer_listing uiComponent and specify the date column type.
  • Override the customer uiComponent data provider and format the data as a string.
  • Change the backend_type from date to datetime.
  • Set the grid_column_type to be datetime in the customer_eav_attribute table.

Question 11

Question
A root category is associated with which scope:
Answer
  • Store
  • Website
  • Global
  • Store View

Question 12

Question
You wish to create a custom 404 page that only displays for specific URLs. This was necessary because of the Magento 1 to Magento 2 migration and the need to redirect URLs from the old site to the new site. This custom 404 page should only appear once all other routers have not matched the URL. Keeping maintainability in mind, how do you implement this?
Answer
  • Create a router that watches for the noroute action; if it matches, forward the front controller to a custom controller.
  • Create a plugin for the dispatch method in vendor/magento/framework/App/FrontController.php.
  • Create an observer for the front_controller_match_after event.
  • Create a layout XML file cms_noroute_index.xml and place updates in it.

Question 13

Question
When should static files be placed in a theme rather than in a specific module?
Answer
  • When the files are general files that affect all the pages (ex: logo image).
  • When the files apply to a specific application feature (ex: price box size on the product view page).
  • It is better to place all static files in a module rather than in a theme – it makes the overall structure better.
  • It is better to place all static files in a theme rather than in a module, as having all the files in one place makes them easier to manage.

Question 14

Question
You wish to create a new router which below steps are need ? (select 3)
Answer
  • Inject new item under routerList argument of Magento\Framework\App\RouterList type via di.xml
  • Create router file (by using match method implements \Magento\Framework\App\RouterInterface).
  • Return instance of \Magento\Framework\App\ActionInterface
  • inject an instance of \Magento\Framework\Event\ManagerInterface into constructor

Question 15

Question
What ways are possible to wrap a block with an HTML tag? 2
Answer
  • Layout XML container
  • Add the tag to the template.
  • Listen to the core_block_html_output_after event.
  • Add a plugin for the afterHtml method.

Question 16

Question
You are adding an extension attribute to the CustomerInterface class. You have specified data for the extension attribute, but when you check the database, nothing has been saved. Why is that?
Answer
  • Extension attribute data is not automatically persisted to the database.
  • You need to ensure that the extension attribute getter and setter exists in CustomerExtensionInterface.
  • You need to add a <persist/> node to the extension attribute XML details.
  • The appropriate columns in customer_entity have not been created.

Question 17

Question
You are creating a new store configuration entry. As part of the requirements, this entry must only be visible in the global and website scopes. What is the purpose of this limitation?
Answer
  • A primary use of the global and website scopes is to enable/disable features.
  • The global and website scopes cannot be overridden by store scopes.
  • The store scope is only available when a specific store is selected.
  • The store scope must have a default value set—no default value is appropriate here.

Question 18

Question
You are connecting Magento customers with a Customer Relationship Manager (CRM). You need to associate each customer’s CRM unique ID, CRM notes and a list of their current opportunities. This information must always available for each Customer object. You have configured the interface, class implementation and set up extension_attributes.xml What two steps remain to access this data? 2
Answer
  • Use after plugins in customer repository and collection.
  • Ensure the extension attributes property is an object.
  • Specify a extensionAttributeLoader in the db_schema.xml
  • Create an observer for the customer_load_after event.

Question 19

Question
You are assisting a merchant setting up a Cart Price Rule. They wish to apply free shipping to specific items in the cart (and not the entire cart). How do you implement the filter for the specific products?
Answer
  • Create Conditions rules for the specific requirements.
  • Use the Actions rules for the specific requirements.
  • Add a Product filter to the Apply To rules for the specific requirements.
  • This is not possible without a 3rd-party customization.

Question 20

Question
You are tasked with creating a new EAV attribute. What steps do you take to be able to call the addAttribute method? 2
Answer
  • Create a new data patch.
  • Inject and use an instance of EavSetup.
  • Utilize the module’s UpgradeData class.
  • Use the ModuleDataSetup class.

Question 21

Question
You are customizing a Magento website that will be connected to an ERP through the REST API. Also on this website, you have written a way for a customer to add comments to the order. These comments need to be sent to the ERP. Keeping maintainability in mind, how do you accomplish this?
Answer
  • Add an extension attribute to OrderInterface
  • Create a new REST API endpoint to fetch the comments per order.
  • Ensure the comments key is in the Order model’s $data array.
  • Override the Order model to add a getComments method.

Question 22

Question
How do you make a new category attribute available to be edited in the admin panel?
Answer
  • Add the new attribute to the category_form.xml uiComponent.
  • This is done automatically.
  • Create a plugin for the `Form` class that renders the category form and add the extra field.
  • In the data setup script, add the attribute to the category's default attribute set.

Question 23

Question
You have injected \Magento\Framework\Api\SearchCriteria into the constructor method. You then wrote the following code in a method: 1: $search = $this->searchCriteria->setSortOrders([‘entity_id ASC’]); 2: $this->productRepository>getList($search); When running this code, you get an error: Fatal error: Uncaught TypeError: Argument 1 must be an instance of SortOrder, string given. What are two errors present in the examples given?
Answer
  • Sort order should not be specified as a string.
  • SearchCriteriaBuilder should be used instead of SearchCriteria.
  • One line 2, when loading $search, you need to use $search->getCriteria().
  • Sort orders must be added one at a time with the addSortOrder method.

Question 24

Question
You need to locate several products. You run this code: $productRepository->getList($criteriaBuilder->addFilter(‘type_id’, ‘bundle’)->getItems(); However, you get an error: Type SearchCriteriaInterface expected. What is the solution?
Answer
  • Call the ->create() method after addFilter().
  • Run bin/magento setup:di:compile.
  • Create a custom wrapper for SearchCriteriaBuilder to utilize classes in your module.
  • Don’t use a SearchCriteriaBuilder. Instead, inject a SearchCriteriaInterface.

Question 25

Question
For fraud prevention purposes, you need to notate the IP address from which a user adds an item to their cart. Which event will allow you access to every cart addition?
Answer
  • sales_quote_add_item
  • sales_quote_product_add_after
  • checkout_cart_add_product_complete
  • cart_add_item_after

Question 26

Question
You are building a customization for Magento sites that must change the template for the customer account order history view. How do you accomplish this?
Answer
  • Override \Magento\Sales\Block\Order\History and specify a new $_template variable.
  • In sales_order_history.xml add: <referenceBlock name=”sales.order.history”><arguments><argument name=”template” xsi:type=”string”>...</argument></arguments>
  • Create an after plugin for the \Magento\Sales\Block\Order\History::setTemplate.
  • In sales_order_history.xml add: <referenceBlock name=”sales.order.history” template=”...”/>

Question 27

Question
Front Controller: Creating the List of Routers . Where is located in <magento_installation_dir>-----?
Answer
  • /lib/internal/Magento/Framework/App/FrontController.php
  • /app/code/Magento/Framework/App/FrontController.php
  • /vendor/Magento/Framework/App/FrontController.php
  • /app/design/Magento/Framework/App/FrontController.php

Question 28

Question
What is the default router in Magento 2?
Answer
  • Magento\Framework\App\Router\DefaultRouter
  • Magento\Core\App\Router\Base
  • Magento\Cms\Controller\Router
  • Magento\UrlRewrite\Controller\Router
  • Magento\DesignEditor\Controller\Varien\Router\Standard

Question 29

Question
Where CMS router, which processes CMS pages in Magento 2.?
Answer
  • Magento\Cms\Controller\Router
  • Magento\UrlRewrite\Controller\Router
  • Magento\DesignEditor\Controller\Varien\Router\Standard
  • Magento\Framework\App\Router\DefaultRouter

Question 30

Question
URL Processing: Base Router URL Composition For example, the URL: http://magento-installation.com/catalog/product/view/id/1 Write structure of the URL, as accepted by the router?
Answer
  • $baseUrl/$frontName/$controllerName/$actionName/$otherParams
  • $baseUrl/$controllerName/$frontName/$actionName/$otherParams
  • $baseUrl/$frontName/$routerName/$actionName/$otherParams
  • $baseUrl/$frontName/$modelName/$actionName/$otherParams
Show full summary Hide full summary

Similar

PROFESSIONAL DEVELOPER TEST POOL-1 (MAGENTO 2 CERTIFIED )
Miska Red
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 )
Станислав Матявин
Magento 2 Cloud
Oleksiy P
PROFESSIONAL DEVELOPER TEST POOL-1 (MAGENTO 2 CERTIFIED )
Dario Dorfelli
MAGENTO 2 CERTIFIED SOLUTION SPECIALIST PRACTICE TEST
Pankaj Sharma
PROFESSIONAL DEVELOPER TEST POOL-1 (MAGENTO 2 CERTIFIED )
test test
SOLUTION SPECIALIST TEST-01 (MAGENTO 2 CERTIFIED )
Khrystyna Balog
Magento 2 Certified Professional Front End Developer Exam Questions
Benoit Alix
Cold War (1945-1975)
sagar.joban