Magento 2 Certified Associate Developer practice questions, page 2 of 4, with answer review and explanations.
Question 6
What is the connection between product attribute sets and categories?
Categories have no connection to product attribute sets, and any product can be assigned to any category
Each category is linked to a single product attribute set, and only products from that attribute set are allowed in the category
Each category is linked to a single product attribute set, and only products from that category's set or any of its parent categories' sets are allowed
Categories can be connected to multiple product attribute sets, and only products from one of those sets are allowed in the category
Question 7
How can you access the select query of a collection?
You can only access the select query after the collection has been loaded by calling the public method query()
It is stored in a protected variable $query and can only be accessed from the inside of a collection class
You can get it by using public method getSelect() which returns an instance of Magento\Framework\DB\Select
The select query is not available in the collection class, it will be generated by the MySQL adapter right before executing a query
Question 8
You are developing a module MyCompany_StoreInfo to display information about brick and mortar stores on a frontend page. The displayed information varies based on the country of a given store. What two elements automatically render their children? (Choose two.)
Assume that $collection is a new instance of a class that extends Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection, and $ids is an array of ids. How do you select a list of records from the database where the record ids are in the $ids list?
$collection->addFieldToFilter('record_id',['in'=>$ids]); B.
$collection->in($ids);
$collection->filterIn($ids);
Question 10
While reviewing a layout file named sales_order_view.xml you notice the element What is the purpose of this element?
Replaces the customer_account handle with sales_order_view
Nothing, this element has been deprecated
Adds the customer_account handle to the page's handles list
Updates the current page handle to customer_account