PROFESSIONAL DEVELOPER PLUS TEST-01( 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 62% to pass
Miska Red
Quiz by Miska Red, updated more than 1 year ago
Miska Red
Created by Miska Red over 5 years ago
6085
5

Resource summary

Question 1

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

Question 2

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.
  • Ensure your UpgradeSchema class extends CoreSetup and call $this->addSalesColumns().
  • On the ModuleDataSetupInterface, call $setup->getSales()->addColumn()
  • On the default EavSetup class, utilize the addColumn method.

Question 3

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 getAttributeExtensions() method and implement ExtensionAttributesInterface in each model.
  • Configure your models in etc/extension_attributes.xml.
  • Create a ExtensionAttributeInterface for each model.
  • Ensure each model extends Magento\Framework\Model\AbstractExtensibleModel.

Question 4

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.
  • Use a plugin on the IndexManager class to change load order.
  • Specify the sortOrder in your indexer configuration.
  • Create a bash script to execute each indexer in the correct order.

Question 5

Question
In your phtml template file you need to output a URL inside a JavaScript context. var url = '<?= /* code here */ ?>'; Which two methods allow you to keep the output XSS-safe?
Answer
  • escapeUrl
  • escapeJs
  • escapeHtml
  • escapeHtmlAttr

Question 6

Question
You are working on a custom form in the Admin and the form is too lengthy. To organize the form better, you decide to group the fields into multiple tabs. How do you achieve this?
Answer
  • Add the fields into a <fieldset> node in the existing form in the ui_component XML file
  • Add a new form for the field group in the ui_component XML file
  • Add the fields into <tab> nodes in the customer_account_edit.xml layout file
  • Create a plugin for the method MyCompany\MyModule\Block\Adminhtml\Form\Edit\Tabs::toHtml()

Question 7

Question
You are making some changes to your existing action controller \MyCompany\MyModule\Controller\Index\Index public function __construct( \Magento\Framework\App\Action\Context $context, <new dependency here>, \Magento\Framework\View\Result\PageFactory $resultPageFactory){ You want to inject a new dependency to the controller, but you encounter the following error after flushing the cache and reloading the page: Recoverable Error: Argument 2 passed to MyCompany\MyModule\Controller\Index\Index::__construct() must be an instance of <new dependency class> ...How do you fix the error?
Answer
  • Remove the generated child class from generated/code that is calling the parent constructor with the old signature
  • Configure the new argument in di.xml for the controller class
  • Clean the config cache that contains all constructor signatures
  • New dependencies must be added at the end of the constructor signature because dependencies cannot be added in the middle of existing constructors

Question 8

Question
You are working with an OMS(Magento Order Management System ) that requires you to add an attribute to the order API. How do you add a field to the existing sales API?
Answer
  • You add an extension attribute to Magento\Sales\Api\Data\OrderInterface to include the new field
  • You update Magento\Sales\Api\OrderManagementInterface and Magento\Sales\Api\Data\OrderInterface to add your field
  • You create an install script to add a column to the sales table and Magento will automatically pull in the information
  • You create an etc/webapi.xml file and add the new field as an item to the route, as shown in the following code: <route url="/V1/orders" method="GET"> <service class= "Magento\Sales\Api\OrderRepositoryInterface" method="getList"> <item name="my_new_attribute" xsi:type="string" /> </service> <resources> <resource ref="Magento_Sales::sales" /> </resources> </route>

Question 9

Question
You are exploring the customer segment module and find this code in frontend/di.xml: <type name="Magento\Framework\View\Layout"> <plugin name="customer-segment-session-depersonalize" type= "Magento\CustomerSegment\Model\Layout\DepersonalizePlugin" sortOrder="15"/> </type> What effect does this plugin have for customer segments?
Answer
  • It cleans the segment and customer related entities from the session
  • It cleans the intermediate data of the segment-website and the segment-customer mapping in the tables to improve performance
  • It passes the segment information to the HttpContext from the customer session
  • It passes the segment information to the Knockout JS model from the customer session

Question 10

Question
Cross-site scripting, or XSS, is a security vulnerability that can be found in web applications, Magento extension developers should be aware of these vulnerabilities to avoid introducing them in their code. In Magento mainly three types of XSS vulnerabilities:
Answer
  • Persisted XSS
  • Reflected (non-persistent) XSS
  • DOM XSS
  • SQL Injection
  • Cross Site Scripting Admin

Question 11

Question
Magento Input Processing Any request data can be manipulated by attackers and can contain malicious values such as: (Select 4)
Answer
  • form fields filled with control characters (“<”, “>” etc)
  • headers containg false IDs
  • URIs contaings fake parts/query parameters
  • tampered cookies
  • tampered KnockoutJS
  • tampered Cache
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
Magento 2 Cloud
Oleksiy P
PROFESSIONAL DEVELOPER TEST POOL-1 (MAGENTO 2 CERTIFIED )
Станислав Матявин
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
Formula for Physics IGCSE edexcel
amayagn