nerdexam
Microsoft

98-361 · Question #383

You are C# developer who is developing a Windows application. You write the following code: Object o; Later in the code, you need to assign the value in the variable o to an object of Rectangle…

Sign in or unlock 98-361 to reveal the answer and full explanation for question #383. The question stem and answer options stay visible for context.

Question

You are C# developer who is developing a Windows application. You write the following code:

Object o; Later in the code, you need to assign the value in the variable o to an object of Rectangle type. You expect that at runtime the value in the variable o is compatible with the Rectangle class. However, you need to make sure that no exceptions are raised when the value is assigned. Which of the following code should you use?

Options

  • ARectangle r = (Rectangle) o;
  • BRectangle r = o;
  • CRectangle r = o as Rectangle;
  • DRectangle r = o is Rectangle;

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.

Full 98-361 Practice