Microsoft
98-361 · Question #337
98-361 Question #337: Real Exam Question with Answer & Explanation
Sign in or unlock 98-361 to reveal the answer and full explanation for question #337. The question stem and answer options stay visible for context.
Question
You are writing a C# program. You write the following method: public static void TestSwitch(int op1, int op2, char opr) { int result; switch (opr) { case '+': result = op1 + op2; case '-': result = op1 - op2; case '*': result = op1 * op2; case '/': result = op1 / op2; default: Console.WriteLine("Unknown Operator"); return; } Console.WriteLine("Result: {0}", result); return; } However, when you compile this code, you get the following error message: Control cannot fall through from one case label to another How should you modify the code to make sure that it compiles successfully?
Options
- AAfter each case, add the following code line:
- BAfter each case, add the following code line:
- CAfter each case, add the following code line:
- DAfter each case, add the following code line:
Unlock 98-361 to see the answer
You've previewed enough free 98-361 questions. Unlock 98-361 for full answers, explanations, the timed quiz mode, progress tracking, and the master PDF. Question stem and options stay visible so you can still see what's on the exam.