Test Online Free Adobe AD0-E716 Exam Questions and Answers

The questions for AD0-E716 were last updated On Aug.04 2023

Get AD0-E716 Full Access
 / 2

Question No : 1
An Adobe Commerce developer is being tasked with creating a new cron job to run a method that has already been written.
What are the minimally required steps to accomplish this?

Answer:
Explanation:
According to the Configure and run cron guide for Magento 2 developers, the crontab.xmi file is used to declare and configure cron jobs for a module. The file should specify the name, instance, method and schedule of the cron job. Therefore, creating a crontab.xmi file and setting a schedule for the new cron job are the minimally required steps to accomplish this task.
Reference: https://devdocs.magento.com/guides/v2.3/config-guide/cli/config-cli-subcommands-cron.html

Question No : 2
An Adobe Commerce developer creates a new website using a data patch. Each website will have unique pricing by website. The developer does not have visibility into the production and staging environments so they do not know what the configuration currently is.
How would they ensure the configuration is deployed and consistent across all environments?
A)



B)



C)



Answer:
Explanation:
To ensure that the configuration is deployed and consistent across all environments, the developer can use the following steps:
Create a data patch that contains the configuration for the new website.
Deploy the data patch to all environments.
Use the magento deploy:status command to verify that the configuration has been deployed to all environments.

Question No : 3
An Adobe Commerce developer adds a new extension attribute to add an array of values to the invoices that are fetched through the APIs.
After a while, their technical manager reviews their work and notices something wrong with the extension_attributes. xml file that the developer created in their module: What is the problem with this xml snippet?

Answer:
Explanation:
The extension attribute is referencing the repository instead of the interface it implements.
The correct XML snippet should be:
XML
<extension_attributes>
<attribute code="custom_values" type="string[]"
group="General"
translate="true">
<description>This attribute stores an array of custom values for the invoice.</description> <source_model>Magento\Sales\Api\Data\InvoiceInterface</source_model>
</attribute>
</extension_attributes>
The source_model attribute specifies the interface that the extension attribute is associated with. In this case, the extension attribute is associated with the Magento\Sales\Api\Data\InvoiceInterface interface.

Question No : 4
An Adobe Commerce developer is developing a custom module. As part of their implementation they have decided that all instances of their Custom\Module\Model\Example class should receive a new instance of Magento\Filesystem\Adapter\Local.
How would the developer achieve this using di. xml?
A)



B)



C)



Answer:
Explanation:
The developer can achieve this by adding the following configuration to their di.xml file:
XML
<config>
<component name="Custom\Module\Model\Example"
factory="Custom\Module\Model\ExampleFactory">
<arguments>
<argument name="filesystemAdapter" type="Magento\Filesystem\Adapter\Local" /> </arguments>
</component>
</config>
This configuration will ensure that all instances of the Custom\Module\Model\Example class will receive a new instance of the Magento\Filesystem\Adapter\Local class.

Question No : 5
An Adobe Commerce developer has created a process that exports a given order to some external accounting system. Launching this process using the Magento CLI with the command php bin/magento my_module:order: process --order_id=<order_id> is required. Example: php bin/magento my_module:order:process --order_id=1245.
What is the correct way to configure the command?
A)



B)



C)



D)



Answer:
Explanation:
According to the How to use the Magento command-line interface (CLI) guide, to configure and run the Magento CLI, the developer needs to make the bin/magento file executable and then use it to run commands. To create a custom command, the developer needs to create a class that implements \Symfony\Component\Console\Command\Command and define its name, description, arguments, options, and logic. The developer also needs to register the command in the di.xml file of their module using the Magento\Framework\Console\CommandList argument. Therefore, option C is the correct answer, as it shows the correct class and di.xml code to configure the custom command.
Reference: https://www.a2hosting.com/kb/installable-applications/optimization-and-configuration/magento1/using-the-magento-command-line-interface-cli/

Question No : 6
Add the following annotation to the test method:



Answer:
Explanation:
To add a custom fixture to test a MyVendor_MyModule, the developer needs to do the following: Create a PHP file with the fixture data in [magento root dir]/dev/tests/integration/testsuite/MyVendor/MyModule/_files/my_fixture.php. Add the following annotation to the test method:
@magentoDataFixture(
'testsuite/MyVendor/MyModule/_files/my_fixture.php'
)
This will tell Magento to load the fixture data from the my_fixture.php file before the test method is executed.

Question No : 7
An Adobe Commerce developer has installed a module from a third-party vendor. This module fires a custom event named third_party_event_after and also defines an observer named third_party_event_after_observer that listens to that event. The developer wants to listen to this custom event in their own module but wants to execute their observer's logic after the third_party_event_after_observer observer has finished executing.
What would the developer do to ensure their observer runs after the observer defined by the third-party module?

Answer:
Explanation:
To ensure that the developer's observer runs after the observer defined by the third-party module, they need to set the sort order of the new observer to be less than that of the third-party vendor's observer.
The sort order is a number that is assigned to each observer. The lower the number, the earlier the observer will be executed.
For example, if the third-party vendor's observer has a sort order of 10, the developer's observer would need to have a sort order of 9 or lower.

Question No : 8
An Adobe Commerce developer is tasked with adding custom data to orders fetched from the API. While keeping best practices in mind, how would the developer achieve this?

Answer:
Explanation:
The developer should create an extension attribute on the Magento\Sales\Api\Data\OrderInterface interface and an after plugin on the Magento\Sales\Api\OrderRepositoryInterface::get() and Magento\Sales\Api\OrderRepositoryInterface::getList() methods.
The extension attribute will store the custom data. The after plugin will be used to add the custom data to the order object when it is fetched from the API.
Here is the code for the extension attribute and after plugin:
PHP
namespace MyVendor\MyModule\Api\Data;
interface OrderExtensionInterface extends \Magento\Sales\Api\Data\OrderInterface {
/**
* Get custom data.
*
* @return string|null */
public function getCustomData();
/**
* Set custom data.
*
* @param string $customData
* @return $this
*/
public function setCustomData($customData);
}
namespace MyVendor\MyModule\Model;
class OrderRepository extends \Magento\Sales\Api\OrderRepositoryInterface {
/**
* After get order.
*
* @param \Magento\Sales\Api\OrderRepositoryInterface $subject
* @param \Magento\Sales\Api\Data\OrderInterface $order
* @return \Magento\Sales\Api\Data\OrderInterface
*/
public function afterGetOrder($subject, $order)
{
if ($order instanceof OrderExtensionInterface) {
$order->setCustomData('This is custom data');
}
return $order;
}
/**
* After get list.
*
* @param \Magento\Sales\Api\OrderRepositoryInterface $subject
* @param \Magento\Sales\Api\Data\OrderInterface[] $orders
* @return \Magento\Sales\Api\Data\OrderInterface[]
*/
public function afterGetList($subject, $orders)
{
foreach ($orders as $order) {
if ($order instanceof OrderExtensionInterface) {
$order->setCustomData('This is custom data');
}
}
return $orders;
}
}
Once the extension attribute and after plugin are created, the custom data will be added to orders fetched from the API.

Question No : 9
Which hashing algorithm will Adobe Commerce choose to hash customer passwords?

Answer:
Explanation:
If the Sodium extension is installed, Argon 2ID13 will be chosen as the Magento default hashing algorithm. Otherwise, SHA256 will be used.
The Sodium extension is a PHP extension that provides cryptographic functions. Argon 2ID13 is a password hashing algorithm that is considered to be more secure than SHA256.
If the Sodium extension is installed, Magento will use Argon 2ID13 as the default hashing algorithm for customer passwords. If the Sodium extension is not installed, Magento will use SHA256 as the default hashing algorithm.

Question No : 10
The di. xml file of a module attaches two plugins for the class Action.
The PluginA has the methods: beforeDispatch, aroundDispatch, afterDispatch.
The PluginB has the methods: beforeDispatch, afterDispatch.



The around plugin code is:



What would be the plugin execution order?
A)



B)



C)



Answer:
Explanation:
The plugin execution order is as follows:
PluginA::beforeDispatch()
PluginB::beforeDispatch()
PluginA::aroundDispatch()
The code in the around plugin
PluginB::afterDispatch()
PluginA::afterDispatch()
The aroundDispatch() method is executed in a separate scope, so the code in the around plugin will be executed after the beforeDispatch() methods of both plugins, but before the afterDispatch() methods of both plugins.
Here is a diagram that shows the plugin execution order:
PluginA
beforeDispatch()
aroundDispatch()
afterDispatch()
PluginB
beforeDispatch()
afterDispatch()

 / 2
  TOP 50 Exam Questions
Exam