nerdexam
Magento

M70-201 · Question #45

You want to filter a product collection so that it will return only SKUs 12 and 123. You will use a call to $collection->addFieldToFilter('sku', ______________ ); Two of the following arrays could…

The correct answer is B. array(array('eq' => 12), array('eq' => 123)) D. array(12, 123). See the full explanation below for the reasoning.

Question

You want to filter a product collection so that it will return only SKUs 12 and 123. You will use a call to $collection->addFieldToFilter('sku', ______________ ); Two of the following arrays could be used to complete that call correctly. Which two? (Choose two)

Options

  • Aarray('sku' => 12, 'sku' => 123)
  • Barray(array('eq' => 12), array('eq' => 123))
  • Carray(12 => true, 123 => true)
  • Darray(12, 123)
  • Earray(array('int' => 12), array('int' => 123))

How the community answered

(34 responses)
  • A
    3% (1)
  • B
    85% (29)
  • C
    3% (1)
  • E
    9% (3)

Community Discussion

No community discussion yet for this question.

Full M70-201 Practice