Monday, November 22, 2010

Delegate

A delegate object encapsulates a reference to a method.

Indexers : Indexers allow instances of a class or struct to be indexed just like arrays. Indexers resemble properties except that their accessors take parameters.

An indexer is a member that enables an object to be indexed in the same way as an array.

Indexer
Allows methods on an object to be called as though the object is an array.
Accessed through an index.
Must be an instance member.
A get accessor of an indexer has the same formal parameter list as the indexer.
A set accessor of an indexer has the same formal parameter list as the indexer, in addition to the value parameter.
class IndexerImplemenationStack{


            {
            private string[] range = new string[5];            public string this[int index]               get                 {

                 }
                    return range[index];              set                  {
                     range[index] =
                  }
              }
}

Ind[0] =
Ind[1] =

{

}
IndexerImplemenationStack Ind= new IndexerImplemenationStack();"sachin";"Rastogi";for (int i = 0; i< 2; i++)       Console.WriteLine(Ind[i]);
value;
Property
Allows methods to be called as though they were public data members.
Accessed through a simple name.
Can be a static or an instance member.
A get accessor of a property has no parameters.
A set accessor of a property contains the implicit value parameter.

Sunday, November 21, 2010

OOPs

Static classes:  Static classes are used when a class provides functionality that is not specific to any unique instance. Here are the features of static classes in C# 2.0.
Static classes can not be instantiated.
Static classes are sealed so they can not be inherited.
Only static members are allowed.
Static classes can only have static constructor to initialize static members.


What are Generics ? How do they affect performance.
Generics allow you to define type-safe data structures, without committing to actual data types.


1.     1.Does C# support multiple-inheritance?
No. But you can use Interfaces.

2.Where is a protected class-level variable available?
It is available to any sub-class derived from base class

3.Are private class-level variables inherited?
Yes, but they are not accessible.


4.Describe the accessibility modifier “protected internal”.
It is available to classes that are within the same assembly and derived from the specified base class.

6.Which class is at the top of .NET class hierarchy?
System.Object.

7.What does the term immutable mean?
The data value may not be changed.
Note: The variable value may be changed, but the original immutable data value was discarded and a new data value was created in memory.

8.What’s the difference between System.String and System.Text.StringBuilder classes?
System.String is immutable.
System.StringBuilder was designed with the purpose of having a mutable string where a variety of operations can be performed.

9.What’s the advantage of using System.Text.StringBuilder over System.String?

StringBuilder is more efficient in cases where there is a large amount of string manipulation. Strings are immutable, so each time a string is changed, a new instance in memory is created.

10.Can you store multiple data types in System.Array?
No.

11.What’s the difference between the System.Array.CopyTo() and System.Array.Clone()?
The Clone() method returns a new array (a shallow copy) object containing all the elements in the original array. The CopyTo() method copies the elements into another existing array. Both perform a shallow copy. A shallow copy means the contents (each array element) contains references to the same object as the elements in the original array. A deep copy (which neither of these methods performs) would create a new instance of each element's object, resulting in a different, yet identacle object.

12.How can you sort the elements of the array in descending order?
By calling Sort() and then Reverse() methods.

13.What’s the .NET collection class that allows an element to be accessed using a unique key?
HashTable.

14.What class is underneath the SortedList class?
A sorted HashTable.

15.Will the finally block get executed if an exception has not occurred?
Yes.

16.What’s the C# syntax to catch any possible exception?
A catch block that catches the exception of type System.Exception. You can also omit the parameter data type in this case and just write catch {}.

17.Can multiple catch blocks be executed for a single try statement?
No. Once the proper catch block processed, control is transferred to the finally block .

18.Explain the three services model commonly know as a three-tier application?
Presentation (UI), Business (logic and underlying code) and Data (from storage or other sources).


1.What is the syntax to inherit from a class in C#?
Place a colon and then the name of the base class.
Example: class MyNewClass : MyBaseClass

2.Can you prevent your class from being inherited by another class?
Yes. The keyword “sealed” will prevent the class from being inherited.

3.Can you allow a class to be inherited, but prevent the method from being over-ridden?
Yes. Just leave the class public and make the method sealed.

4.What’s an abstract class?
A class that cannot be instantiated. An abstract class is a class that must be inherited and have the methods overridden. An abstract class is essentially a blueprint for a class without any implementation.

5.When do you absolutely have to declare a class as abstract?

1. When the class itself is inherited from an abstract class, but not all base abstract methods have been overridden.

2. When at least one of the methods in the class is abstract.


6.What is an interface class?
Interfaces, like classes, define a set of properties, methods, and events. But unlike classes, interfaces do not provide implementation. They are implemented by classes, and defined as separate entities from classes.

7.Why can’t you specify the accessibility modifier for methods inside the interface?
They all must be public, and are therefore public by default.

8.Can you inherit multiple interfaces?
Yes. .NET does support multiple interfaces.

9.What happens if you inherit multiple interfaces and they have conflicting method names?
It’s up to you to implement the method inside your own class, so implementation is left entirely up to you. This might cause a problem on a higher-level scale if similarly named methods from different interfaces expect different data, but as far as compiler cares you’re okay.

10. What’s the difference between an interface and abstract class?
In an interface class, all methods are abstract - there is no implementation. In an abstract class some methods can be concrete. In an interface class, no accessibility modifiers are allowed. An abstract class may have accessibility modifiers.

11. What is the difference between a Struct and a Class?
Structs are value-type variables and are thus saved on the stack, additional overhead but faster retrieval. Another difference is that structs cannot inherit.
2.    Method and Property Questions
3.   

1. What’s the implicit name of the parameter that gets passed into the set method/property of a class?
Value. The data type of the value parameter is defined by whatever data type the property is declared .

2. What does the keyword “virtual” declare for a method or property?
The method or property can be overridden.

3. How is method overriding different from method overloading?
When overriding a method, you change the behavior of the method for the derived class. Overloading a method simply involves having another method with the same name within the class.

4. Can you declare an override method to be static if the original method is not static?
No. The signature of the virtual method must remain the same. (Note: Only the keyword virtual is changed to keyword override)

5. What are the different ways a method can be overloaded?
Different parameter data types, different number of parameters, different order of parameters.

6. If a base class has a number of overloaded constructors, and an inheriting class has a number of overloaded constructors; can you enforce a call from an inherited constructor to a specific base constructor?
Yes, just place a colon, and then keyword base (parameter list to invoke the appropriate constructor) in the overloaded constructor definition inside the inherited class.
4.    Events and Delegates
5.   

1. What’s a delegate?
A delegate object encapsulates a reference to a method.

2. What’s a multicast delegate?
A delegate that has multiple handlers assigned to it. Each assigned handler (method) is called.

3. What’s the implicit name of the parameter that gets passed into the class’ set method?
Value, and it’s datatype depends on whatever variable we’re changing.

4. How do you inherit from a class in C#?
Place a colon and then the name of the base class.

5. Does C# support multiple inheritance?
No, use interfaces instead.

6. When you inherit a protected class-level variable, who is it available to?
Classes in the same namespace.

7. Are private class-level variables inherited?
Yes, but they are not accessible, so looking at it you can honestly say that they are not inherited.

8. Describe the accessibility modifier protected internal.?
It’s available to derived classes and classes within the same Assembly (and naturally from the base class it’s declared in).

9. C# provides a default constructor for me. I write a constructor that takes a string as a parameter, but want to keep the no parameter one. How many constructors should I write?
Two. Once you write at least one constructor, C# cancels the freebie constructor, and now you have to write one yourself, even if there’s no implementation in it.

10. What’s the top .NET class that everything is derived from?
System.Object.

11. How’s method overriding different from overloading?
When overriding, you change the method behavior for a derived class. Overloading simply involves having a method with the same name within the class.

12. What does the keyword virtual mean in the method definition?
The method can be over-ridden.

13. Can you declare the override method static while the original method is non-static?
No, you can’t, the signature of the virtual method must remain the same, only the keyword virtual is changed to keyword override.

14. Can you override private virtual methods?
No, moreover, you cannot access private methods in inherited classes, have to be protected in the base class to allow any sort of access.

15. Can you prevent your class from being inherited and becoming a base class for some other classes?
Yes, that’s what keyword sealed in the class definition is for. The developer trying to derive from your class will get a message: cannot inherit from Sealed class WhateverBaseClassName.
It’s the same concept as final class in Java.

16. Can you allow class to be inherited, but prevent the method from being over-ridden?
Yes, just leave the class public and make the method sealed.

17. What’s an abstract class?
A class that cannot be instantiated. A concept in C++ known as pure virtual method. A class that must be inherited and have the methods over-ridden.
Essentially, it’s a blueprint for a class without any implementation.

18. When do you absolutely have to declare a class as abstract (as opposed to free-willed educated choice or decision based on UML diagram)?
When at least one of the methods in the class is abstract. When the class itself is inherited from an abstract class, but not all base abstract methods have been over-ridden.

19. What’s an interface class?
It’s an abstract class with public abstract methods all of which must be implemented in the inherited classes.

20. Why can’t you specify the accessibility modifier for methods inside the interface?
They all must be public. Therefore, to prevent you from getting the false impression that you have any freedom of choice, you are not allowed to specify any accessibility, it’s public by default.

21. Can you inherit multiple interfaces?
Yes, why not.

22. And if they have conflicting method names?
It’s up to you to implement the method inside your own class, so implementation is left entirely up to you.
This might cause a problem on a higher-level scale if similarly named methods from different interfaces expect different data, but as far as compiler cares you’re okay.

23. What’s the difference between an interface and abstract class?
In the interface all methods must be abstract, in the abstract class some methods can be concrete. In the interface no accessibility modifiers are allowed, which is ok in abstract classes.

24. How can you overload a method?
Different parameter data types, different number of parameters, different order of parameters.

25. If a base class has a bunch of overloaded constructors, and an inherited class has another bunch of overloaded constructors, can you enforce a call from an inherited constructor to an arbitrary base constructor?
Yes, just place a colon, and then keyword base (parameter list to invoke the appropriate constructor) in the overloaded constructor definition inside the inherited class.

26. What’s the difference between System.String and System.StringBuilder classes?
System.String is immutable, System.StringBuilder was designed with the purpose of having a mutable string where a variety of operations can be performed.

27. Is it namespace class or class namespace?
The .NET class library is organized into namespaces. Each namespace contains a functionally related group of classes so natural namespace comes first.

The Common Language Specification
This is a subset of the Common Type System (CTS) and defines a set of conventions that are targeted at language interoperability of all the languages that run within the .NET environment.
The Common Type System
The Common Type System (CTS) is a standard that defines the necessary rules for type interoperability for the languages targeting the .NET environment.  The common type system supports the following types.
         Value Types
         Reference Types
.NET Framework Class Library
The .NET Framework Class Library (FCL) is a set of managed classes that are responsible for providing access to the system services in the managed environment of Microsoft.NET.
The Common Language Runtime
The CLR is a runtime execution engine of .NET that provides an environment to execute programs that are targeted at the .NET platform.  It provides memory allocation, security, code verification, type verification, exception handling and garbage collection in the managed environment.
Common Language Infrastructure
The Common Language Infrastructure or the CLI provides support for language interoperability in the .NET managed environment.  It is comprised of the following features.
         A File Format (PE)
         Metadata
         MSIL
         Base Class Library
Assembly
An assembly is a group of resources and types, along with the metadata about those resources and types, deployed as a single unit.
Just In Time Compiler
The Just In Time Compiler or the JIT is responsible for compiling units of code and caching them at runtime as and when they are needed.  Since the compilation occurs at runtime, it is known as a Just In Time Compilation.

MSIL
A program compiled in the .NET managed environment generates an intermediate code to support platform independence.  This is called the MSIL or Microsoft Intermediate Language.
Strong Name
A Strong Name is a unique identifier given to an assembly using cryptography and a digital signature that is used to identify a particular assembly.  An assembly is provided a strong name using the utility called sn.exe.
A strong name consists of the following.
         Name of the Assembly
         Digital Signature
         Version Number
         Culture Information
Global Assembly Cache
The Global Assembly Cache is a system wide storage of shared assemblies.  Assemblies can be stored or moved to and from the Global Assembly Cache using a tool called GacUtil.
Managed Code
A managed code is one that provides restricted access to the system’s resources and can be executed only in a managed environment that is provided in Microsoft .NET by the Common Language Runtime.
Un-Managed Code
An Un-Managed code is one that executes outside of the Common Language Runtime environment and can perform unsafe operations.
Managed Data
Managed Data refers to the objects that are created by the Common Language Runtime environment and can be garbage collected implicitly by the Garbage Collector.
Shared Assembly
A Shared Assembly is one that can be referred by more that one application.  All shared assemblies should contain a strong name and should be located in the Global Assembly Cache (GAC).
Private Assembly
A Private Assembly is one that is private to one application.  In other words, it can be accessed by the containing application only.
Satellite Assembly
When you wish to localize the application, it can be written in culture-neutral code and can distribute the localized modules in separate assemblies called satellite assemblies.
Assembly Manifest
The Assembly Manifest contains the information about an assembly.  This includes the version number of the assembly, the list of the files that comprise the assembly, etc.  An assembly manifest is contained in the dll file or the exe file itself.
Resource
A resource refers to an addressable unit of data that is available for use by an application.  It consists of one or more of the following.
         Texts
         Files
         Documents
         Images
         The .NET tool called resgen.exe is used to create resource files from the resource information that is stored in text or XML files.
Localization
Localization is the practice of designing and developing software that will properly use all of the conventions defined for a specific locale.  An assembly that is used to provide localization feature in ASP.NET applications is referred to as a Satellite Assembly.
Native Image Generator
This is a .NET tool that is used to compile a managed assembly to the native code and then store that in the local assembly cache.  The name of this tool is Ngen.exe.
Value Type
A value type is one that contains the value rather than the reference and is stored in the stack memory.  Examples of value types are integers, floats, doubles, structures, etc.
Reference Type
A reference type contains a reference to the actual object in memory and is stored in the managed heap. Objects of classes are good examples of reference types.
Boxing
Boxing refers to the conversion of a value type to a reference type.  Value types are stored in the stack and reference types are stored in the managed heap.
Un-Boxing
This refers to the conversion of a reference type to a value type.
Garbage Collection
Garbage Collection is a technique introduced in Microsoft .NET that manages memory cleanup implicitly.  This implicit reclaiming of memory in the .NET managed environment is handled by the Common Language Runtime.
Dispose Method
The Dispose method can be used in an unsealed class to cleanup resources explicitly.  It should be noted that both the Dispose and the Finalize methods should make a call to their parents' respective methods after they have disposed or finalized their own members.  A class that needs to have this method implemented should implement the IDisposable interface.
Finalize Method
The finalize method is a protected member of the Object class and is implicitly called at the runtime to cleanup unmanaged resources before the object is destroyed.
Code Verification
This is a feature that enforces type safety or type security by checking the code prior to its execution in the run time environment.  Therefore, it does not allow malicious code to get executed in the managed environment.
Authentication and Authorization
This is a security measure that is used to specify the user’s identity and authorization in ASP.NET. The process of authorization determines whether an authenticated user has access to a specific resource.  Authentication and Authorization details of an ASP.NET application are specified in the web.config file.  There can be three types of authentication in ASP.NET.
         Forms Authentication
         Windows Authentication
         Passport Authentication
Web.Config File
The web.config file is the configuration file for an ASP.NET web application.  Typically, the following information is stored in a web.config file.
         Database Connection Strings
         Security
         Session States
         Impersonation
         Error handling
Machine.Config File
The machine.config file contains the configuration settings for the entire application and is located in the Config sub-folder of the Microsoft .NET installation directory.
ASP.NET
ASP.NET is a language neutral, interoperable, server-side technology that allows creation, execution and deployment of scalable Web Applications and Services.
Caching
Caching is a feature that stores the data in the memory for serving the incoming requests from the memory itself.  Caching in ASP.NET can be of three types.
         Page Output Caching
         Page Fragment Caching
         Data Caching
Singleton Pattern
A singleton pattern states that we can have a singleton class that can be instantiated only once in the application domain and provides a global point of access to it.
Application Domain
An application domain refers to the logical and physical boundary created around every .NET application.  An application domain is created by the Common Language Runtime and supports execution of multiple .NET applications in the same process by isolating them in different application domains.
View State
This is a client-side state management technique that continues the state of server controls by maintaining the state of pages across postbacks.  The view state is an encoded hashed string and is stored in a hidden field called __VIEWSTATE.
Session State
A session is the period of a connection between a server and a client.  The Session State allows storage of objects in a user’s session.  A session can be stored in one of the following ways.
         InProc
         State Server
         SQL Server
Application State
This is a state management technique that allows objects to be stored and then globally accessed or shared by multiple modules of the application.  In ASP.NET, application state is maintained by the class HttpApplicationState.
Interface Definition Language (IDL)
The Interface definition Language (IDL) defines a protocol between the server and the client so that they can communicate in heterogeneous environments.
Universal Description, Discovery and Integration (UDDI)
Universal Description, Discovery and Integration is a platform independent, XML based, distributed directory that allows the enterprises to list themselves over the internet.  The UDDI business registration contains the following features.
         Green Pages
         White Pages
         Yellow Pages
Web Service Description Language (WSDL)
The Web Service Description Language (WSDL) defines XML based contract services for describing the network services as a collection of communication end points.  A WSDL document contains the following.
         Messages
         Operation
         Types
         Service
         Port and its type
Simple Object Oriented Protocol (SOAP)
This is an XML-based protocol that is used to exchange structured data and type information in a distributed environment.
Web Services
A web service is SOAP based, platform–independent software component that exposes itself through open communication channels of the web applications running on potentially different platforms.
Remoting
Remoting allows two processes, a Server and a Client, to inter-communicate in the same system, the same network or across networks.  In Remoting, a server and client communicate using a Channel.
Service Oriented Architecture
Service Oriented Architecture is an architecture that provides a seamless Enterprise Information Integration between loosely coupled distributed applications or services over the network.
Service
A service is an implementation of a well-defined, self-contained, independent business functionality that accepts one or more requests and returns one or more responses through a well-defined, standard interface.
Smart Client Architecture
The Smart Client Architecture is a deployable, multi-platform architecture that allows local application to connect to a server based application using web services.  It provides an adaptive and rich user interactive experience by using local resources.  A Smart Client application can work in both connected and disconnected modes.
ADO.NET
ADO.NET is an object oriented data access technology that enables you to access data from a managed environment.  It is essentially a collection of some classes used to communicate between an application and a database.
Connection Pool
A Connection Pool is a pool of available or ready-to-use connections.  When a new connection is requested it is served from the connection pool if one exists.  If not, a new connection is created. Connection Pooling improves the performance of applications to a large extent.
DataProvider
A DataProvider encapsulates the protocols that ADO.NET uses to interact with different types of databases.
DataSet
The DataSet is an in–memory, disconnected, XML compliant representation of the data.  Data in a DataSet can be changed, unlike a DataReader which is read only.
DataReader
A DataReader is a connected, forward only, read only stream of data that is retrieved from the database.
DataAdapter
The DataAdapter is a bridge between the DataSet and the underlying database. It provides a set of methods and properties to move data between a database and its in-memory representation, the DataSet.
DataView
A DataView is a class that provides a customized view of the DataSet.  It is typically used to sort or filter the rows.
Command
The Command object is used to send the SQL Statements to the database.  Commands are used to insert data, retrieve data and execute stored procedures in the database.
Connection
The Connection object establishes a connection to the database using the user name, password and the database name as parameters.
Transactions
A transaction is a block of statements that guarantees that all or none of the statements in the block are executed.  In ADO.NET, a transaction can be started by using the BeginTransaction() method on the currently active Connection.  To commit the transaction, the method CommitTransaction() is used.  In order to abandon the transaction, the method Rollback() is executed.
Serialization
This refers to the storage of an object into a persistent storage medium in a stream of bytes.  The opposite is de-serialization and is used to retrieve a serialized object from a storage medium.
Reflection
This is a feature that allows us to inspect the metadata of an assembly at runtime.  Reflection can be used to retrieve metadata information, such as the following.
         Classes
         Methods
         Properties
         Events
Biztalk Server
This is a set of Microsoft Server Applications that allow integration, automation and management of different server applications.
Exchange Server
This is a set of Microsoft Server Applications that are responsible for integrating messaging and data storage technologies.
Commerce Server
This is Microsoft’s Business Server that is used for managing and developing business web sites.
Array
An array is a collection of homogenous objects.  It is a group of elements of the same type that share a common name.  The size of an array is fixed and cannot be changed at runtime.
ArrayList
An ArrayList is a collection of heterogeneous elements- elements of different types.   Unlike an array, its size can be changed dynamically.
HashTable
A HashTable is a collection of heterogeneous objects that can be referred using either an index or a key.  Elements of an ArrayList can be referred to using an index only.
COM+
COM+ or COM Plus is a distributed, transactional, component-based technology that can be used in a multi-tiered architecture and provides support for Object Pooling.
Delegate
A delegate is a managed function pointer that refers to a method.  A multi-cast delegate is one that points to and can eventually fire off different methods.  A delegate is used to implement event handling in Microsoft .NET.
Event Handler
An event handler is a method that is executed in response to an event.
Exception
An exception is an event that is generated as a result of a runtime error.  An exception is handled using the exception blocks.  An exception that cannot be handled is referred to as a fatal exception and causes the flow of execution of the current program to terminate unexpectedly.
Try/Catch Block
A try/catch block is used in exception handling and provides a mechanism to trap runtime errors that can occur on execution of the application.  A try block contains the code that can generate a runtime error.  The catch block contains statements that are executed once the appropriate exception has occurred.  A try block can contain one or more catch blocks or a finally block.
Finally Block
A finally block is one that is executed irrespective of whether an exception occurs or not.  Typically, it is used in Exception Handling mechanism to release resources.
Namespace
A namespace refers to a logical grouping of types or identifiers used in a program.

 
OOPS - Object Oriented Programming Languages & Systems.
Everything in the world is an object. The type of the
object may vary. In OOPS, we get the power to create
objects of our own, as & when required.
Class - A class is an organized store-house in
object-oriented programming that gives coherent
functional abilities to a group of related code. It is
the definition of an object, made up of software code.
Using classes, we may wrap data and behaviour together
(Encapsulation). We may define classes in terms of
classes (Inheritance). We can also override the
behaviour of a class using an alternate behaviour
(Polymorphism).
http://sites.google.com/site/moredotnet/inheritance-full.jpg
Using inhertance, we may assign different traits to different
classes. Yet, the child classes will inherit some common
traits from the base class. As in the figure above, the
classes for "Permanent" and "Wage Worker" will inherit
some common traits from the class of "Employee".
A class may contain class members like fields, properties,
events & methods with different types of access modifiers
like private, public, protected or friend, to process the
way they are accessed. In VB.NET, a class may be declared
as below...
Public Class SampleClass
    'define class members  
End Class  
                                                   
Key Concepts of .NET - To work with classes and modules,
the key concepts to know are definition, access, inheritance,
constructors, destructors, delegates, abstract classes & interfaces..
Class members - The different types of entities in a class,
like fields, properties, events & methods.
Object - An object is an instance of a class. This instance
may be used to access the members of the class. It is pretty
easy to define an object. See sample code below...
Dim objSampleObject as SampleClass
Structure - It is a bit similar to a class. Semantically,
structures are known as value types, while classes as reference types. We do'nt instantiate an object using the New keyword while working with a structure. We can not inherit from a structure.
Public Structure Student
  Public RollNo as Integer
  Public Name as String
End Structure
Dim objStud as Student
objStud.RollNo=31
objStud.Name="Monu"
Here, note that the object objStud is not exactly an instance,
it is a simple object (object of a structure) that is used to
access the members of this structure. It would have behaved
differently had it been an object of a class, as it would have
invoked the constructor associated with the class.
Public Class ClassCalc
   Public Function FnAdd(ByVal dblA as double, ByVal dblB _
                                as double) as Double
     FnAdd = dblA + dblB
   End Function
End Class
Now, lets make use of the method FnAdd defined in the class
above. To use it, first create an object of this class, say
objX. Using this object, we can invoke the methods of this
class. See code below...
Dim objX as ClassCalc
Dim dblResult as Double
dblResult = objX.FnAdd(4.56,2.35)
Property - A property is a thing that describes the features of an object. A property is a piece of data contained within a class that has an exposed interface for reading/writing. Looking at that definition, you might think you could declare a public variable in a class and call it a property. While this assumption is somewhat valid, the true technical term for a public variable in a class is a field. The key difference between a field and a property is in the inclusion of an interface.
We make use of Get and Set keywords while working with
properties. We prefix the variables used within this code block with an underscore. Value is a keyword, that holds the value
which is being retrieved or set.
Private _Color As String
     Public Property Color()
            Get
                 Return _Color
            End Get
     Set(ByVal Value)
                 _Color = Value
     End Set
End Property
Event - An action that an object does. When something happens, we say an event has happened. For example, when a button is clicked, we say it is the click( ) event. When a mouse hovers on an image, we say the mouseover( ) event has taken place.
Access Modifiers - Keywords used to vary the way members of a class are used. Following are different types...
1) Public - These classes can be used anywhere in the code.
There are no restrictions.
Available only to code outside our class
2) Private - These classes are accessible only within their
declaration contexts. This includes nested procedures. When a variable is declared Public inside a Private class, it is
accessible only from inside that class.
Available only to code inside our class
3) Protected - These classes extend the accessibility of their
members to their child classes (means, to the classes that derive from them). They extend their members to both themselves & their child classes.
Available only to classes that inherit from our class
4) Friend - Friend access means that elements are accessible only within the program. Friend is the default access modifer for any class that does not have a modifier.
Available only to code within our project/component
5) Protected Friend - Available only to classes that inherit from our class (in any project) or to code within our project/component. This is a combination of Protected and Friend.
Default - A Default property is a single property of a class that can be set as the default. This allows developers that use your class to work more easily with your default property because they do not need to make a direct reference to the property. Default properties cannot be initialized as Shared or Private and all must be accepted at least on argument or parameter. Default properties do not promote good code readability, so use this option sparingly.
Overloads - The Overloads property allows a function to be
described using deferent combinations of parameters. Each
combination is considered a signature, thereby uniquely defining an instance of the method being defined. You can define a function with multiple signatures without using the keyword Overloads, but if you use the Overloads keyword in one, you must use it in all of the function's Overloaded signatures.
Shared -The Shared keyword is used in an inherited or base class to define a property or method as being shared among all instances of a given class. If multiple instances of a class with shared properties or methods are loaded, the shared properties or methods will provide the same data across each instance of the class. When one class alters the value for a shared property, all instances of that class will reflect the change. Shared properties of all instances of the class
point to the same memory location.
Overridable -The Overridable keyword is used when defining a property or method of an inherited class, as overridable by the inheriting class. 
Overides - The Overides keyword allows the inheriting class to disregard the property or method of the inherited class and implements ts own code.                                         
NotOverridable - The NotOverridable keyword explicitly declares a property or method as not overridable by an inheriting class, and all properties are "not overridable" by default. The only real advantage to using this keyword is to make your code more readable. 
MustOverride - The MustOverride keyword forces the inheriting class to implement its own code for the property or method.
Shadows - The Shadows keyword will effectively hide all of the other methods in the baseclass. It is like forcefully getting rid of the overloading that has been done on the methods of the base class.
The Shadows keyword works like the Overloads keyword except that with shadows we do not have to follow rules such as implementing the same signature. The Shadows keyword does not require the consent (override ability) of the inherited class to replace the property or method's implementation code. A method does not have to be defined as overridable for the Shadows keyword to work. Read the example...
'This is the Base Class
Public Class Parent
    Public Sub MyProc(ByVal num As Integer)
        MsgBox("Number in Parent is " & num)
    End Sub
    Public Sub MyProc(ByVal st As String)
        MsgBox("String in Parent is " & st)
    End Sub
End Class
'This is the Child Class
Public Class Child
    Inherits Parent
    Overloads Sub MyProc(ByVal num As Integer)
 'overloads the method with the same parameter list
        MsgBox("Number in Child is " & num)
    End Sub
    Overloads Sub MyProc(ByVal ch As Char)      
 ' overloads the method
        MsgBox("Character in Child is " & ch)
    End Sub
End Class
When we execute the following code...
Dim c As New Child()
' prints out "String in Parent is Hello Wazzup!"
c.MyProc("Hello Wazzup!")   
' prints out "Number in Child is 12"
c.MyProc(12)                
' prints out "Character in DerivedClass is B"
c.MyProc(Chr(66))          
When we use Shadows keyword...
Public Class ChildNumber2
    Inherits Parent
    Shadows Sub MyProc(ByVal num As Integer)    
 ' hides all the different argument list
        MsgBox("Number in ChildNumber2 is " & num)
    End Sub
End Class
Dim c2 As New DerivedClass2()
c2.MyProc(7)   'only one method is exposed, rest of the
                      'methods are hidden
Constructor - When a class instance is created in our code,
a special method of that class, called the constructor, is called. Similarly, when the class is destroyed, the destructor
method is called. These are general terms and usually not the actual member names in most object-oriented languages. It is initialized using the keyword New, and is destroyed using the keyword Finalize. In .NET, we tend to forget using Finalize as
the instances(means the object) are automatically destroyed by the Garbage Collecter, when the object is not in use by he CLR(Common Language Runtime).
Dim objSampleObject as New SampleClass
' write the code here...
objsampleobject.Finalize
We can add parameters to the constructors. This was'nt allowed in VB6. We can overload the constructors, change the order of parameters, datatypes of parameters which ultimately change the way the constructor works whenever an instance of that class is invoked.
Also note that a constructor can have any access modifier. If
no argument is added in a constructor, VB.NET adds a no-argument constructor during compile time. It adds the Public Sub New( ) with the class declared, if no argument is passed in the constructor. The following code is added...
Public Class ClassA                            
  Public Sub New( )
End Sub
However, when the constructor is added with parameters, the following code is generated...
Public Class ClassA                            
  Public Sub New(ByVal SomeString as String )
End Sub
When a child class' object is declared, the child class
constructor & its parent class constructor, both are invoked.
Read example below for more clarity...
Public Class Books
  Public Sub New()
    System.Console.WriteLine("Book's constructor.")
  End Sub
  Public Sub myProc()
    System.Console.WriteLine("This is a book.")
  End Sub
End Class
Public Class Authors : Inherits Books
  Public Sub New()
    System.Console.WriteLine("Author's constructor.")
  End Sub
End Class
When the Authors class' constructor is invoked, like in the
following code, the Books class' no-argument constructor is also called.
Dim author As Authors
author = New Authors()
The result on the console will be...
Book's constructor.
Author's constructor.
If the base class does'nt have a no-argument constructor, then it would result in a compiler error. Hence, we need to use the MyBase keyword with the constructor. Our child class will look like this...
Public Class Authors : Inherits Books
  Public Sub New(ByVal SomeString As String)
    MyBase.New(SomeString)
    System.Console.WriteLine("Authors's constructor.")
  End Sub
End Class
If a class is not inheriting from any base class, then it will
call the base class constructor of System.Object if we are using MyBase.New( ). Summarizing constructors, whenever we initiate a constructor, the following things happen...
Base class constructor is invoked.
Class level variables are initialized.
Code in the class constructor gets executed.
If the argument name passed in the constructor, is same as the variable name used in the constructor, we use the Me keyword to refer to the constructor variable. For example if the variable name is SomeString, and the parameter passed is also SomeString, then the variable is referred as Me.SomeString.
Abstract Class -  They are classes that cannot be instantiated. We cannot create an object from such a class for use in our program. We can use an abstract class as a base class, creating new classes that will inherit from it. Creating an abstract class with a certain minimum required level of functionality gives us a defined starting point from which we can derive non-abstract classes.
An abstract class may contain abstract methods & non-abstract methods. When a class is derived from an abstract class, the derived class must implement all the abstract methods declared in the base class. We may use accessibility modifiers in an abstract class (unlike in Interfaces).
An abstract class can inherit from a non-abstract class. In C++, this concept is known as pure virtual method.
Interface - its a kind of class, that has only methods, do not have code, just the definition of the methods. Also, the interface can't be instantiated. Its an abstract class with public abstract methods, all of which must be implemented in the inherited classes. All methods in an interface are public, no other access modifier is used. It is public by default.
Classes can contain code, but interface dont. However, classes that implement an interface do contain code. Keep in mind that there are no instances of interfaces in VB .NET. Every instance is a type that implements an interface, but is itself not an instance of the interface. Also note, in an interface, all methods must be abstract (which is not necessary in an abstract class).
'VB .NET Interface
Public Interface ISalary
    Sub CreditSalary(ByVal Amount As Decimal)
    ReadOnly Property Incentive() As Decimal 
    ReadOnly Property Attendance() As Integer
End Interface
To use members of an interface, we make use of the implements keyword.
Public Class Employee                    
      Implements ISalary
  Public Function Salary() As Decimal Implements ISalary.CreditSalary()
     'code here ...
  End Function 
End Class

Serializable - This is a class attribute. When we use this attribute with a class, an instance of this class can be taken in whatever state it is, and write it to a disk. The class can then be deserialized, and the class will act as if it is simply stored in the memory.
Boxing & Unboxing - Value Types are stored on the stack and Reference types are stored on the heap. The conversion of value type to reference type is known as Boxing. Converting reference type back to value type
is known as Unboxing.
Value Types - Value types are primitive types that are mapped directly to the FCL. Like Int32 maps to System.Int32, double maps to System.double.
All value types are stored on stack and all the value types are derived from System.ValueType. All structures and enumerated types that are derived from System.ValueType are created on stack, hence known as ValueType. 
Reference Types - Reference Types are different from value types in such a way that memory is allocated to them from the heap. All the classes are of reference type. C# new operator returns the memory address of the
object.   
Partial Class - This concept has been introduced in .NET framework 2.0. They  give you the ability to split a single class into more than one source code (.cs or .vb)  file. Here's what a partial class looks like when it's split over two files...
// Stored in file MyClass1.cs
public partial class MyClass
{
  public MethodA()
  {...}
}

// Stored in file MyClass2.cs
public partial class MyClass
{
  public MethodB()
  {...}
}
When you build the application, Visual Studio .NET tracks down each piece of MyClass and assembles it into a complete, compiled class with two methods, MethodA() and MethodB().
Partial classes don't offer much in the way of solving programming problems, but they can be useful if you have extremely large, unwieldy classes. (Of course, this might be a sign that you haven't properly factored your problem, in which case you should really break your class down into separate classes.) The real purpose of partial classes in .NET is to hide automatically generated designer code.
What are the magic tables available in SQL Server 2000?
Magic tables are used to put all the deleted and updated rows. We can retrieve the
column values from the deleted rows using the keyword "deleted"

To project the deleted data into the deleted table we will use "output" clause
Below is the sample code to retrieve the deleted data.

DECLARE @DeletedTable TABLE(DeletedTableID INT, DeletedData VARCHAR(20))


Code Snippet:

DELETE VENKATOutput
OUTPUT Deleted.KeyID, Deleted.Name INTO @DeletedTable WHERE KeyID > 3
SELECT * FROM @DeletedTable

Similarly, we can retrieve the updated data and old data too using the keyword "Inserted"

The INSERTED and DELETED tables, popularly known as MAGIC TABLES, and update () and columns_updated() functions can be used to determine the changes being caused by the DML statements.
Note that the Magic Table does not contain the information about the columns of the data-type text, ntext, or image. Attempting to access these columns will cause an error.
Q Explain about page life cycle in Asp.net
1. OnInit (Init)  -- Inializes all Child controls on the Page
2. LoadControlState  -- Loads the Control State 
3. LoadViewState -- Loads the View State
4. LoadPostData -- Control properties are set according to the received form data
5. Load -- Actions can be performed on the controls as all the pre-activities are complete by this time
6. RaisePostDataChangedEvent -- This event is raised if data has been changed in previous and Current Postbacks.
7. RaisePostBackEvent -- This event handles the user action that caused the Postback.
8. PreRender (OnPreRender) -- This event takes place between postback and saving viewstate. Till this stage changes will be saved to the control.
9. SaveControlState -- Self Explanatory
10. SaveViewState -- Self Explanatory
11. Render -- Generates artifacts at Client side (HTML,DHTML,Scripts) to properly display controls
12. Dispose -- Releases unmanaged Resource ( Database connections, file handles)
13. Unload -- Releases managed Resources ( Instances created by CLR)
Stage
Events/Method
Page Initialization
Page_Init
View State Loading
LoadViewState
Postback data processing
LoadPostData
Page Loading
Page_Load
PostBack Change Notification
RaisePostDataChangedEvent
PostBack Event Handling
RaisePostBackEvent
Page Pre Rendering Phase
Page_PreRender
View State Saving
SaveViewState
Page Rendering
Page_Render
Page Unloading
Page_UnLoad
What is Polymorphism? How does VB.NET/C# achieve polymorphism?
Polymorphism: It's derived from a Greek word, where poly means many morph means Faces/Behaviors.
Same function/operator will show different behaviours when passed different types of values or different number of values.
Types of polymorphism:There are 2 types:-
1. Static polymorphism/Early Binding/Compile time polymorphism.
2. Dynamic polymorphism/Late Binding/Run time polymorphism.

Static polymorphism is achieved using i) Function overloading ii) Operator overloading

Dynamic polymorphism is achieved using i) Function overloading


polymorphism is popularly called as one interface,multiple functions.
The OOP allows object to respond differently for the same message.
It is an entity tat exists in different form simultaneously.

Static polymorphism
->function overloading
->operator overloading
->constructor overloading
    1>instance constructor
    2>static constructor

dynamic polymorphism
  1)abstract class
  2)virtual function
  3)delegates
Example of polymorphisam is
public class Addres_Details
{
//here comes default construtor
//Now I am defines one method
  public virtual void  add_name
  {

   }
//Now i am defining new class and inherits the Address_details class
public class New_address_Details:Address_Details
{
public override void add_name()
{
console.writeln("This  is the Example of the Polymorphisam");
}
}
}
What is DOM?
DOM (Document Object Model) is a platform and language neutral interface that allows program & scripts to dynamically access & update the content, structure & style of the documents.
there is certain informtaion provided by the payment gateway providers like paypal etc . You have to provide the information exactly in the format they want it .