O'Reilly logo

Developing and Implementing Windows®-Based Applications with Visual C#™ .NET and Visual Studio® .NET Exam Cram™ 2 (Exam 70-316) by Priti Kalani, Amit Kalani, Kalani Kirk Hausman

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Practice Questions

Question 1You have created the following code segment:
try
{
   //Write code to allocate some resources
}
finally
{
   //Write code to Dispose all allocated resources
}

Which of the following will result from compiling this code, assuming that all other code for your form works properly?

  • A. The code will generate an error because it lacks a catch block.

  • B. The code will generate an error because it lacks a throw statement.

  • C. The code will generate an error because the finally block is placed immediately after the try block.

  • D. The code will compile without an error.

A1: Answer D is correct. The code will compile properly because a try block should be followed by either a catch block or a finally block. The code here includes both ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required