Wednesday 21 March 2012

OOPS Dotnet Frequently Asked Interview Questions


1. List out some of the exception classes in C#?

Common Exception Classes :


The following exceptions are thrown by certain C# operations.


System.IndexOutOfRangeException
System.InvalidCastException
System.InvalidOperationException
System.ObjectDisposedException
System.FormatException
System.NullReferenceException Thrown when a null reference is used in a way that causes the referenced object to be required.
System.TypeInitializationException Thrown when a static constructor throws an exception, and no catch clauses exists to catch in.
System.InvalidCastException Thrown when an explicit conversion from a base type or interface to a derived types fails at run time.
System.ArrayTypeMismatchException Thrown when a store into an array fails because the actual type of the stored element is incompatible with the actual type of the array.
System.IndexOutOfRangeException Thrown when an attempt to index an array via an index that is less than zero or outside the bounds of the array.
System.MulticastNotSupportedException Thrown when an attempt to combine two non-null delegates fails, because the delegate type does not have a void return type.
System.ArithmeticException A base class for exceptions that occur during arithmetic operations, such as DivideByZeroException and OverflowException.
System.DivideByZeroException Thrown when an attempt to divide an integral value by zero occurs.
System.OverflowException Thrown when an arithmetic operation in a checked context overflows.
System.OutOfMemoryException Thrown when an attempt to allocate memory (via new) fails.
System.StackOverflowException Thrown when the execution stack is exhausted by having too many pending method calls; typically indicative of very deep or unbounded recursion
System.Threading.SynchronizationLockException
System.StackOverflowException
System.Threading.ThreadStateException
System.UnauthorizedAccessException.




2. What are Deligates ?

Delegates enable scenarios that C++ and some other languages have addressed with function pointers. Unlike function pointers, delegates are object-oriented, type-safe, and secure.
Delegates are reference types that derive from a common base class: System.Delegate. A delegate instance encapsulates a method—a callable entity. For instance methods, a callable entity consists of an instance and a method on the instance. For static methods, a callable entity consists of a class and a static method on the class.
An interesting and useful property of a delegate is that it does not know or care about the type of the object that it references. Any object will do; all that matters is that the method’s signature matches the delegate’s. This makes delegates perfectly suited for “anonymous” invocation. This is a powerful capability.
There are three steps in defining and using delegates: declaration, instantiation, and invocation. Delegates are declared using delegate declaration syntax.
delegate void SimpleDelegate();
declares a delegate named SimpleDelegate that takes no arguments and returns void.


3. What are Labeled statements?

A labeled-statement permits a statement to be prefixed by a label. Labeled statements are permitted blocks, but are not permitted as embedded statements.
labeled-statement:
identifier : statement
A labeled statement declares a label with the name given by the identifier. The scope of a label is the block in which the label is declared, including any nested blocks. It is an error for two labels with the same name to have overlapping scopes.
A label can be referenced from goto statements within the scope of the label. This means that goto statements can transfer control inside blocks and out of blocks, but never into blocks

4. Can you tell me about Array Co variance?

For any two reference-types A and B, if an implicit reference conversion or explicit reference conversion exists from A to B, then the same reference conversion also exists from the array type A[R] to the array type B[R], where R is any given rank-specifier (but the same for both array types). This relationship is known as array covariance. Array covariance in particular means that a value of an array type A[R] may actually be a reference to an instance of an array type B[R], provided an implicit reference conversion exists from B to A.
Because of array covariance, assignments to elements of reference type arrays include a run-time check which ensures that the value being assigned to the array element is actually of a permitted type.



5. Do you Know about Versioning?

Versioning is the process of evolving a component over time in a compatible manner. A new version of a component is source compatible with a previous version if code that depends on the previous version can, when recompiled, work with the new version. In contrast, a new version of a component is binary compatible if a program that depended on the old version can, without recompilation, work with the new version.Most languages do not support binary compatibility at all, and many do little to facilitate source compatibility. In fact, some languages contain flaws that make it impossible, in general, to evolve a class over time without breaking at least some client code.


Tuesday 20 March 2012

Cross Browser Dynamic HTML Checking For Browser

The document layers object is specific to Netscape 4.0.While the document all object is specific to IE 4.0.So by  checking if the objects exists we can create the Boolean variables NS4 for Netscape 4.0 and IE4 for INTERNET EXPLORER 4.0 and assign them true are false depending upon which browser is used. Now whenever you need to check which browser someone is using you just have to use  NS4 or  IE4.
  NS4  =(document. layers) 
   IE4   = (document .all)

Cross Browser Dynamic HTML Introduction

Netscape and Microsoft each have their own definition of Dynamic HTML. Cross-Browser DHTML is the subset of DHTML functionality which can be used compatibly across platforms and across Navigator 4.0 and Internet Explorer 4.0.




DHTML is a word for web pages that uses HTML(Hyper Text Markup Language), CSS(Cascading Style Sheets) and rely on Java Scripts to make the web page interactive. It is a feature of Netscape Communicator 4.0, and Microsoft Internet Explorer 4.0 and is entirely a "client-side" technology. It relies only the browser for the display and manipulation of the web pages and is unrelated to other client-side technologies like Java, Flash.


DHTML excels in creating low bandwidth effects that enhance a web page's functionality. It can be used to create animations, games, applications, provide new ways of navigating through web sites, and create out-of-this world page layouts that simply aren't possible with just HTML. Although many of features of DHTML can be duplicated with either Flash or Java, DHTML provides an alternative that does not require plugins and embeds seamlessly into a web page.


Although the underlying technologies of DHTML (HTML, CSS, JavaScript) are standardized, the manner in which Netscape and Microsoft have implemented them differ dramatically. For this reason, writing DHTML pages that work in both browsers (referred to as cross-browser DHTML) can be a very complex issue.