Thursday, March 29, 2012

Microsoft.Net framework 4.0 Interview Questions Answers

Q. Whats is Parallel Computing?

Ans. To take advantage of multiple cores (that is, CPUs or processors) you can parallelize your code so that it will be distributed across multiple processors. In the past, parallelization required low-level manipulation of threads and locks, but Visual Studio 2010 and the .NET Framework 4 enhances the support for parallel programming by providing a new runtime, new class library types, and new diagnostic tools. These features simplify parallel development so that you can write efficient, fine-grained, and scalable parallel code in a natural idiom without having to work directly with threads or the thread pool.

The new System.Threading.Tasks namespace and other related types support this new model.

Q. What is BigInteger and When would you use that?

Ans. BigInteger, which is a part of System.Numerics Namespace is a great enhancement over Byte and Int32 datatypes. It is a nonprimitive integral type that supports arbitrarily large signed integers. Unlike Byte and Int32 types, BigInteger does not include a Minvalue and MaxValue property, so can be used to store large integer values.

Q. What other than BigInteger has been introduced in System.Numerics Namespace?

Ans. Complex types,which represents a complex number has been Introduced. a complex number is a number in the form a + bi, where a is the real part, and b is the imaginary part.

Q. How do you assign a Value to a Complex Number.

Ans. You can assign a value to a complex number in few different ways.
1. By passing two Double values to its constructor. The first value represents the real part of the complex number, and the second value represents its imaginary part.
2. By assigning a Byte, SByte, Int16, UInt16, Int32, UInt32, Int64, UInt64, Single, or Double value to a Complex object. The value becomes the real part of the complex number, and its imaginary part equals 0.

E.g Complex c1 = new Complex(12, 6);
OutPut - (12, 6)

Q. How has exception hand changed in .Net Framework 4.0

Ans. A New Namespace System.Runtime.ExceptionServices has been introduced which provides classes for advanced exception handling. It has introduced the following classes
1. HandleProcessCorruptedStateExceptionsAttribute Class - Enables managed code to handle exceptions that indicate a corrupted process state.So,If you want to compile an application in the .NET Framework 4 and handle corrupted state exceptions, you can apply this attribute to the method that handles the corrupted state exception.
2.FirstChanceExceptionEventArgs Class -Provides data for the notification event that is raised when a managed exception first occurs, before the common language runtime begins searching for event handlers.

No comments:

Post a Comment