ExamGecko
Home Home / Adobe / AD0-E716

Adobe AD0-E716 Practice Test - Questions Answers, Page 3

Question list
Search
Search

List of questions

Search

Related questions











An Adobe Commerce Developer wishes to add an action to a pre-existing route, but does not wish to interfere with the functionality of the actions from the original route.

What must the developer do to ensure that their action works without any side effects in the original module?

A.
In the route declaration, use the before or after parameters to load their module in before or after the original module.
A.
In the route declaration, use the before or after parameters to load their module in before or after the original module.
Answers
B.
Inject the new action into the standard router constructor's $actiomist parameter.
B.
Inject the new action into the standard router constructor's $actiomist parameter.
Answers
C.
Add the action into to the controllers/front_name/ in My.Module, Magento will automatically detect and use it.
C.
Add the action into to the controllers/front_name/ in My.Module, Magento will automatically detect and use it.
Answers
Suggested answer: A

Explanation:

To add an action to a pre-existing route without interfering with the functionality of the original route, the developer must use the before or after parameters in the route declaration. This will load the developer's module in before or after the original module, respectively.

For example, the following code would add an action to the my_module/index route before the action from the original module:

<route id='my_module/index'>

<before>my_module_before</before>

</route>

The my_module_before action would be executed before the MyModule\Controller\Index action, which would allow the developer to perform any necessary setup before the original action is executed.

An Adobe Commerce developer is asked to change the tracking level on a custom module for free downloading of pdf and images.

The module contains following models:

Download class has a parameter for tracking_level.

How will the developer configure the tracking_level parameter, in di.xml.to have a value of 4 for Download class and all classes that extend Download?

A)

B)

C)

A.
Option A
A.
Option A
Answers
B.
Option B
B.
Option B
Answers
C.
Option C
C.
Option C
Answers
Suggested answer: B

Explanation:

To configure the tracking_level parameter in di.xml to have a value of 4 for the Download class and all classes that extend Download, the developer would use the following code:

<config>

<global>

<models>

<Vendor\FreeDownload\Model\Download>

<setting name='tracking_level' value='4'/>

</Vendor\FreeDownload\Model\Download>

<Vendor\FreeDownload\Model\DownloadPdf>

<rewrite name='tracking_level' value='4'/>

</Vendor\FreeDownload\Model\DownloadPdf>

<Vendor\FreeDownload\Model\DownloadImage>

<rewrite name='tracking_level' value='4'/>

</Vendor\FreeDownload\Model\DownloadImage>

</models>

</global>

</config>

The setting element is used to set a configuration value for a specific model. The rewrite element is used to override the default configuration value for a specific model. In this case, the tracking_level parameter is set to 4 for all models that extend Download.

An Adobe Commerce developer is working on a custom gallery extension.

The module uses the Magento\catalog\Model\iinageUploader class for image uploading. The admin controller for custom image uploads is Vendor\CustomGallery\Controller\Adminhtml\Image\Upload.

The images need to be stored in different basePath and baseTmpPath than the default ones.

How can the default imageuploader class be extended and used without affecting the other modules that are already using it?

A)

B)

C)

A.
Option A
A.
Option A
Answers
B.
Option B
B.
Option B
Answers
C.
Option C
C.
Option C
Answers
Suggested answer: B

Explanation:

According to the ImageUploader component guide for Magento 2 developers, the ImageUploader UI component gives users the ability to upload images to the Magento Media Gallery. This component is a variation of the FileUploader component and uses the same configuration settings. The ImageUploader component uses the Magento\catalog\Model\iinageUploader class for image uploading, which has properties such as basePath and baseTmpPath that define where the images are stored. To extend the default imageuploader class and use it without affecting the other modules that are already using it, the developer needs to create a virtual type of this class in their module's di.xml file and specify different values for basePath and baseTmpPath. The developer also needs to inject their virtual type into their admin controller using the imageUploader argument. Therefore, option B is the correct answer, as it shows the correct di.xml and controller code to extend and use the imageuploader class. Verified

Reference: https://devdocs.magento.com/guides/v2.3/ui_comp_guide/components/image-uploader/

An Adobe Commerce developer has added a new configuration field to the admin are

A.
The path for this option is general/store_information/out_of_hours_phone.Keeping simplicity in mind, how would the developer ensure this option contains a valid US telephone number?
A.
The path for this option is general/store_information/out_of_hours_phone.Keeping simplicity in mind, how would the developer ensure this option contains a valid US telephone number?
Answers
B.
Add <validate>phoneUS</validate> to the field in system.xml.
B.
Add <validate>phoneUS</validate> to the field in system.xml.
Answers
C.
Create a backend model to check the validity of the phone number entered.
C.
Create a backend model to check the validity of the phone number entered.
Answers
D.
Add <validate type='phoneUS'/> to the field in system.xml.
D.
Add <validate type='phoneUS'/> to the field in system.xml.
Answers
Suggested answer: A

Explanation:

According to the Magento Stack Exchange answer, system.xml is a file that defines the configuration fields for the admin area. Each field can have a validate attribute that specifies a validation rule for the field value. Magento provides some built-in validation rules, such as phoneUS, which validates a US telephone number. Therefore, to ensure that the option contains a valid US telephone number, the developer needs to add <validate>phoneUS</validate> to the field in system.xml. Verified

Reference: https://magento.stackexchange.com/questions/104570/magento-2-system-xml-validation-rules

An Adobe Commerce developer is tasked with creating a custom block that will be displayed on every page in the footer of the site.

After completing and optimizing the development, the developer notices that the block takes too much time to be generated on each page and decides to store it in the system cache after enabling it for all cache groups.

What would be the minimum requirement to achieve this?

A.
Set a value for the cache_Lifetime data property of the block.
A.
Set a value for the cache_Lifetime data property of the block.
Answers
B.
Set a value for cache_key data property of the block.
B.
Set a value for cache_key data property of the block.
Answers
C.
Set values for both cache_lifetime and cache_key data properties of the block.
C.
Set values for both cache_lifetime and cache_key data properties of the block.
Answers
Suggested answer: C

Explanation:

To store a block in the system cache, the developer needs to set values for both the cache_lifetime and cache_key data properties of the block. The cache_lifetime property specifies how long the block should be cached, and the cache_key property specifies a unique identifier for the block.

The following code shows how to set the cache_lifetime and cache_key data properties of a block:

PHP

$block->setData('cache_lifetime', 600);

$block->setData('cache_key', 'my_custom_block');

Once the cache_lifetime and cache_key data properties have been set, the block will be stored in the system cache and will not be regenerated on each page load.

There is the task to create a custom product attribute that controls the display of a message below the product title on the cart page, in order to identify products that might be delivered late.

The new EAV attribute is_delayed has been created as a boolean and is working correctly in the admin panel and product page.

What would be the next implementation to allow the is_delayed EAV attribute to be used in the .phtml cart page such as $block->getProduct()->getIsDelayed()?

A)

Create a new file etc/catalog_attributes.xmi:

B)

Create a new file etc/extension attributes.xmi:

C)

Create a new file etc/eav attributes.xmi:

A.
Option A
A.
Option A
Answers
B.
Option B
B.
Option B
Answers
C.
Option C
C.
Option C
Answers
Suggested answer: A

Explanation:

To allow the is_delayed EAV attribute to be used in the .phtml cart page, the developer needs to create a new file called etc/catalog_attributes.xmi. This file will contain the definition of the is_delayed attribute.

The following code shows how to create the etc/catalog_attributes.xmi file:

XML

<?xml version='1.0'?>

<catalog_attributes>

<label>Is Delayed</label>

<note>This attribute indicates whether the product is delayed.</note>

<sort_order>10</sort_order>

<required>false</required>

</catalog_attributes>

Once the etc/catalog_attributes.xmi file has been created, the is_delayed attribute will be available in the .phtml cart page. The attribute can be accessed using the getIsDelayed() method of the Product class.

PHP

$product = $block->getProduct();

$isDelayed = $product->getIsDelayed();

The isDelayed variable will contain the value of the is_delayed attribute. If the value of the attribute is 1, then the product is delayed. If the value of the attribute is 0, then the product is not delayed.

An Adobe Commerce developer is creating a module (Vendor.ModuleName) to be sold on the Marketplace. The new module creates a database table using declarative schema and now the developer needs to make sure the table is removed when the module is disabled.

What must the developer do to accomplish this?

A.
There is nothing further the developer needs to do. The table will be removed when the module is disabled and bin/magento setup:upgrade is run.
A.
There is nothing further the developer needs to do. The table will be removed when the module is disabled and bin/magento setup:upgrade is run.
Answers
B.
There is nothing further the developer needs to do. The table will be removed when the when bin/magento module:uninstall vendor_ModuleName is run.
B.
There is nothing further the developer needs to do. The table will be removed when the when bin/magento module:uninstall vendor_ModuleName is run.
Answers
C.
Add a schema patch that implements Magento\Framework\setup\Patch\PatchRevertabieinterface and drops the table in the revert function.
C.
Add a schema patch that implements Magento\Framework\setup\Patch\PatchRevertabieinterface and drops the table in the revert function.
Answers
Suggested answer: C

Explanation:

According to the Declarative Schema Overview guide for Magento 2 developers, declarative schema is a new feature that allows developers to declare the final desired state of the database and has the system adjust to it automatically, without performing redundant operations. However, declarative schema does not support uninstalling modules or reverting changes. To remove a table when a module is disabled, the developer needs to add a schema patch that implements Magento\Framework\setup\Patch\PatchRevertabieinterface and drops the table in the revert function. The revert function will be executed when the module is disabled using bin/magento module:disable command. Verified

Reference: https://devdocs.magento.com/guides/v2.3/extension-dev-guide/declarative-schema/

An Adobe Commerce developer is trying to create a custom table using declarative schema, but is unable to do so.

What are two errors in the snippet above? (Choose two.)

A.
Column (roll_no) does not have index. It is needed since attribute identity is set to true.
A.
Column (roll_no) does not have index. It is needed since attribute identity is set to true.
Answers
B.
Column (entity_id) does not have index. It is needed since attribute identity is set to false.
B.
Column (entity_id) does not have index. It is needed since attribute identity is set to false.
Answers
C.
Column (student_name) does not have attribute length.
C.
Column (student_name) does not have attribute length.
Answers
D.
null is not a valid value for column (roll_no).
D.
null is not a valid value for column (roll_no).
Answers
Suggested answer: A, C

Explanation:

The correct answers are A and C.

The errors in the snippet are:

Columnroll_nodoes not have an index. It is needed sinceattribute_identityis set totrue.

Columnstudent_namedoes not have an attribute length.

The attribute_identity attribute specifies whether the primary key of the table should be auto-incremented. If attribute_identity is set to true, then the roll_no column must have an index. The student_name column does not have an attribute length, which is required for string columns.

The following code shows how to fix the errors:

XML

<table name='vendor_module_table'>

<entity_id>

<type>int</type>

<identity>true</identity>

<unsigned>true</unsigned>

<nullable>false</nullable>

</entity_id>

<roll_no>

<type>int</type>

<identity>false</identity>

<unsigned>true</unsigned>

<nullable>false</nullable>

true

<index>true</index>

</roll_no>

<student_name>

<type>string</type>

<length>255</length>

<nullable>false</nullable>

</student_name>

</table>

Once the errors have been fixed, the table can be created successfully.

An Adobe Commerce developer wants to create a product EAV attribute programmatically which should appear as WYSIWYG in the admin panel. They have made sure that wysiwyg_enabled has been set to true, however, the attribute is not appearing as WYSIWYG in the admin panel.

What would be a possible reason?

A.
The is_html_allowed_on_front Option iS Set tO false.
A.
The is_html_allowed_on_front Option iS Set tO false.
Answers
B.
The input type is not set to text.
B.
The input type is not set to text.
Answers
C.
The input type is not set to textarea.
C.
The input type is not set to textarea.
Answers
Suggested answer: C

Explanation:

The input_type attribute of a product EAV attribute specifies the type of input field that will be used to enter the value of the attribute in the admin panel. The textarea input type is used for WYSIWYG fields. If the input_type attribute is not set to textarea, then the attribute will not appear as WYSIWYG in the admin panel.

To fix this, the developer should set the input_type attribute to textarea.

An Adobe Commerce Developer has written an importer and exporter for a custom entity. The client is using this to modify the exported data and then re-importing the file to batch update the entities.

There is a text attribute, which contains information related to imagery in JSON form, media_gallery. This is not a field that the client wants to change, but the software they are using to edit the exported data seems to be modifying it and not allowing it to import correctly.

How would the developer prevent this?

A) Specify a serializer class for the attribute using the $_transformAttrs class property array for both the exporter and importer so it gets converted:

B) Strip the attribute from the imported file by adding it to the s_strippedAttrs class property array:

C) Prevent it from being exported by adding it to the $_disat>iedAttrs class property array:

A.
Option A
A.
Option A
Answers
B.
Option B
B.
Option B
Answers
C.
Option C
C.
Option C
Answers
Suggested answer: A

Explanation:

The _transformAttrs class property array of the importer and exporter classes can be used to specify a serializer class for a particular attribute. The serializer class will be used to convert the attribute value from one format to another when the data is exported or imported.

In this case, the developer can specify a serializer class that will convert the JSON data in the media_gallery attribute to a string. This will prevent the software that the client is using to modify the exported data from changing the JSON data.

The following code shows how to specify a serializer class for the media_gallery attribute:

PHP

class MySerializer

{

public function serialize($value)

{

return json_encode($value);

}

public function deserialize($value)

{

return json_decode($value);

}

}

$importer->setSerializer('media_gallery', MySerializer::class);

$exporter->setSerializer('media_gallery', MySerializer::class);

Once the serializer class has been specified, the JSON data in the media_gallery attribute will be converted to a string when the data is exported or imported. This will prevent the software that the client is using to modify the exported data from changing the JSON data.

Total 69 questions
Go to page: of 7