Microsoft
MB6-894 · Question #2
MB6-894 Question #2: Real Exam Question with Answer & Explanation
The correct answer is D. Add a break statement before the default block of code in the switch statement.. See the full explanation below for the reasoning.
Question
You are a developer working on a new customized form and are troubleshooting a defect on the form. The form displays a summary for each line. The defect report says that the form shows the incorrect summary for return order lines. A display method provides the summary, and the method calls the following: public str salesLineSummary( SalesType _type, str _orderNum, ItemId _itemId, Qty _lineQty, Amount _lineAmount ) { Amount baseAmount = _lineAmount > 0 ? _lineAmount : -1 * _lineAmount; str formattedAmount = num2Str(baseAmount, 10, 2, DecimalSeparator::Dot, ThousandSeparator::Comma); str summary; switch (_type) { case SalesType::Sales: summary = strFmt('Order %1 ordered %2 of %3 [Subtotal: %4]', _orderNum, _lineQty, _itemId, formattedAmount); break; case SalesType::ReturnItem: summary = strFmt('RMA %1 expecting %2 of %3 for %4 credit', _orderNum, _lineQty, _itemId, formattedAmount); default: summary = strFmt('Journal %1: %2 of %3', _orderNum, _lineQty, _itemId); } return summary; } You need to fix the defect in the most efficient way possible. Which modification should you make?
Options
- ARemove the default block of code from the switch statement.
- BAdd an If statement to the default block of code in the switch statement.
- CExchange theSalesType::Saleswith theSalesType::ReturnItemblocks of code in the switch
- DAdd a break statement before the default block of code in the switch statement.
Community Discussion
No community discussion yet for this question.