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

How should a record be removed from a database which is using a model that was inherited from the \Magento\Framework\Model\AbstractModel class?
The 'delete' method on the \Magento\Framework\Model\AbstractModel class is used to remove a record from the database. This method will also cascade the delete to any related records.
Question 32

In a new release of a module, a developer decides to rename a table that was defined in the earlier versions. Which action, if any, allows the developer to prevent data loss?
To prevent data loss when renaming a table that was defined in the earlier versions of a module, the developer should define onCreate=''migrateDataFromAnotherTable(old_table_name)'' attribute in the table tag of the db_schema.xml file. This attribute will instruct Adobe Commerce to copy all data from the old table to the new table during installation or upgrade.
Declarative schema does not support RENAME TABLE statement, so the data will not be migrated to the new table automatically. The db.schema_whitelist.json file is used to whitelist changes that are allowed for backward compatibility, not for data migration.
Verified
Reference:Adobe Commerce Developer Guide - Declare schema and data patches
Question 33

A developer defined a new table in db.schema.xml while creating a new module.
What should be done to allow the removal of columns from the database when deleting them from db.schema.xml?
If a developer wants to allow the removal of columns from the database when deleting them from db.schema.xml, they need to define the removable columns in the db_schema_whitelist.json file. This file will tell Magento which columns can be removed from the database.
Question 34

Which attribute option restricts Catalog EAV attributes to only certain product types?
The allowed_in attribute restricts Catalog EAV attributes to only certain product types. This attribute can be used to prevent certain attributes from being displayed on certain product types.
Question 35

Which two methods add sorting to collections inherited from the \Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection class? (Choose two.)
The two methods that add sorting to collections inherited from the \Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection class are setOrder and addOrder. These methods allow adding one or more order clauses to a collection query.
The setSorting and addSorting methods do not exist in Adobe Commerce.
Verified
Reference: [Adobe Commerce Developer Guide - Collections]
Question 36

The value of a product attribute in the Adobe Commerce system needs to have a different format before it is displayed. Which attribute model class is responsible for this?
The frontend attribute model class is responsible for formatting the value of a product attribute before it is displayed on the storefront. This class can implement methods such as getValue, getLabel, getInputType, and getOptionText to modify the attribute value.
The backend attribute model class is responsible for saving and loading the attribute value to and from the database. The source attribute model class is responsible for providing the list of options for an attribute.
Verified
Reference: [Adobe Commerce Developer Guide - Attribute models]
Question 37

A developer would like to initialize a theme in Adobe Commerce. Which two files are required to complete this task? (Choose two.)
The two files that are required to initialize a theme in Adobe Commerce are registration.php and theme.xml. The registration.php file registers the theme in the system and assigns a unique name to it. The theme.xml file declares the theme's title, parent theme, media directory, and preview image.
The theme.less file is not required to initialize a theme, but it can be used to define global styles for the theme. The composer.json file is not required to initialize a theme, but it can be used to manage dependencies and packages for the theme.
Verified
Reference: [Adobe Commerce Developer Guide - Create a theme]
Question 38

A developer needs to initialize the jQuery Ul widget for a specific HTML tag. Which HTML attribute is used for this?
The data-mage-init HTML attribute is used to initialize the jQuery UI widget for a specific HTML tag. This attribute specifies the name of the widget and its configuration options as a JSON object.
The x-magento-init HTML attribute is used to initialize RequireJS modules for a specific HTML tag. The data-ui HTML attribute does not exist in Adobe Commerce.
Verified
Reference: [Adobe Commerce Developer Guide - Initialize JavaScript components using the data-mage-init attribute]
Question 39

How can a custom CMS Page be set as a store home page?
To set a custom CMS Page as a store home page, the developer or merchant should follow these steps:
In the Admin panel, go to Content > Pages and create or edit a CMS Page that will be used as a home page.
In the Admin panel, go to Stores > Configuration > General > Web > Default Pages.
In the CMS Home Page field, select the CMS Page that was created or edited in step 1.
Save the configuration.
There is no ''Home Page'' column in the CMS Page admin grid or ''Default Home Page'' value in the CMS Page admin form.
Verified
Reference: [Adobe Commerce User Guide - Set up your home page]
Question 40

Which theme directory contains the static files that can be loaded directly?
The web directory contains the static files that can be loaded directly. This directory includes files such as CSS, JavaScript, and images.
Question