Wednesday, 30 September 2015

All Interview Questions

I.      OOPs
1.      What is structured and object-oriented programming?
A)    Structured Programming is less secure as there is no way of data hiding.

2.      What is Abstract Class and when we use that?
A)     Abstract classes are classes that contain one or more abstract methods. An abstract method is a method that is declared, but contains no implementation. Abstract classes may not be instantiated, and require subclasses to provide implementations for the abstract methods. Let's look at an example of an abstract class, and an abstract method.
B)     Suppose we were modeling the behavior of animals, by creating a class hierarchy that started with a base class called Animal. Animals are capable of doing different things like flying, digging and walking, but there are some common operations as well like eating and sleeping. Some common operations are performed by all animals, but in a different way as well. When an operation is performed in a different way, it is a good candidate for an abstract method (forcing subclasses to provide a custom implementation). Let's look at a very primitive Animal base class, which defines an abstract method for making a sound (such as a dog barking, a cow mooing, or a pig oinking).

3.      What is virtual class and when we use that?
A)       Virtual method is a method that can be redefined in derived classes. A virtual method has an implementation in a base class as well as derived the class. It is used when a method's basic functionality is the same but sometimes more functionality is needed in the derived class. A virtual method is created in the base class that can be overridden in the derived class. We create a virtual method in the base class using the virtual keyword and that method is overridden in the derived class using the override keyword.
When a method is declared as a virtual method in a base class then that method can be defined in a base class and it is optional for the derived class to override that method. The overriding method also provides more than one form for a method. Hence it is also an example for polymorphism.
When a method is declared as a virtual method in a base class and that method has the same definition in a derived class then there is no need to override it in the derived class. But when a virtual method has a different definition in the base class and the derived class then there is a need to override it in the derived class.
Ø  By default, methods are non-virtual. We can't override a non-virtual method.
Ø  We can't use the virtual modifier with the static, abstract, private or override modifiers. 
4.      What is the difference between Abstract and Virtual classes in OOP's?
         II.        An abstract function can have no functionality. You're basically saying, any child class MUST give their own version of this method, however it's too general to even try to implement in the parent class.
        III.        A virtual function, is basically saying look, here's the functionality that may or may not be good enough for the child class. So if it is good enough, use this method, if not, then override me, and provide your own functionality.





5      What is abstraction and interface? Differences between them.
Ø   An Abstract class doesn't provide full abstraction but an interface does provide full abstraction; i.e. both a declaration and a definition is given in an abstract class but not so in an interface.
Ø  Using Abstract we can not achieve multiple inheritance but using an Interface we can achieve multiple inheritance.
Ø  We can not declare a member field in an Interface.

6       What is interface class and when we use that, why C# won't support multiple inheritances?
7      What is inheritance and can you inherit from 2 classes
8      Can you call a parent class method from child class object?
9      Difference between Abstract class and interface class?
Answer:
Interface must have only methods without implementation whereas abstract classes can have methods with and without implementation that is you can define a behavior in an abstract class. An interface cannot contain access modifiers whereas an abstract class can contain access modifiers. A class can implement multiple interfaces whereas a class can inherit only one abstract class. An interface cannot have variables whereas an abstract class can have variables and constants defined. When we add a new method to an interface, We have to track all the classes which implement this interface and add the functionality to this method whereas in case of abstract class we can add default behavior for the newly added method and thus the class which inherit this class works properly.

Other Answer:
There are several difference Between Interface and Abstract Class some of example as below.
[1]interface are implicitly abstract and cannot have implementations. A Java abstract class can have instance methods that implements a default behavior.
Variables declared in a Java interface is by default final.
[2] An interface is similar to an abstract class; indeed interfaces occupy the same namespace as classes and abstract classes

interface MotorVehicle
{
    void run();
    int getFuel();
}
class Moter implements MotorVehicle
{
    int fuel;
    void run()
    {
        print("Massage");
    }
    int getFuel()
    {
        return this.fuel;
    }
}

An abstract class is a class that cannot be instantiated but that can contain code. while An interface only contains method definitions but does not contain any code

10   Difference between Abstract classes and Interface. Explain with scenario where to implement one?
Answer:
Collection of the Abstract (Incomplete) and Concrete (complete) methods is called as the Abstract class. If there is at least one abstract method in a class, the class must be abstract class.
When there is the similar behavior, we can use the abstract class.
e.g. We want to calculate the area of few component. As this is not generic to the application. We have only few component- like Circle, Ellipse, parabola, Hyperbola, Triangle etc.
So we can create an abstract class and implement it like below:
public abstract class MyAbstractClass
{
// some other concrete members
public abstract void Area();// abstract member
}
Now in the child class, let’s say i have a circle class and want to calculate the area of the circle:
pyblic class Cicle: MyAbstractClass
{
public override void Area()
{
// calculate the area of the circle
}

}
In the similar fashion, we can calcite the area of other shapes.
Collection of abstract members is called as the Interface. When the behavior is not similar, we need to use the interface. All the members of the interface 
must be overrides in the child class.
e.g. Print functionality of the application can have an interface like:
interface Inf
{
void Print();
}
Now as this is the generic functionality and can be implemented in any of the page so we have taken it as interface. Now we can implement this functionality in to any page like:
class MyClass:Inf
{
public void print
{
// write details about the print
}
// Here we can implement any kind of print-like print to excel, xml, word all depends on the our decision.
}

11   What is static class?
A)     static class cannot be instantiated. In other words, you cannot use the new keyword to create a variable of the class type. Because there is no instance variable, you access the members of a static class by using the class name itself.
12   What is oops?
13   What is sealed keyword?
A)     Sealed classes are used to restrict the inheritance feature of object oriented programming. Once a class is defined as a sealed class, the class cannot be inherited. 


14   what is a generic class
A)   Generic classes have type parameters. Separate classes, each with a different field type in them, can be replaced with a single generic class. The generic class introduces a type parameter. This becomes part of the class definition itself.
15   why is generics used?
16   Difference between struct and class?
17   What is a Constructor and its uses?
A)     Constructor is a special method of a class which will invoke automatically whenever instance or object of class is created. Constructors are responsible for object initialization and memory allocation of its class. If we create any class without constructor, the compiler will automatically create one default constructor for that class. There is always at least one constructor in every class.
18   Can a constructors that is declared within a base class, inherited by subclasses? Yes or No
Answer:
No, constructors that are declared within a base class cannot be inherited by sub-classes. If you have not declared any constructor in your class then a default constructor is provided

19   What is a chain constructor?
A)    Constructor Chaining is an approach where a constructor calls another constructor in the same or base class.This is very handy when we have a class that defines multiple constructors.

20   Destructor?
21   Overloading & Overriding
a.      Below C# function is of which type?
public static Calculate operator +(Calculate c1,Calculate c2)
{
}
Answer:
Above function is a type of Operator Overloading. For working with Operator Overloading, We have to use Operator keyword along-with Unary Operators i.e. +,- and / in the function definition

b.      Function Overriding is also called as?
Answer:
Function Overriding is also called as:- Run-Time Polymorphism Method Overriding Late Binding.

c.       Function Overloading is also called as?
Answer:
Function Overloading is also called as:- Copile-Time Polymorphism Early Binding Method Overloading

d.      write a piece of code for overriding






22   Can we have override method methods as static that original was non static?
A)     No.  The signature of the virtual method must remain the same.  (Note: Only the keyword virtual is changed to keyword override) 

23   can we override private virtual methods?
A)     No, because virtual methods cannot be private in the first place.
You can't declare private virtual methods because private access specifier does not allow to inherit the private member of a class in a derived class.
for example,
using System;
public class ABC 
{ 
private virtual void mm() { } 
}
public class abc:ABC
{ 
private override void mm() 
{ 
Console.WriteLine("Hello"); 
} 
} 
class d:abc 
{
public static void Main() 
{
d D=new d();
D.mm(); 
} 
}
Error:
------ 'ABC.mm()' : virtual or abstract members cannot be private 'abc.mm()' : virtual or abstract members cannot be private

But you can override protected virtual methods.

24   Is it possible to override a function in the child class without any virtual function in the base

25   What are the oops concept you are using in your projects and tell me in code level how you implemented?
26   What is encapsulation?
Answer:
Encapsulation is the mechanism to hide irrelevant data to the user.

27   what is polymorphism?
Answer:
Using the same method in multiple forms is called as Polymorphism. In the Polymorphism, the method name is same but their prototype can be different

28   Different forms of Polymorphism. Differences between Abstraction and Polymorphism.
Answer:
Polymorphism is to use the same function in many forms. The polymorphism is of 2 types-
a. Classical polymorphism (Overloading)
b. AdHoc polymorphism (Overriding)
When the runtime (CLR) find the behavior of class members at the runtime of the program, it is called as the AdHoc polymorphism or Overriding.in this the method name is same but they are implemented in the different class. We use virtual keyword in the base class method to be overrides in the child class using the override keyword.
e.g.
public class MyClass
{
Public int Add(int a, int b)
{
Return a+b;
}
Public int Add(int a, int b, int c)
{
Return a+b+c;
}
}
When the runtime (CLR) find the behavior of class members at the compilation of the program, it is called as the Classical polymorphism or Overloading.in this the method name is same but there prototypes (parameters) are different and it is implemented in the same class.
e.g.
Public class MyBaseClass
{
Public virtual void Show(string message)
{
Console.WriteLine(“Your message is : ”+ message);
}
}
Public class MyChildClass: MyBaseClass
{
public override void Show(string message)
{
Console.WriteLine(“Your new message is : ”+ message);
}
} 
Abstraction is the behavior to get the required functionality in the child class. So we don’t matter whatever is written in the base class. We only need to force the child class to implement my required functionality.
Abstract keyword is used to get the abstraction behavior

29   what is abstract class?
Answer:
Abstraction is the mechanism to show only relevant data to the user.

30   what is virtual function and where it will be use code level?
Answer:
To override base class information into derived then we go for virtual classes.

31   Is this the proper way? If yes why, if no why?
try { }
catch(Exception ex) { }
catch(ArgumentNullException) { }
catch(ArgumentNullException) {}
catch {}
finally {}

32   If I have a class C and two interfaces I1 and I2 and I have add method inside both I1 and I2 then how to specify which one has to be called?
33   Difference between Structures and Classes
Answer:
Classes are Reference types and Structures are Values types.
Classes will support an Inheritance whereas Structures won’t.
We cannot have instance Field initializers in structs but classes can have instance Field initializers.
classes can have constructors but structs do not have default constructors

34   Does Structure implement Inheritance/Interface?
Answer:
There is no inheritance concept for structs but a struct can implement interfaces.
35   Can Structures have constructors. How the members of the structures are initialized
Answer:
No Structures do not have default constructors. whereas paramterized constructors are allowed
36   Difference between Value Types and Referenec Types.
Answer:
A variable that is declared pf value type(int,double...), stores the data, while a variable of a reference type stores a reference to the data.
Value type is stored on stack whereas a reference type is stored on heap.
Value type has it own copy of data whereas reference type stores a reference to the data.
37   If you are required to call a non-static method in static method then how will you do this?
A)   You would just need to create an instance of the type then call the non-static, from a staticmethod.

public class Example(){

    public static void StaticExample(){

        Example example = new Example();
        example.NonStatic();
    }

    public void NonStatic(){

    }

}

38   If you want to restrict user to make only one object in the entire application usage how will you achieve this?
39   What's difference between Association , Aggregation and Inheritance relationships?
40   What is shadowing ?
41   What's difference between Shadowing and Overriding ?
42   Can you prevent a class from overriding ?
43   What does virtual keyword mean ?
44   In what instances you will declare a constructor to be private?
45   Can we have different access modifiers on get/set methods of a property ?
A)   Yes, this is possible. It is called Asymmetric Accessor Accessibility, and you can read the MSDN documentation for it on this page. The code would look something like this:
public int Age
{
    get
    {
        return _age;
    }
    protected set
    {
        _age = value;
    }
}
However, there are a couple of important caveats to keep in mind:
Ø  Only one accessor can be modified.
Ø  Any restrictions placed on an individual accessor must be more restrictive than the accessibility level of the property itself, not less.
Ø  You cannot use accessor modifiers on an interface or an explicit implementation of an interface member.

5      If we write a goto or a return statement in try and catch block will the finally block execute ?

C# interview questions and answers

By admin | 
1.        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.
2.       How do you inherit from a class in C#? Place a colon and then the name of the base class.
3.       Does C# support multiple inheritance? No, use interfaces instead.
4.       When you inherit a protected class-level variable, who is it available to? Classes in the same namespace.
5.        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. But they are.
6.       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).
7.        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.
8.       What’s the top .NET class that everything is derived from? System.Object.
9.       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.
10.     What does the keyword virtual mean in the method definition? The method can be over-ridden.
11.      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.
12.     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.
13.     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.
14.     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.
15.     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.
16.     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.
17.     What’s an interface class? It’s an abstract class with public abstract methods all of which must be implemented in the inherited classes.
18.     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.
19.     Can you inherit multiple interfaces? Yes, why not.
20.    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.
21.     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.
22.    How can you overload a method? Different parameter data types, different number of parameters, different order of parameters.
23.    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.
24.    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.
25.    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.


Ø.Net Framework
1.      Architecture of .NET Framework?
2.      Architecture of CLR?
3.      What is CLR?
Answer:
CommonLanguageRuntime ( CLR) to convert the managed code into native code and then execute the program.

4.      What is DLR?
Answer:
DLR is new with .Net 4.0 which is the Dynamic Language Runtime and used to run the application on the fly wherever required. CLR runs as statically while DLR runs dynamically.

5.      What is CTS?
A)     CTS stands for Common Type System. It defines the rules which Common Language Runtime follows when declaring, using, and managing types. 
6.      What is CLS?
A)     CLS stands for Common Language Specification and it is a subset of CTS. It defines a set of rules and restrictions that every language must follow which runs under .NET framework. The languages which follows these set of rules are said to be CLS Compliant. In simple words, CLS enables cross-language integration.
7.      MSIL?
A)     An intermediate language generated by compiler is called MSIL. All .Net assemblies are represented in MSIL. The main Advantage of using MSIL is it provides equal performance for multiple language programming, as code is compiled to native code

8.      What is JIT Compiler?
B)     JIT-JIT compiles the IL code to Machine code just before execution and then saves this transaction in memory.
9.      ASP.net Page life cycle?
Answer:
Page_PreInit,Page_Init,LoadViewState(If it is a Postback),LoadPostBackData(If it is a Postback),Page_Load,Control event handler execution,Page_PreRender,SaveViewState,Page_Render,Page_Unload

10.  Difference between web.config and global.asax?
A)     The web.config file specifies configuration data for the .NET application. The global.asax file handles application- and session-level events
11.  What is stack and heap?
Ø  the stack grows and shrinks as functions push and pop local variables
Ø  there is no need to manage the memory yourself, variables are allocated and freed automatically
Ø  the stack has size limits
Ø  stack variables only exist while the function that created them, is running
A)   The stack is much faster than the heap. This is because of the way that memory is allocated on the stack. Allocating memory on the stack is as simple as moving the stack pointer up.
12.  Why C# codes are converted to IL and why C++ codes are converted to machine code not IL?
13.  Can you explain about dotnet framework flow?
14.  what is GAC?
Answer:
Global Assembly Cache, When we need to share the assembly to all then we copied that assembly into GAC Floder but that must be having name, version and public key token. Which are the assemblies follows all those 3 then we install that assembly into GAC folder before that we must create key.snk file for that.
Once the Assembly is in shared location then any one can access that assembly in to there application.

15.  What is assembly, GAC? Where they are physically located?
Answer:
Assembly is the collection of classes, namespaces, methods, properties which may be developed in different language but packed as a dll. So we can say that dll is the assembly.
There are 3 types of assemblies- Private Assembly, Shared Assembly, and Satellite Assembly.
GAC (Global Assembly Cache)- When the assembly is required for more than one project or application, we need to make the assembly with strong name and keep it in GAC or in Assembly folder by installing the assembly with the GACUtil command.
To make the assembly with strong name:
SN -k MyDll.dll
And to install it in GAC:
GacUtil -i MyDll.dll
GAC assemblies are physically stored in Assembly folder in the system.
Other Answer:
An assembly is a collection of classes and objects and methods we can developed that in any language but packed as a dll, we are called that as a assembly.
GAC, global assembly cache- when the assembly requires more than one project or application then we need to make that as a strong name and keep that in GAC folder.
When we called the assembly is strong named, to follow below steps then we are calling that as a strong named assembly.
• Public key token
• Name
• Versioning

16.  what is Garbage collection?
17.  Garbage collection and how its find out the object is not in use?
A)   The .NET Framework's garbage collector manages the allocation and release of memory for your application.
Each time you use the newoperator to create an object, the runtime allocates memory for the object from the managed heap. As long as address space is available in the managed heap, the runtime continues to allocate space for new objects. However, memory is not infinite. Eventually the garbage collector must perform a collection in order to free some memory. The garbage collector's optimizing engine determines the best time to perform a collection, based upon the allocations being made. When the garbage collector performs a collection, it checks for objects in the managed heap that are no longer being used by the application and performs the necessary operations to reclaim their memory.
18.  Garbage collection uses which type of algorithm? How it will find which object is unused?
19.  what is Idisposable ?
20.  what is Finalize and different between disposable and Finalize ?
Ø  Finalize
Ø  Used to free unmanaged resources like files, database connections, COM etc. held by an object before that object is destroyed.
Ø  Internally, it is called by Garbage Collector and cannot be called by user code.
Ø  Dispose
Ø  It is used to free unmanaged resources like files, database connections, COM etc. at any time.
Ø  Explicitly, it is called by user code and the class implementing dispose method must implement IDisposable interface.


21.  what is Assembly and types?
Answer:
An assembly is a collection of types and resources that forms a logical unit of functionality.

When you compile an application, the MSIL code created is stored in an assembly . 
Assemblies include both executable application files that you can run directly from Windows without the need for any other programs (these have a .exe file extension), and libraries (which have a .dll extension) for use by other applications.
There are 3 types of assemblies
• Private Assembly
When the Assembly doesn’t copied in GAC folder then we must added that in our physical location that means our project bin folder this type of assembly we are called as Private Assembly, it is very secure compare to shared Assembly.

• Shared Assembly
When the Assembly is registered in GAC folder that means which assembly having name, version and public key token then we store them in GAC folder, that Assemblies we are called as Shared Assembly.

• Satellite Assembly
When we go for multilingual application implementation then we go for Satellite assembly.

22.  Can we have 2 assemblies with the same name in GAC?
Answer:
Yes we can have 2 assemblies with the same name in GAC as long as they have different strong names. The strong names of the assemblies can differ in name/version/culture/processor architecture/public key token.

23.  What is the prerequisite to deploy an assembly in GAC?
Answer:
The assembly must be strong named. A 'strongly named' assembly is an assembly that is signed with a key to ensure its uniqueness

24.  What is Strong Name?
Answer:
A strong name is a combination of its name, version number, and culture information (if provided) and a public key and a digital signature. This ensures that the Dll is unique.
•Strong names provides an integrity check that ensures that the contents of the assembly have not been changed since it was built.

Other Answer 1:
Strong Name (SN) is used to make the dll as the unique as:
SN -k fileName.dll
Now it will have the unique name. This assembly when placed in the GAC, it will treat as the unique with its version number and other details. 2 assemblies with the same name can exist in the GAC but both will have different version. The CLR takes the latest version assembly while running the application.
Other Answer 2:
A) If the assembly maintain the following features then we are called that as a strong named assembly.
• Public key token
• Name
• Versioning

25.  In case more than one version of an installable is installed, which version is invoked by default?
Answer:
By default the CLR will take and invoke the latest version of the dll and execute it accordingly. There could be the same name assemblies exists in the GAC but they will have different versions altogether for their uniqueness.
So while running the application, CLR takes the latest version assembly and use in the application.

26.  What are indexers?
Answer:
Indexers are used for treating an object as an array. 
For more info refer:
http://www.dotnetspider.com/forum/160680-indexes-.NET.aspx 

27.  what is mange code and unmanaged code give example?
Answer:
Managed code is the code whose execution is managed by the .NET Framework Common Language Runtime(CLR). The CLR ensures managed execution environment that ensures type safety, exception handling,garbage collection and array bound & index checking.

UnmanagedCode:
Applications that do not run under the control of the CLR are said to be unmanaged. this is the code that is directly executed by the operating system.
unmanaged code provides of outside the security perimeter for managed code, due caution is required. For example native code APIs . UnmanagedCode executed by the OS directly

28.  what are the version available in VS?
29.  how to force the Garbage collection?
A) System.GC.Collect() forces garbage collector to run. This is not recommended but can be used if situations arise.

30.  How Unmanaged code is taken care by .Net Framework?
Answer:
In unmanaged code the memory allocation, type safety, security and other things have to be taken care by the developer. This can lead to memory leaks and buffer overrun.

31.  What is Dispose and Finalize?
Answer:
The Dispose method is generally called by the code that created your class so that we can clean up and release any resources we have acquired ( database connections/file handles) once the code is done with the object. The finalize method is called when the object is garbage collected and its not guaranteed when this will happen.

32.  In an ASP.NET page if you have a DropdownList and whenever you select some option in the dropdown list? It makes a post back to server. How can you increase the performance of this page?
Answer:
put the dropdownlist inside an AJAX UpdatePanel so it updates only that part of the page instead of a full page reload or we can also use AJAX webservice.

33.  Have you used Caching in asp.net?
Answer:
Yes
Caching is a technique of storing data in memory which takes time to create. Caching is one of the best features of the ASP.NET. For example, you could cache the data from complex query which takes time to fetch data. The subsequent requests would not need to fetch data from the database. You can get data directly from the cache. By using the cache, you can improve the performance of your application.

There are two main types of caching:

1. Output caching
2. Data caching
34.  in your project page cache is use? and fragment cache is use? what cache you are using in your application any why ?
35.  Data cache?
36.  write piece of code for Data cache?
37.  what is difference between session and caching?
Answer:
Cache will always be in memory even if you use a separate Session State Server or SQL Server, and thus retain its performance advantages
38.  What is Type Safety?
Answer:
TypeSafe is a way through which the application or framework that the memory will not be leaked to outside environment. E.g. C# is the type safe language where you must have to assign any object before using it. In VB.Net it will take the default value. So C# is the type safe language while VB.Net is not.

39.  Versioning is applicable for private assemblies.
40.  What is trace?
B)     Tracing is an activity of recording the diagnostic information related to a specific web page that is being executed on the web server. In this discussion we will consider ASP.NET related tracing technique.
Ø  In web.config, add the following entries to enable Application level tracing below System.web element.
Ø  Hide   Copy Code
 <trace pageOutput="true"
enabled="true"
requestLimit="10"
localOnly="false"
mostRecent="true"
traceMode="SortByTime"
/>

41.  What is Dispose method in .NET ?
42.  What's the use of "MustInherit" keyword in VB.NET ?
43.  Whats the use of "OverRides" and "Overridable" keywords ?
44.  Difference between virual and abstract methods?
45.  Can we have virtual constructors?
46.  how to prevent instance of a class to be created?
47.  read-only and const keyword differences
48.   

ØAsp.Net
1.       State Management
a.      what is state management?
Answer:
Web is stateless because of HTTP, to maintain the state for controls ASP.net introduces a concept called as State Management.

b.      What are difference Session Management Techniques in ASP.NET
Answer:
Sessions,Cookies,QueryString,ViewState,Application objects,Hidden Fields.

c.       What is session?
Answer:
When new user makes a request then session object will create. Session will store any type of data.

d.      what are session different mode?
Answer:
Inproc è It will store it in the worker process in the application domain.
sqlserver, and stateserver

e.      Where the session data will be stored?
A)     ASP.NET will store session information in memory inside of the worker process (InProc), typically w3wp.exe. There are other modes for storing session, such as Out of Proc and a SQL Server
f.        What are the advantages using session?
Ø  It helps maintain user state and data all over the application.
Ø  It is easy to implement and we can store any kind of object.
Ø  Stores client data separately.
Ø  Session is secure and transparent from the user.

g.      Drawbacks using session?
Ø  A) Performance overhead in case of large volumes of data/user, because session data is stored in server memory.
Ø  Overhead involved in serializing and de-serializing session data, because in the case of StateServer andSQLServer session modes, we need to serialize the objects before storing them.

h.      By default where the session objects will get stored?
i.        What are in-proc and out-proc? Where are data stored in these cases?
Answer:
In-Proc and Out-Proc is the types of Sessions where the session data can be stored in the process memory of the server and in the separate state server.
When the session data is stored in the process memory of the server, the session is called as the In-Proc server. In this case when the server is restarted, the session data will be lost.
When the session data is stored in the separate server like in state server or in Sql Server, the type of session is called as the Out-Proc session. In this case, if the server where the application is running is restarted, the session will be still remain in the separate servers.
So in the in-Proc session state, the session data is stored in the Process memory of the Server where the application is running.
In the Out-proc session state, the session data is stored in the separate server- may be state server or in sql server.

j.        which one session manage type is better?
k.       Where does session object will stored if cookie is disabled in client machine?
l.        What are session events?
There are two types of session events available in ASP.NET:
Ø  Session_Start
Ø  Session_End
You can handle both these events in the global.asax file of your web application. When a new session initiates, the session_start event is raised, and the Session_End event raised when a session is abandoned or expires.
void Session_Start(object sender, EventArgs e)
{
    // Code that runs when a new session is started
}

void Session_End(object sender, EventArgs e)
{
    // Code that runs when a session ends.
}

m.    How you can disable session state?
Ø  Start Microsoft Visual Studio .NET, and create a new ASP.NET Web Application.
Ø  In Solution Explorer, double-click Web.config to view the contents of this file.
Ø  Locate the <sessionState> section, and set the mode value to Off.

n.      how to install the session manage?
o.      What is view state and where the values are save and what happen if more value save?
Answer:
View State is the technique used by ASP.NET web pages to keep the state of the page across post backs. It stores data in a hidden field named __VIEWSTATE inside the page in Base-64 encoded formats. The encoding and decoding of the view state data is done by the LosFormatter class. 

There is a provision of turning off ViewState at control level and also at page level using the property EnableViewState.

View State data will store in client side.

p.      Where the view state data will be stored?
Ans: View State data is stored in a hidden field called "__VIEWSTATE" on a Web page.
q.      Advantages using view state?
r.       Disadvantages using View state?
s.       How to enable / Disable ViewState?
Ans::
To disable ViewState
To disable ViewState for a single control on a page, set the EnableViewState property of the control to false, as in the following:
<asp:DropDownList ID="DropDownList1" runat="server" EnableViewState="false" />
Ø  To disable ViewState for a page
To disable ViewState for a single page, set the EnableViewState attribute in the @ Page directive to false, as in the following:
<%@ Page Language="C#" EnableViewState="false" AutoEventWireup="true" CodeFile="URLRouting.aspx.cs" Inherits="URL_Rewriting" %>
Ø  To disable a page's View State, add the code below in the Page class of the page. 

public void DisableViewState()
{
    this.Init += new EventHandler(Page_Init);
}

private void Page_Init(object sender, System.EventArgs e)
{
    this.EnableViewState = false;
}
Ø  To disable ViewState for a specific application 

To disable ViewState for a specific application, use the following element in the Web.config file of the application:

<configuration>
  <system.web>
    <pages enableViewState="false" />
  </system.web>
</configuration>

t.        What is the max size of Viewstate?
B)     The maximum size of the viewstate is 25% of the page size.
u.      When the View state is saved, and when is it loaded? How to enable/ disable View states?
Answer:
View State data is stored in the current page in base64 encoded format. It gets loaded with the page and displays the values to the controls after the decoded. Internally it actually saves the checksum of all the control data where the view state is enabled.so that when the page gets loaded due to any post back, it again finds the checksum and then decodes the Base64 encoded string and gets back the same data to the controls. We can see the view state base 64 encoded string in View Source of the page. It will be like _VIEWETATE="DSDSDF8DGDGDFGFD5FDGGDJFF23BNN457M9UJOG" this.
View state won't take the client or server memory to keep the view state data.
Other Answer:
To store the data in viewstate using below sample
ViewState[“obj”]=ds;
In page load event of application viewstate data has been loaded.
If you want to enable / disable viewstate then use EnableViewStateMac property to true or false.

v.       between session and viewstate?
w.     What is Cookie?
x.       Where the Cookie data will be stored?
y.       Advantages using Cookie?
z.       Disadvantages using Cookie?
aa.  Cookie Limitations?
A)     The max size of a cookie is 4096 bytes. Also note that not more than 20 cookies per website can be stored on a system.
bb.  What is Caching?
cc.   Types of Caching?
dd.  Can we cache total page data?
ee.   
2.    Whether client side validation or server side validation? which one is best?
3.    How u valid the page?
4.    Answer:
5.    We can validate a page in 2 ways either client side or in server side.
6.     
7.    Difference between DataSet and DataReader?
Ø  Dataset is connection-less oriented, that means whenever we bind data from database it connects indirectly to the database and then disconnected. It has read/write access on data tables. It supports both forward and backward scanning of data.
Ø  DataSet is a container of one or more DataTable. More often than not, it will just contain one table, but if you do a query with multiple SELECT statements, the DataSet will contain a table for
Ø  DataReader is connection-oriented, that means whenever we bind data from database it must require a connection and after that disconnected from the connection. It has read-only access, we can’t do any transaction on them. It supports forward-only scanning of data, in other words you can’t go backward

8.    What is DataAdapter?
Ø  DataAdapter is an ADO.NET Data Provider. DataAdapter can perform any SQL operations like Insert, Update, Delete, Select in the Data Source by using SqlCommand to transmit changes back to the database.
Ø  DataAdapter provides the communication between the Dataset/DataTable and the Datasource. We can use theDataAdapter in combination with the DataSet/DataTable objects. These two objects combine to enable both data access and data manipulation capabilities.

9.    What is DataView?
A)   Generally, we use DataView to filter and sort DataTable rows. So we can say that DataView is like a virtual subset of a DataTable. This capability allows you to have two controls bound to the same DataTable, but showing different versions of the data.
10. What is Execute Reader?
A)   Execute Reader will be used to return the set of rows, on execution of SQL Query or Stored procedure using command object. This one is forward only retrieval of records and it is used to read the table values from first to last.
11. What is Execute Scalar?
A)   Execute Scalar will return single row single column value i.e. single value, on execution of SQL Query or Stored procedure using command object. It’s very fast to retrieve single values from database
12. What is Execute NonQuery?
A)   ExecuteNonQuery is basically used for operations where there is nothing returned from the SQL Query or Stored Procedure. Preferred use will be for INSERT, UPDATE and DELETE Operations.

13. Difference between Server.Transfer, Server.Execute and Response.Redirect in ASP.net?
A)   The Response.Redirect method redirects a request to a new URL and specifies the new URL while theServer.Transfer method for the current request, terminates execution of the current page and starts execution of a new page using the specified URL path of the page.
B)   When Server.Execute is used, a URL is passed to it as a parameter, and the control moves to this new page. Execution of code happens on the new page. Once code execution gets over, the control returns to the initial page, just after where it was called. However, in the case of Server.Transfer, it works very much the same, the difference being the execution stops at the new page itself (means the control is'nt returned to the calling page).

14.  How to restrict particular person to open any form in our application?
15.  Boxing and Unboxing: Terminology, Advantages and Disadvantages?
Answer:
Converting the value type data type in to the Reference type is called as Boxing. Converting the Reference type data type and keep its value to stack is called as the reference type.
byte b= 45;
Object o = b.Tostring();
The Advantage of boxing and unboxing is that we can convert the type of the object in to another type. The disadvantage is that it requires lot of memory and CPU cycles to convert from one type to another type.
Object o=10;
Int i= Convert.ToInt32(o.ToString());

16.  What is value type and what is Reference Type?
Answer:
Value type holds data directly, Value type stored in the stack memory, We can get the direct value of the value types. Value type data type can’t be null.
Reference types: This type doesn’t hold the data directly. They hold the address on which the actual data present. They stored in heap memory, Can have default values.
We can make and work with null reference type.

17.  Difference between value type and reference type in ASP.net?
18.  What is userControls in ASP.net?
19.  Difference between Custom controls and User Controls in ASP.net?
20.  What is Assembly?
21.  What are the different types of Assemblies in ASP.net?
22.  What is GAC?
23.  Where the Physical Assembly will get stored in a project? 
24.  What is Satellite Assembly?
25.  which assembly used for localized resources?
Answer:
In Satellite Assembly

26.  Where private assembly stored in asp.net?
Answer:
Private assemblies are stored in application directory or sub -directory beneath.

27.  Different types of Navigation controls in ASP.net?
Ø  Basically ASP.NET 2.0 has three navigation controls:
                i.    Dynamic menus
              ii.    Tree Views
             iii.    Site Map Path

28.  What is Exception Handling, How you define that in your project?
29.  What is the difference between Using statement and Try, Catch blocks?
30.  what is difference between hyperlink and link button?
Answer:
The hyperlink will not postback to the servver.it will post a simple request to the server for the url set as navigate url.but link button works exactly as button hyperlink doesn't have an onclick event.

if you need to do any operation with data that's on the page you will have to use a LinkButton (or a Button), but if you just need to redirect the user to somewhere else go for an HyperLink (You will avoid half roundtrip!).

31.  What is HTTPHandler?
Answer:
It is the process which runs in a response to a http request ,you can use it for generating sitemaps that you submit to search engines or for rendering images or tracking emails or rss feed etc...

32.  How many master pages does a page contain?
Answer:
we can place more than one master page but it must be nested.

33.  Is it possible to have nested master pages?

34.  What is difference between XAML and XML
Answer:
XAML stands for Extensible Application Markup Language XML stands for Extensible Markup Language XAML is based on XML, so it uses XML for its markup. If you look at a XAML document, it is also a valid XML document. But any XML document is not XAML.

35.  User control: How to do postback through web page?
36.  What are and delegate events?
Answer:
Both delegates and events are tied together 
Event:
1. It is the outcome of an action.
2. Event Source(Which raises the event) and receiver(object that responds to the event)are the two important terms 
3. Delegate acts as a communication channel between Event Source and Event Source.

Delegate:
1.It is function pointer.
2.Delegate can call more than one function.
3.There are two types of delegates

(i)           Single Cast
(ii)           Multi Cast
//declaring delegate      
public delegate void sample_delegate();       
public void GoodMorning()      
{          
MessageBox.Show("Hello Friend" + "GoodMorning");
}
public void GoodEvening()      
{          
  MessageBox.Show("Hello Friend" + "GoodEvening");      
}
private void button2_Click(object sender, EventArgs e)      
{          
  // instantiation          
  // Here we are calling two methods so it is multicast delegate
  // If you call only one it is single cast          
  sample_delegate sd = GoodMorning;          
  sd += GoodEvening;          
  //invoking            
  sd();      
}

37.  How to use delegate and event in user control?
38.  What are Delegates and Events.
Answer:
A Delegate is an object, which points to another method in the application. Delegate holds, name of the method, arguments of the method (if any) and the return type of the method.
See the below points regarding the Delegate:-
• delegate keyword is sealed type in System. Multicast namespace.
• Delegate works like a function pointer in C language.
• Delegate holds the address of the function.
• Delegate hides the actual information which is written inside the method definition.
• A delegate can hold address of a single function as well as the address of multiple functions.
• There are 2 types of delegate- Single-cast delegate (hold single function) and Multicast delegate(hold multiple functions).
• Addition and subtraction are allowed for the delegates but NOT multiplication and division. It means, we can add delegates, subtract delegates etc.
e.g. To create a single cast delegate, first we can create a class with a method as:
public class DelegateDemo
{
public void Show(string msg)
{
Console.WriteLine(msg);
}
}
Now we can call the method Show using the delegate as:
public delegate void MyDelegate(string message); //declare delegate
now we need to create the object of the delegate with the address of the method as:
DelegateDemo obj = new DelegateDemo();//class object
MyDelegate md= new MyDelegate(obj.Show(“Hello World!!”));
md(); // call the delegate
We can create the events and event handler by using delegate with the below syntax:
public delegate void textChangedEventHandler(Object sender, TextEventArgs e); 
This event handler will be used to handle the textbox text changed event.
We can get more details about the delegate and events from the below link:
http://msdn.microsoft.com/en-in/library/orm-9780596521066-01-17.aspx

39.  Did you implemented delegate in project?

40.  MVC and asp.net difference. Why to choose MVC if ASP.net fulfils my project requirements?
Answer:
MVC
a. No View State
b. No PostBack
c. Code and HTML are completely separated
d. Best Suited for large projects
e. Unit testing can be done easily.
f. Testing can be done with out invoking the view
g. Can easily plugin more jquery script than asp.net easily
h. Viewstate is not used for maintaining state information.
i. Increase the performance

ASP.NET
a. It follows 'page Controller' pattern. So code behind class play a major role in rendering controls
b. You cannot do unit testing only for code behind alone. You need to invoke view to do testing
c. It manages the state by using view state and server based controls.
d. HTML Output is not clean

Other Answer:

Advantages of MVC architecture over asp.net

The Below lines of points which explains some advantages of MVC architecture over asp.net

MVC is loosely coupled Architecture
MVC doesn't contains the even driven concept so the presentation layer is loosely coupled with code behind

Multiple View Engines (Razor, aspx)
MVC which contains multiple view engines so we can choose one of our familiar view engines.say for example compare with aspx engine the Razor which contains the clean and simple syntax

Rewriting url can be easily done
In MVC we can implement the SEO friendly url easily

Lot of helper methods are available
MVC which contains lot of helper methods like custom paging, custom validation and we can create our own helper methods

MVC is a purely oops oriented architecture
MVC is purely OOPS oriented concepts so we can override the Model properties and inherit the model objects etc..

MVC which contains the HTML controls so the page render quickly
MVC view engines which contains the html controls so it will load the pages very quickly.Example @Html.ActionLink, @Html.Password, etc...
MVC which contains Web API controller for creating web services
Web API is good feature in MVC architecture. Here we can create our webservice in REST ful way and we can avoid other web services like SOAP, WSDL,etc..

41.  Partial views and strongly typed view difference.
Answer:
Partial Views:
These are sub-views or reusable views
Whenever we want to reuse the views we can go in for partial views.
Examples of reusable views are header and footer views where we will be using it across the application.
To achieve reusable views partial views are created.
It is light weight.

Strongly Typed Views
It is used for rendering specific types of model.
It inherits from ViewPage
 (T --> Type of the model)

42.  What is master page?
Answer:
Master Page is used in web application
We can say master page as a template for the other pages in our project.
For creating a constant look and feel for all our pages in web application. 
It acts as a placeholder for the other pages or content.
If a user makes a request to a webpage it merges with masterpage and will provide the output

43.  How to do javascript client side validation? Why we do validation at client side?
Answer:
The below code is to do client side validation
function samplejavascript()
   {
    alert('Hello World');
   }
In order to increase the performance of web application and to avoid post backs. So validation are done at client side.
44.  What are limitations of Open XML?
Answer:
OpenXML in SQL has the limitation of storing values upto 8000 characters only

45.  which version IIS you are using?

46. Difference between classic and integrated Application pool
Ø   Web applications in IIS 7.0 can be configured to use either Classic mode or Integrated mode. Classic mode maintains backward compatibility with earlier versions of IIS by using an ISAPI extension to invoke the ASP.NET runtime.

Ø  IIS 7.0 Integrated mode is a unified request-processing pipeline that combines the ASP.NET request pipeline with the IIS core request pipeline. The integrated pipeline provides improved performance, provides modularity for configuration and administration, and adds flexibility for extending IIS with managed-code modules.

47.  Types of Authentication and Authorization in IIS.
Answer:
Types of Authentication: Anonymous Authentication, Windows Authentication, Digest Authentication
Types of Authorization:- Anonymous

Other Answer:
a)1)Authentication:

The process of verifying user credentials and creating identity is 
called as Authentication.

2)Authorization:

The process of allowing or deny the requested resources is called 
as Authorization.

We combine both these process for providing effective security 
management for our website.


ASP.net provides 3 types of Authentication. Out of which we have to 
select one Authentication mode based on our website.

1)Windows Authentication
2)Passport Authentication
3)forms Authentication.


1)Windows Authentication:
In this method we will use IIS and windows for checking user 
credentials. This is default Authentication mode.

2)Passport Authentication:
This is a third party Authentication and we use Microsoft passport 
service for Authentication. It is not implemented for commercial clients 
specific website but implemented for Microsoft related websites.

Note: for passport and forms Authentication we must set IIS level 
Authentication as anonymous. Which means at IIS level all users are 
allowed.

3)Forms Authentication:
This authentication is the most implemented authentication in 
ASP.net . In this Authentication mode all process will third party 
services are used. User can implement any logic and perform authentication 
however required.

48.  Types of Authentication and Authorisation in ASP.Net.
Answer:
Types of Authentication: Windows Authentication, Forms Authentication
Types of Authorization:- File Authorization and URL Authorization
Other Answer:
ASP.net provides 3 types of Authentication. Out of which we have to 
select one Authentication mode based on our website.

1)Windows Authentication
2)Passport Authentication
3)forms Authentication.

49.  ASP.Net Life cycle.
Answer:
The request starts with the client and processed through IIS. In IIS, there are 2 utilities- INetInfo.exe and ASPNet_ISAPI.dll the InetInfo.exe checks for the syntax and semantics of the request and then the request goes to the ASPNet_ISAPI.dll which is the filter to filter the .aspx files. Here the URL request split in to 2 parts- virtual directory and webpage. Now worker process which is nothing but the application factory basically contains all the virtual directories and checks for the current virtual directory. If this is first request, then there will be no Virtual directory available. Now the worker process (W3wp.exe) creates a memory area called as AppDomain to check for the current page. As AppDomain is the Page Handler factory so it contains all the processes pages. If this is the new page then it will not find here. The request further move to the HttpPipeline where the actual execution of the page happened by using the ProcessRequest method and creates the events of the page. After creation of event and execution of all the event, the html page gets back to the user.

50.  Page Life Cycle
Answer:
There are few events which gets generated during the page execution like: Page_BeginRequest, Page_Init, Page_Load, Page_Prerender, Page_Render, Page_Unload etc
For the details of the page life cycle, you can follow the previous question.

Other Answer:
• InIt:
Before constructing the control PreInIt then each control Instantiated set to Innitial state Added to Control State.

• LoadViewState:
Lost state of the controls restored from viewstate values.

• Load:
User Code runs, tests it's postback conditions to databind first value.

• PostBack Data:
Posted Data is passed to its associated controls.

• PostBack Events:
Events are fixed for controls in tree order, except the event that caused the post it's fired last.

• Pre Render:
Create Child Controls, ensure controls are ready to render.

• Save ViewState:
Controls save current state (if different than initial values)

• Render:
Each control Render itself to the Response.

• Dispose:
Page and all controls are destroyed.

51.  What are Extensions, modules and handlers?
Answer:
HttpModule and HttpHandler are the utilities which are used in the HttpPipeline under the ASP.Net page life cycle. When the request received to HttpPipeline, the HttpModule checks for the Authentication of the request and then it route the request to the respective handler. After that HttpHandler takes that request and process it. After Processing the request again the HttpModule takes the response and send it back to the worker process and finally to the user.

52.  What is worker process?
Answer:
Worker process (w3wp.exe) is an executable which is also called as the Application Factory. This is used for the execution of the request and handling of the request for the current web page

53.  What are Globalisation and localisation? How to implement them?
Answer:
Globalization is the concept of developing the application in more than one language while the Localization is used for a particular language. Like if we develop the application in more than one language we need to create the resource files (.resx) by using System. Globalization and when we open the application in a particular language, then the localizations used to convert that application to the selected language.
Other Answer:
Globalization and Localizations are the concepts to improve the application with different languages.
If you want to know how to improve that in your application then refer below link
http://www.codeproject.com/Articles/334820/Using-Globalization-and-Localization-in-ASP-NET

54.  How to configure HTTPS for a web application?
Answer:
To configure the HTTPS (HTTP with Secure) for the web application, we need to have a client certificate. We can purchase the client certificate from the trusted providers and then we need to install that provider for our site. By implementing the HTTPS, all the data which is passing will be in encrypted format and will be more secure.

55.  Difference between GET and POST. Which one is more secure?
Answer:
GET and POST methods are used for the data transfer between the web pages. GET mainly used for small data which is not secure because in case of GET method, the data which we are passing will be visible in the url so we can't keep the secure data which will be visible in the url. There is also limited data which can be passed in case of GET method (max 255 character).
POST is used for transferring the huge data between the pages where we can keep the secure data and can transfer it. In case of using the POST method, the data which is transferring between the pages will not be visible so it is more secure than the GET method. Also there is no limit for POST method to post the data to the next page.
POST is more secure.
Other Answer:
Both perform same action only. Using both we can able to transfer data from one application to another. Using get method we can able to view the information in URL itself, but using post we can able to transfer data over networks .We can’t able to transfer bulk of data using GET method. But using post method we can able to transfer bulk of data. Compare to GET method POST method is secure, why because using GET method in URL itself data has to be shown. But using POST it travel the information over networks, so this is very secure. Post method data we can’t get it directly. But Get method data we can get easily.

56.  What are Razor engines? How is it diff from ASP Engines?
Answer:
 RAZOR engine is the new concept in the MVC 3 which is mainly used to create the views in the MVC applications. It created the xhtml pages for the MVC application and xhtml pages can be generated automatically by using the Razor engine.ASP engine create the aspx pages while Razor engine creates the xhtml pages.

57.  What needs to be done to call a JavaScript function from code behind?
Answer:
If we want to call the JavaScript function from the code behind, we need to attach the JavaScript to the events in the page_load eventas:
protected void btnSave_cliekc9object sender, EventArgs e)
{
btnSave.Attributes.Add("onclick,"JavaScript: retrun Validatedata();");
}
Here ValidateData is the JavaScript function which can be used to validate the page data and if validation fails, it will return and will not execute the server side btnSave_click event.

58.  Difference between Server Controls and User controls?
Answer:
User controls are used for the reusability for the controls in the application. By using the user control, we can use the same control in the various pages. User controls can be created by combining more than one control. To use the user controls, first we need to register them in the web page where we want to use that control. A separate copy is need in each page where we want to use the user control. User controls can't be included in to the toolbox.
Server controls are those controls which can be found in the toolbox and can be directly drag to the application like textbox, button etc. For the server control, only 1 copy of the control is needed irrespective of the number of web pages. If we want 10 textboxes to be added in our web page, we need only 1 copy of the textbox in the toolbox and can be dragged 10 times.
Other Answer:
Server Controls are the controls that execute on the server, ex TExtBox, label etc..
EX:
Asp:Label Id=”lbl” runat=”server” 
User Controls are the controls combine more than one server controls and combine together and use that in our application. We can implement usercontrol with .ascx extension.
EX:
Register TagPrefix=”tag” TagName=”Name” Src=”…”
And using that tagprefix we can able to call that controls in our application.
Tag:Control id=”id” runat=”server”

59.  Register tag in ASP.NET then why add reference, How to use custom control and user control in ASP.NET Page
60.  What are the differences between themes and skins
61.  What are the differences between style sheets and skins
62.  A string has "Hello , Good Morning", print with the name given by user.
63.  You have edited some value in a gridview. How will you update those values to dataset?
64.  Difference between Acceptchanges and Updatechanges in dataset?
65.  If Application Configuration and Server Configuration have different session state values, what will happen
66.  what are appdomain and apppool
67.  what is connection pooling
68.  Which method of HttpHandler is invoked returning the markup for the requested file?
Ans: ProcessRequest

69.  What is application life cycle
70.  How many web.config file an application can contain?
71.  What are types of Authentication?
Answer:
Three type of Authentication. They are Windows, Forms, Passport authentication.
72.  What is Windows Authentication?
Answer:
Windows Authentication method uses Windows accounts for validating users' credentials. This type of authentication is very good for intranet Web sites where we know our users. 

73.  Difference between List and Arrays?
Answer:
Array is a collection of homogeneous elements. List is a collection of heterogeneous.
Array memory allocation is static and continous whereas list memory collection is dynamic random.
Array size has to be specified while creating whereas list size can not be determine at dynamic.
User need not keep track of next memory allocation for arrays. User has to keep track of location where next memory is allocated.

74.  Difference between Response.Redirect and server.transfer
Answer:
Response.Redirect() will redirect to a new page, update the address bar and add it to the Browser History. On your browser you can click back.
Server.Transfer() does not change the address bar, you cannot hit back.

75.  What is server.exceute()
Answer:
When Server.Execute is used, a URL is passed to it as a parameter, and the control moves to this new page. Execution of code happens on the new page. Once code execution gets over, the control returns to the initial page, just after where it was called. However, in the case of Server.Transfer, it works very much the same, the difference being the execution stops at the new page itself.
76.  what are objects in asp.net?
77.  What is page lifecycle for master and content page in asp.net
Answer:
Here I want to describe different scenarios of page events life cycle.
When your page is inherited from master page, HTML, form & body tags are not allowed in content page.

If your page is inherited from master page then the sequence of event will be as 

Case 1:
page life cycle for master and content page in asp.net

Content Page PreInit Event
Master Page Init Event
Content Page Init Event
Content Page Load Event
Master Page Load Event

Case 2:
page life cycle for master and content page with user control in asp.net

Content Page PreInit Event
Master:UserControl Init Event
Master Page Init Event
Content Page Init Event
Content Page Load Event
Master Page Load Event
Master:UserControl Load Event

Case 3:
page life cycle for master page, content page and a web user control on master page and content page on both

Content Page PreInit Event
Page:UserControl Init Event
Master:UserControl Init Event
Master Page Init Event
Content Page Init Event
Content Page Load Event
Master Page Load Event
Page:UserControl Load Event
Master:UserControl Load Event
78.  Use of Machine.Config ?
79.  what is default heap size ?
80.  How to perform authorization in asp.net?
81.  What are HTTP Handlers and HTTP Modules?
82.  Is Web.Config File is an optional file in asp.net?
Ans)YES
83.  Can we create a WEB.CONFIG file more than one in an our application
Ans)YES,we can create one or more than one.
84.  What is the use WEB.CONFIG file?
Ans)1)To store Sql Connection Strings
2)To handle Custom Error Page
3)Authorization
85.  Can you write a code for storing sql connection string in web.config file(Recruiter told me to write on a Paper)?

Ans)

   < configuration>
   < connectionStrings>
  < add name="sqlconnectionstring" connectionString="Data  Source=source name;Initial Catalog=DB;User ID=sa;Password=sa" />
   </connectionStrings>
</configuration>

86.  How you will display a Confirm MessageBox in Asp.Net(Recruiter told to write on a paper? 
Ans)
< script type="text/Javascript" language ="javascript">
function confirm_meth()

   if( confirm("Do you want to continue!Click 'YES'")==true)
   {  
      document.writeln ("you click on 'YES' Button");
   }
   else 
  {  
   document.writeln ("you click on 'NO' Button"); 
  }
}
</script>
87.  What is the Difference between Eval() and Bind()?
Ans)Eval() method provides only for displaying data from a datasource in a control.
Bind() methods provides for two-way binding which means that it cannot be used to display as well update data from a datasource

88.  Which Protocols that are commonly used for sending and retrieving Email Message?
Ans)1)SMTP
2) POP

89.  Is Try and Catch Block help to the programmer?
Ans)I answered Yes,(again Recruiter ask me where you had used in your project>br> and use of it.I said to handle Custom page Error.If any unhanded exception
occur in a page catch block will redirect to custom error Page)
90.  Can you write a code for handling Custom Error Page using try and catch Block?
Ans)
try
   {
   }
  Catch(Exceprtion ex)
  {
   Exception["error"]=ex;
   Response.Redirect("ErrorPage.aspx");
 }
91.  How many ways you can display a Custom Error Page?
Ans)1)Using try and catch block
2)Page Error Event Handler in Page source code
3)Application Error Event Handler
4)using Page Error Element in web.Config
92.  Can you write a stored Procedure using DataSet?(Recruiter told to write a code on paper)
Ans)

SqlConnection conn = new SqlConnection("Data Source=name;Initial Catalog=db;
User ID=sa;Password=sa");
conn.Open();
SqlCommand cmd = new SqlCommand("storedprocedure_name",conn );
SqlDataAdapter adapter = new SqlDataAdapter(cmd );
DataSet ds = new DataSet();
adapter.Fill(ds);
GridView1.DataSource = ds.Tables[0];
GridView1.DataBind();

93.  In which Event all the Controls will be loaded(in asp.net)?
Ans)In PageLoad Event

94.  Difference between custom control and user control?
Ans)
User control:-
1)Reusability web page
2)We can’t add to toolbox
3)Just drag and drop from solution explorer to page (aspx)
4)U can register user control to. Aspx page by Register tag
5)A separate copy of the control is required in each application
6)Good for static layout
7)Easier to create
8)Not complied into DLL
9)Here page (user page) can be converted as control then
We can use as control in aspx

Custom controls:-
1)Reusability of control (or extend functionalities of existing control)
2)We can add toolbox
3)Just drag and drop from toolbox
4)U can register user control to. Aspx page by Register tag
5)A single copy of the control is required in each application
6)Good for dynamics layout
7)Hard to create
8)Compiled in to dll






ØC#.Net
5      How to assign null value to object using C#?
6      Difference between string and stringBuilder?
7      Delegates in C#?
8      Difference between Convert.Tostring() and .Tostring() in C#?
9      Difference between Var and Dynamic types?
10   What is Generics in C#? how do you increase performance using generics?
Answer:
Generics allows you to define type-safe data structures, without specifying the actual data types. This increases the performance of the code and code resuse. Thus generics allows you to write a class or method that can work with any data type. Since Generics is type safe it avoids boxing and unboxing which increases the performance of the code because you need not convert an object to a specific datatype and viceversa.

11   Different Types of Generics in C#?
12   Difference between Array and ArrayList in C#?
13   struct A
{
int a;
}
A.a.ToString();
What is the output?
14   How does the following code work? DataReader dr; for(DataRow r in dr) {}
15   What are delegates? How will you add more than one method to a delegate?
16   Does the following code work?
class A {}
class B : A {}
A = new B();

17   Two classes: a, b
________ fun()
{
int I = 10;
if(I == 10) return new a();
else return new b();
}
What will be the return parameter?

18   . interface A { int print(); }
interface B { int print(); }
class C : A, B
{
int print() { Print "Welcome"; }
}
How will you call B's print method?

19   What is the difference between string and string builder?
Answer:
String: 
a.It uses the the namespace "System"
b.It is immutable, meaning value will not be overwritten in the memory while assigning new value  
variable to the string. It creates a new memory space for storing the new variable. 
c.It is sequential collection of Unicode characters for representing text 
d.Additional memory will be allocated during concatenation.

StringBuilder:
a.It belongs to the namespace "System.Text"
b.It is mutable, meaning value will be overwritten in the memory while assigning new value variable to the string. 
c.Cannot assign value directly to string.You need to create object
     StringBuilder obj = new StringBuilder("Hello World");
d.During concatenation additional memory will allocated only if it exceeds buffer capacity

20   What is difference between a.equals(b) and a==b?
Answer:
“==” --> It compares reference 
"Equals" --> It compares object by VALUE

21   What is the performance issue in for loop?
22   What is Nuget?
Answer:
It is Visual Studio extension and a opens ource project
By using Nuget we can easily add,update and remove libraries in Visual Studio Projects.
When you add or remove a library it copies/removes necessary files to your application.
It is a quick way to add reference to our application.

23   What is the yield and its purpose in C#?
24   Have you used any collections in C#? What is the purpose of using it?
Answer:
Yes i have used collection in c#.
It is uses the namespace "System.Collection".
It is a specialized classes for data storage and retrieval.
It is type safety and increases performance. 

Commonly used collections are
a.ArrayList 
b.Hashtable 
c.SortedList 
d.Stack
e.Queue 
f.BitArray

25   How to find whether data is stored in stack or its in heap?
Answer:
Both are stored in the computer’s RAM (Random Access Memory)
Value types are stored in stack and stored in sequential (LIFO).
Objects are stored in Heap and data are stored randomly 

Some additional points:-
Stack is much faster than heap. Its because of the memory allocation.
When it wants to allocate memory it moves up in Stack

26   How registry is maintained?
27   What are advantages of Interop?
28   How to use satellite assemblies? Have you ever thought of using it in your project?
Answer:
If we want to write multilingual/multicultural app and want to have it spearated from your
main application. Those are called satellite assemblies. 
Assemblies which is containing culture information is called satellite assembley.

29   How to improve performance of code in C#? Do you follow any techniques?
30   what is generic and write the piece of code for that?
31   what is type - casting?
Answer:
It converts one type of data in to another type.

32   what is sealed class what sincero use?
Answer:
To prevent override data from base class to derived for that purpose we used Sealed class. By default all classes are sealed only but using virtual/ Abstract the behavior is get changed.

33   can u write code for delegates?
34   what is ".SubString?
35   what is difference between collection and generic?
36   How do you compare two dictionary objects?
Answer:
You can use the SequenceEqual method of the dictionary object to compare 2 dictionaries as shown below:
bool result = dic1.SequenceEqual(dic2);
Here result will be true if the two dictionary objects are equal else false.
37   Have you heard about IComparable? How does it work?
Answer:
A Class can implement IComparable interface if you want to compare the objects of that class. then in that class we have to implement the CompareTo method and provide the implementation to compare two class objects.
For more info refer:
http://www.dotnetspider.com/resources/42949-sorting-user-defined-collection-c-using.aspx

38   What is the difference between ref and out keyword. Is out a Reference variable?
Answer:
ref is initialized before entering the function which is called, whereas out variable is initialized inside the function. The out keyword used for a variable causes it to be passed by reference. It is used when a method has to return multiple values(one using return statement other using out keyword).

39   Difference between Internal and Protected access modifiers
Answer:
A protected type or member can be accessed by code in the same class or in a derived class wheareas An internal type or member can be accessed by code in the same assembly.

40   Difference between ReadOnly and Const.
Answer:
A Const can be initialized only once whereas ReadOnly can be initialized at runtime in the constructor.
•Constants are static by default that is they are compile time constants
whereas Readonly are runtime constants.
•Constants must have a value at compilation-time and they are copied into every assembly that uses them.
Readonly instance fields must be set before the constructor exits because they are evaluated when object is created.

41   Difference between Var, object and Dynamic types.
Answer:
var is the keyword introduced with .net 3.5 and used to store any kind of data like dataset, data table, int, float, char etc. We can keep any kind of data in the var variable.
var myVar = new String[] {"hello", "world!!"} ;
Here the myVar is the var type variable which is used to store the string array. Like this we can store any type of data into the var.
Object is the type which is used to store the objects of any kind. These objects need to be type caste when required.
Like object mybject = "Hello"
Here the myObject variable of object type is used to keep the string variable. Now when we want this variable value, we need to typecast it like
string strvar= (string) myobject;
Dynamic- It’s a keyword introduces with the .net 4.0 and used to keep the data similar to the var keyword. The difference between the var and dynamic is that the dynamic variable uses the same
memory location to store the object and not changes throughout the application.

42   Difference between Functions and methods.
Answer:
in.Net terminology, both are same. in general, we use method in .net but in scripting language we use function like JavaScript function.
Here the difference can be Function always returns a value which method may or may not. It depends upon the return type of the method.

43   Covariance and Contravariance.
Answer:
Covariance and contravariance are the new features added with the .net 4.0. They are basically used for the implicit reference conversion for different .net types like array, delegate, and generic etc
You can go to the below link for more details with the examples that how we can use the covariance and contrvariance to implicate reference conversion:
http://blogs.msdn.com/b/csharpfaq/archive/2010/02/16/covariance-and-contravariance-faq.aspx

44   What are Extension methods.
Answer:
Extension methods are special types of methods which are static methods but called as the instance methods. The extension methods are added with the .Net framework 3.5 and with the Visual Studio 2008.
These methods won’t affect the existing class and the label. These methods are used for the extra behavior which the calls can provide. There is no need to build the class again if we add any extension method to the class.
There are various inbuilt methods added in .Net 3.5 with the introduction of LINQ. We can see the extension methods like Order By when we use the Linq as:
e.g.
int[] numbers = { 10, 45, 15, 39, 21, 26 };
var orderedNumbers = numbers.OrderBy(a => a);

45   What are Anonymous methods and Lambda Expression.
Answer:
Anonymous methods are those methods which does not have the name. As they don’t have the name, so there is no way to call these methods. These methods are created by using the work delegate as below:
button1.Click += delegate{listBox1.Items.Add(textBox1.Text)};
Lambda Expression: It’s an easy way to create anonymous functions. It is also an anonymous function which has the capability to contain expressions and statements. We can create the delegate and expression tree types using the lambda expression.
For more details regarding the anonymous method and lambda express, you can go through the below link:
http://www.codeproject.com/Articles/47887/C-Delegates-Anonymous-Methods-and-Lambda-Expressio

46   What is lambda expression?
47   What is anonymous type?
48   Multithreading. How to implement Multithreading?
Answer:
Executing more than one process simultaneously called as multithreading. To implement the multithreading concept, we need to use the System. Threading .dll assembly and the System. Threading namespace.
To write the thread program, we need to create a class with the method. Now we can create the thread object and then pass the method by using the class object to the method.
After that we need to create the ThreadStart delegate which will call the actual method of the class.
You can go through below link for more explanation and other details regarding the implementation and the code snippet:
http://www.codeproject.com/Articles/1083/Multithreaded-Programming-Using-C

49   Which interface is used to 
a. Convert Boolean values to Visibility values?
b. Compare two integer values?
c. Compare String values?
Answer:
Check the below interfaces which are used in these scenarios:
a. Convert Boolean values to Visibility values?
b. Compare two integer values?- IComparable interface
c. Compare String values? IComparer interface

50   What is a Partial class?
51   Are keys in a dictionary unique?
52   In a hashtable, what are data types you can use as a key?
53   Program to reverse a string and check whether it is a palindrome without using built in functions
54   What is a Disposable Pattern?
55   What is String Builder?
56   Is Reflection used only to get the metadata of an assembly?
57   What is dll hell?
58   Twoway binding between a property and a TextBox, Either on button click or via a short cut key (alt or ctrl + some key) it will show the Text in the TextBox. I entered a Text and pressed the short cut key. What will happen? Error or Entered Text or ?
59   void Q(int i)
{
Q(i/2);
Console.Writeline(i);
}

What is the output?

60   Two functions:
int Add(int A, int B) { // Your code }
int Add(int A, int B, int C) { return (A + B + C); }

You should call the second method in first to perform addition of A and B. How will you do?

61   What is data modeling?
62   What is downcasting and upcasting?
Answer:
"Upcasting" means moving subclass object to the parent class object. "DownCasting" is opposite to "Upcasting" moving the parent object to the child object.



"Upcasting" is perfectly valid but "Downcasting" is not allowed in .NET. For instance below is a simple "Customer" parent class which is further inherited by a child class "GoldCustomer".

class Customer
{

}

class GoldCustomer : Customer
{

}

Below is an "upcasting" code where the child parent class gold customer is pushed to the customer class.

Customer obj = new GoldCustomer(); 

Below is a sample of "downcasting" code where parent class object is tried to move to a child class object, this is not allowed in .NET.

GoldCustomer obj = new Customer(); // not allowed

You can also see the below video on Dotnetspider channel which explains this concept with full demonstration

Other Example:
class Birds {
int health = 100;
}
class Sarrow extends Birds { }
class Crow extends Sarrow { }
class parrot extends Sarrow { }
public class Test {
public static void main(String[] args) {
Crow c = new Crow();
System.out.println(c.health);
parrot d = new parrot();
System.out.println(d.health);
}
}

63   what is void?
64   can void function have return value?
65   can I use "return" variable inside the void methods?
Answer:
we can use"return" key words only not with any datatype "return string_name"

66   Did even have return type?
67   what is yield?
68   Write a program to convert string to integer with out using library
69  What is versioning
70  What is namespace of assembly at runtime, what are the methods in it
71  What is Virtual Base Class
72  what are data structures?
73  Differences between sorted list and hashtable
74  what is a dictionary?
75  what happens if there are duplicate keys in a dictionary?
76  what are extension methods and lambda expressions?
77  what is serialization and deserialization, its uses and different types of serialization?
78  describe ADO.NET , how does it function?
79  differences between datasets and datareaders, give situations in which each one will be advantageous to be used?
80  differences between xml and html
81  can we have custom tags in html and is it necessary to close tags in html
82  how to populate a tree view control from an xml
83  different types of parsers for xml and code samples for it.
84  difference between dataset clone() and copy()
85  what is a delegate, why is it used and its advantages?
86  what are threads, why is it used
87  what are optional parameters and give the code for that
88  In one interview, he gave me a situation where an application has some 20 classes implementing an interface. Later at some point of time, a class needs one extra method to be added (new functionality). So, what will be your approach? Will you add the method signature to the interface and implement it in all the classes?
89  How to have controller check? ( Its a MVC question)
var album=  this.service.GetAlbum(id);
Answer:
The controller name should be the ServiceController and it should have the GetAlbum method. By passing the albumid to get the details of that particular album.

90  How to add validation using data annotation: properties (get; set;)
Answer:
Validation can be written as the data annotation in MVC applications. MVC support the Model based validation where the model class will have the validations. In the Model class, we can directly write the data annotations as:
public class Customer
{
[Required]
Public int CustomerID{get;set;}
[Range(1,100)]
Public int Qty(get;set;)
}

91  What is the difference between out and ref?
92  Is it possible to use more than one out parameter?
93  Default access specifiers for class member C#?
Answer:
Default modifier for the class – internal
Default modifier for the enum – public
Default modifier for the interface – public
Default modifier for the Method – private
Default modifier for the Field – private
Default modifier for the Properties – private

94  Difference between stack panel and wrap panel?
Answer:
The main difference between the wrap panel and stack panel is that when we place the controls inside the wrap panel and if there is no space then the controls will come in the next line and they will be wrapped automatically.in case of stack panel, they will not come to next line if no space if remaining

95  How do you make a class public within an assembly but private outside?
Answer:
Make the class as internal type. So that it will be public with in the assembly but will not be accessible outside of the assembly. So it will be private for outside

96  Apply OOPS concept to improve the code
Class Program
{
 Public int GetAreaForRectangle( int Length, int Height)
 {                  
 Return Length*Height;
 }
 Public int GeAreaForCircle( int radius)
 {
  Return 3.14*rad*rad;
 }
Answer:
Create an abstract class and write a single method and then inherit it in the classes as:
public abstract class MyClass
{
  public abstract  int Area(int param1, int param2=1);
}
Class Rectangle: MyClass
{
 public override int Area(int param1, int param2=1)
 {
  return param1* param2;
 }
}
Class Circle: MyClass
{
 public override int Area(int param1, int param2=1)
 {
  return param1* param2;
 }
}
To call then, just create the object of the child class and use it;
Rectangle r= new Rectangle();
Int area= r.Area(10,20);
Circle c= new Circle();
int cArea = c.Area(10);

97  Provide a better way of writing code
return "on this day" + DateTime.Now.Day + "in the month of" + DateTime.Now.Month.ToString("MMM") + "in the year" + DateTime.Now.Year;
Answer:
var day = DateTime.Now.Day;
var month = DateTime.Now.Month.ToString("MMM");
var year = DateTime.Now.Year;
return "on this day" + day + "in the month of" + month + "in the year" + year;

98  Extend system.DateTime to code Function Get Days in company on DateTime of objects,
For ex: employe.DateofJoin.Getdays in company()
Answer:
I think there are asking here for the Linq to add the extra functionality. The extension method needs to be written for the Getdays()..

99  This one please answer: write below code in C#
*
***
*****
*******
*********
Answer:
I think this should be simple….Just 2 for loop that's all
for(int i=0;i <5; i++)
{
 for(int j=1;j<2i-1;j++)
 {
  Console.WriteLine(j.ToString());
 }
}

100 What is the difference between IEnumerable and IQuerable?
101 What is cross site scripting? (XSS)
102 If I want to see my website similar in all the browsers the what I need to do for that?
103 If say 1Lac users are using any particular website then what you will do to prevent crashing of server? Which care you will take at the time of coding?
104 How to close the sqldatareader?
sqldatareader.close();

105 If i forgot to close the sqlconnection. what error it will show to the user?
max pool size reached error will display

106 Diffence between DataReaderand Dataset
Answer:
DataReader is connected architecture and dataset is disconnected architecture.
DataReader is better performance and dataset is lower performace.
DataReader able to fetch record in single direcion(forward only) whereas dataset able to fetch in bi-direction.
Using DataReader records are readonly whereas dataset records can able to add, update and delete.

107 What are anonmous methods in c#?
108 What are extension methods in c#?
109 What is difference between var and dynamic in c#?
110 what is ADO.NET?
Answer:
ADO.NET is used to access data and data services based on dataset or datareader. It is commonly used by programmers to access and modify data stored in relational database systems.

111 How can we know the methods available in a raw dll file?
Ans: Using .Net Reflector.
112 Difference between Value Types and Referenec Types.
Answer:
A variable that is declared pf value type(int,double...), stores the data, while a variable of a reference type stores a reference to the data.
Value type is stored on stack whereas a reference type is stored on heap.
Value type has it own copy of data whereas reference type stores a reference to the data

113 When an integer variable is declared in a class. Is this integer variable a value type or a reference type
Ans: It is a value type but the memory is allocated on heap.
114 Difference between readonly and const keywords. can you use these keywords with reference types
Answer:
The value of const is set at compile time and can't change at runtime 
Const are static by default. 
The readonly keyword marks the field as unchangeable. However it can be changed inside the constructor of the class 
115 What are delegates and events. What is the default handler in C#.
116 Is public static void Main() method available in console based applications/Windows/Web applications?
117 A dll in GAC and a dll on a network which one is secure and why?

ØWCF/Web Services
5      Exceptions in WebServices?
6      How can you prevent your Web services from unauthorized access?
7      Explain the concept of Web services in brief.
8      Does a Web service have state?
9      What is the purpose of HTTP, SOAP in webservice
10   Why do we go for web services?
11   Difference between .NET Remoting and web services
12   why we are going for WCF?
13   what is different between Web services and WCF?
Answer:
Below are the main differences between the WCF and Web Service:
Web Service:
a. Can be hosted in IIS only
b. Only two types of operations affects- One-Way, Request-Response
c. To serialize the data use System.Xml.Serialization
d. To encode the data use- XML 1.0, MTOM, DIME, Custom
WCF service:
a. Can be hosted in IIS, Self Hosting, WAS, Windows Services etc
b. Three types of operations affects- One-Way, Request-Response and Duplex
c. To serialize the data use System.Runtimel.Serialization
d. To encode the data use- XML 1.0, MTOM,Binary, Custom
e. WCF Service can be accessed through HTTP, TCP, Named pipes, MSMQ,P2P etc

14   what is basichttpbinding and Wshttpbinding?
15   what are type of binding in WCF?
Answer:
Binding mainly describes about the communication of the client and service. For this, there are protocols corresponding to the binding behavior which will take care of the communication channel. There are different protocols which we use for the different types of bindings. E.g. HTTP, TCP, MSMQ, Named Pipes etc.
Behavior is used for the common configurations that could be for endpoints. When we use the common behavior, they affect to all the end points. Adding the service behavior affect the service related stuff while the endpoint related behavior affects the end points. Also operations level behavior affects the operations

16   what is use if TCp binding? why we are going for TCP binding?
17   what are instance modes available
18   what is throttling in WCF?
19   what is ABC?
20   what is output format in Wshttpbinding?
21   what are contract and types? OR What are different types of Contracts supported?
Answer:
There are mainly 5 type of contracts used in WCF service:
a. Service Contract
b. Operation Contract
c. Data Contract
d. Message Contract
e. Fault Contract

22   How to use Fault Contract?
Answer:
Fault Contract is mainly used for viewing and displaying the errors which occurred in the service. So it basically documents the error and the error message can be shown to the user in the understandable way. We can’t use here the try….catch block for the error handling because the try…catch is the technology specific (.Net Technology). So we use the Fault contract for the error handling.
e.g. To use the Fault contract, we can simply write like the below:
public int Add(int number1,int number2)
{
// write some implementation
throw new FaultException (“Error while adding data..”);
}
Here the fault Exception method is the inbuilt method which will throw the exception and display the message . We can use the custom class so that the message can be customized and the customized message can be sent to the client.
So we can creeat a clss like:
Public Class CustomException()
{
public int ID{get;set;}
public string Message{get;set;}

public string Type{get;set;}
}
Now this custom type we ca use with the Operation Contract as:
[ServiceContract] 
Public interface IMyInterface
{
[OperationContract]
[FaultContract(typeOf(CustomException))]
Int Add(int num1,int num2);
}
Now while implementation of the Add method, we can assign the class properties.

23   can we able to self hosting?If Yes means how?
24   what are type of hosting available?
25   What are Endpoints
Answer:
The collection of Address, Binding and Contract is called as End Point. In Sort,
EndPoint = A+B+C
Address (Where)- it means where the service is hosted. URL of the service shows the address.
Binding (How)- How to connect to the service, is defined by the Binding. It basically has the definition of the communication channel to communicate to the WCF service
Contract (what)- It means what the service contains for the client. What all the methods are implemented in the WCF service is implemented in the Contract.

26   I am using Java project,we need to communication with that project?which binding is better.(Tell your answer clearly they shoot the questions from that.. :)
27   can able to control the browser request in WCF?
28   can overloading method in WCF?
29   what is service contract? can you explain some other feature of that?
30   what is services?
31   Tell me security level?
32   What is the difference between Transport and Message Security mode?
Answer:
WCF supports 2 types of security- Transport Level Security and Message Level Security
Transport Level Security- In this type of security, we make the transport channel as secure so that the data flows in that channel will be automatically secured. For HTTP channel, we use the client certificate for the security of the web address. SSL is used for the HTTP channel security. As we don’t need to secure each of the messages which are floating between the client and the service, the speed is faster as direct message is going to the client from the service.
Message level security- This type of security in WCF is used where we don’t have the fixed transport medium and we need to secure each message which is floating between the server and the client. In this type of security we use certain algorithms for making the message as secure message. We use some extra bits and send with the message. We also use some encryption techniques like SHA1 or MD5 which make the proper security for our message. As each message needs to be secured, this type of security makes some delay in the process of sending and receiving the messages.

33   How to configure WCF security to support Windows authentication?
Answer:
To support the WCF security in Windows Authentication, we need to add the ClientCredetialType attribute to “Windows” under the security tab element:
transport clientCredentialType="Windows"

34   how you reference WCF service in ur project?
35   How to handle errors in WCF?
36   What is the difference between basic binding tcp binding?
37   What is MSMQ?
38   What is message contract?
39   How to create proxy client?
40   what is service reference and web reference which one you will use for WCF?
41   write the code for calling WCF in ur project?
42   How do you mark a service method as webservice method?
Answer:
Decorate the method with the WebMethod attribute as shown below:
[System.Web.Services.WebMethod()]
public string GetData(string message)
{
return "My Service";
}

43   In a Web service If you have multiple methods and you have to make only one method as Web service method How can you do it?

44    
45  

ØAjax
5      What are the Advantages using AJAX Controls?
6      Pros and cons of JavaScript and AJAX.
Answer:
JavaScript is a scripting language and mainly used for client side validation. We can validate the client side data before sending to the server. So by this we can improve the performance of the application. 
Ajax is Synchronous JavaScript and XML which is used for the Asynchronous calls from the server. It uses internally the JavaScript for making the call and use XML for the Data Transfer. It basically uses the XmlHttpRequest for the asynchronous calls to the server and communicates with the xml data which is platform independent. So Ajax can be used with any technology.

7      What is UpdatePanel when we use that?
8      how do return partial view in controller?
9      what is difference between viewdata and view bag?
Answer:
ViewBang and ViewDate are used for the same purpose.They are used to pass data from controllers to view. When we assign any data or object to them they are accessible in views. Let us see what is difference and similarities between them.

ViewBang and ViewDate:
ViewBang and ViewDate are used for the same purpose. They are used to pass data from controllers to view. When we assign any data or object to them they are accessible in views.

ViewBag is a dynamic property that takes advantage of the new dynamic features in C# 4.0.
Basically it is a wrapper around the ViewData and also used to pass data from controller to corresponding view.
It’s life also lies only during the current request.
If redirection occurs then it’s value becomes null.
It doesn’t required typecasting for complex data type.
            ViewDate: 
                   ViewData is a dictionary object that is derived from ViewDataDictionary class.
                   ViewData is used to pass data from controller to corresponding view.
                        It’s life lies only during the current request.
                        If redirection occurs then it’s value becomes null.
                        It’s required typecasting for complex data type and check for null values to avoid
error.

            Similarities between ViewBag & ViewData :
                        Helps to maintain data when you move from controller to view.
                        Used to pass data from controller to corresponding view.
Short life means value becomes null when redirection occurs. This is because their goal is to provide a way to communicate between controllers and views. It’s a communication mechanism within the server call.

            Difference between ViewBag & ViewData:
ViewData is a dictionary of objects that is derived from ViewDataDictionary class and accessible using strings as keys.
ViewBag is a dynamic property that takes advantage of the new dynamic features in C# 4.0.
ViewData requires typecasting for complex data type and check for null values to avoid error.
ViewBag doesn’t require typecasting for complex data type.
ViewData is a dictionary of objects and they are accessible by string as key.Example code is like this:

          ViewBag & ViewData Example:

public ActionResult Index()
{
    ViewBag.Name = "Phagu Mahato";
    return View();
}

public ActionResult Index()
{
    ViewData["Name"] = "Phagu Mahato";
    return View();
}

public ActionResult Index()
 {
        var Languages = new List string
     {
       "C",
  
               "C#",

           "Java"

     };
   ViewData["Languages"] = Languages;
   return View();
 }

                        Another example:
public class HomeController : Controller
 {
    public ActionResult Index()
      {
            var emp = new Employee
            {

EmpID=Em1,
    Name = "Deepak Kumar ",
    Salary = 4000,
    Address = "New Delhi"
};

ViewData["emp"] = emp;
      ViewBag.Employee = emp;
      TempData["emp"] = emp;
      return View();
}
} 

10   How to validate using data annotation first name not be blank and minimum 5- maximum 50 characters only allowed.
public class order
{
public int order id;
public string username;
public string firstname;
public string lastname;
}

11   Create json structure for
public class order
{
public int order id;
public string username;
public bool active;
}

12   Create a json structure, give an example for it with syntax explanation.
Answer:
        var x={key1:val1; key2:val2;key3:var3}
JSON (java Script Object notation) is mainly used for the data communication in the hetero generous environment where the JSON data will be transferred between the client and servers.
It always takes the key value pair. It can take the data in to the textual format so no need to typecast or convert while sending to the network.
13    
14    
ØJQuery / Javascript
5      what is different between javascript and JQuery?
6      what is use of javascript?
7      Is it possible to use .js files used under script will be in body and not in header? Why?
8      When the document.get.ready function is called?
9      How to insert an element after a specific element?
Answer:
Insert an html element after specified html element, insertAfter() method can be used in the method and "h1"insert after the element For Example : <script> $("h1").insertAfter("#div3"); </script>

10   How to get or set element width in the Jquery what is the method used?
Answer:
Here we get and set the width of an html element, width() method can be used and in the code snippet alert is give or written in the css element of the method For Example : <script> $("h1").css("background", "#c0c0c0").width("200px"); alert($("h1").width()); </script>

11   How do we place content before a specific element?
Answer:
Here to place content before a specific html element, before() method can be used. in the code snippet and also it will insert the specific text before tag called "h" example: <script> $("h1").before("<h2>This should not be at the top</h2>"); </script>

12   How to find the immediate next element from the element found by the selector?
Answer:
To find the immediate next element from the element found by the selector, next() method can be used. For Example : <script> $("div li").first().next().css("border", "3px dashed brown"); <script>
13   How do we find last element in Jquery from the matched element?
Answer:
In the group of matched elements this last () methos is used to find the element example : <script> $("div li").last().css("border", "2px solid red"); </script>

14   How do we find first element in Jquery from the matched element?
Answer:
In the group of matched elements this first() method is used to find the element example : <script> $("div li").first().css("border", "5px solid blue"); </script>

15   How to filter an element from the group of similar kind of elements based on its attribute value?
Answer:
(Filter())In the code snippet of an element the similar kind of element based on its attribute we should insert filter in the snippet

16   How to find a specific element from the group of similar kinds of element?
Answer:
In finding a specific element from the group of similar kind of element, eq() method can be used. For Example: $('p').eq(2).css('color', 'red'); this code snippet shall find the 2nd paragraph (“p”) from the page and apply foreground color as red.

17   How to iterate through each specified element of the page?
Answer:
To iterate through each specified element of the page, each() method can be used. For example: $('p').each(function (index) { alert(index + ': ' + $(this).text()); }); Above code snippet will iterate through every paragraph of the page and alert its zero based index (position in the page and its text).

18   How to add an element to a particular element?
Answer:
We should write in code snippet add a paragraph (p) element to all div element of the page. That paragraph element will have “ + This is added - ” text written in brown color. in the code snippet

19   How to get/set the value of an element?
Answer:
To set the value of an element in the Jquery we should write in the code snippet $("val()").css.() in the code snippet

20   How to remove an attribute class from an element?
Answer:
In the element we should use removeattr() in the script or code snippet for example $("p,removeclass()").css("border, 1px solid green")

21   How to remove the css class from an element?
Answer:
In the code snippet the element of thge class will be remove by inserting removeclass() function in the script function $("removeclass").css("border 1px solid red");

22   How to insert html content from the beginning of the target?
Answer:
insert specified string at the beginning of the element in the begining $("#div2").prepend("Prepending text : ");

23   How to insert html content at the beginning of an element?
Answer:
the element in the html content at the begining of the code is written. it inserts specific string in the element in the string .. $("#div2").prepend("Prepending text : ");

24   How to append html content to the element?
Answer:
This will specify the elements in the html by applying append () function in the code snippet example $("#div2").append(" | This my book <i>Book</i>");

25   How do we append the source element content to the target?
Answer:
This source element is mentioned inb between the paragraph ..in the code snippet it is mentioned like $("p").appendTo("#div3");

26   How do we select the first child of the parent element?
Answer:
This FirestChildSelector () is mentioned in the element in the code in the snippet For example $("#div2 p:first-child").css("background", "red"); Here in the above snippet it is mentioned clearly

27   How to use jquery in textbox bind event?
28   If I want to do debugging in Jquery then which library I need to add in my project?
Answer:
To debug jQuery code in IE using Visual Studio debugger.Add the keyword "debugger" where you want to debug
       function samplejavascript()
       {
        debugger;
        alert('Hello World');
       }
29   In how many different ways can JavaScript be used/called in an application?
Answer:
JavaScript can be used for Client Side validation, can also be used for calling of server side methods and functions, can be used for calling the web services etc.
Other Answer:
In source of the application itself you can able to call javascript code as well as in code behind itself we can able to use that in code behind also.

30   How to avoid conflicts in jQuery amoung different libraries?
var jq14 = jQuery.noConflict(true);
 (function ($) {
     $(document).ready(function () {
             // your logic
     });
 }(jq14));
31   To debug JQuery, which line has to be added in the code?
32   How you find root and cause if JQuery application throws an error as object is undefined?
33   How to return json as resultset through jQuery?
34   What are roles of JQuery Selectors?
35   How to display treeview using JQuery?
36   What is slideToggle() effect?
37   Why to use JQuery if JavaScript is already available? (You have to give advantages of JQuery)
38   What is .siblings() method in jQuery?
39   Difference between prop and attr?
40   What is window.location do?
41   What is significance of # in JQuery?
42   How to implement intellisense in JQuery?
43   Have you used animations in JQuery?
44   How to deploy ajax based application using JQuery?
45   What is difference between .empty(), .remove() and .detach()?
46   Is it possible to delete cookies in jQuery? If yes then how?
47   Is it possible to read and write cookies in jQuery? If yes then how?
48   Write code for sorting array using jQuery.
49   How to implement resize()using jQuery?
50   What is mean by Extensibility in terms of jQuery?
51   How to implement anonymous functions in jquery?
52    


ØSQL Server/Oracle/Database
5      What are Indexes and different types of Indexes in SQL Server?
Answer:
Indexes are one the database objects which is used to improve the performance of the database queries. it reduces the table scan while retrieving the data from the database and the search gets fast-
There are 2 types of indexes used in the SQL server:
a. Clustered index
b. Non clustered index
There are 3 more types of index but those comes under the above two-
a. unique index
b. Composite Index
c. XML Index-added in SQL Server 2005
The index basically works on searching like binary tree where the root value is the finding value and it will be compared with the partitioned value of the tree
Other Answer:
Indexes we are using to fetch data for faster execution purpose. There are 2 types of indexes available.
Clustered Index- It’s fetching the data based on Column wise
Non clustered Index- it’s fetching the data based on Reference wise

6      Difference between Stored Procedure and Functions in SQL Server?
7      Triggers in SQL Server?
8      Joins in SQL?
9      Types of joins?
10   Remove Duplicate Records from a table?
11   Display the employee name repeated more than once in a table?
12   Difference between delete and truncate in sql server?
13   how to write a query for to get id,name,managerid,manager name it will have table employee
id int
name varchar(20)
managerid int
Answer:
select * from Employee
14   How to improve performance a table consits of 1000 records to select id,name,sal where designation = somecondition?
15   how to get 3 chatacters of a given telephone number?
Answer:
firstTwoDigits = number.ToString().Substring(0,2);
int.Parse(firstDigit)
int.Parse(firstTwoDigits)
16   How will you pass a table returned by a SP as parameter to another SP.
17   Where is the table name stored in SQL Server?
18   Write a query to get all the table names.
Answer:
1.    select * from information _schema.tables
2.    You will get all the tables in your related database.Example
    Select * from SYS.TABLES
19   Consider a subquery is used in more than one query in a SP. How will you achieve this? That is how will you write a query that reuses a subquery?
20   Table A has 5 rows and table B has 7 rows. How many rows does "Select * from A, B" return?
Answer:
5*7 = 35 (Cross Join)

21   What is the difference between truncate and delete?
22   How to count of inserted rows without select statement?
23   What is SQL bulk copy?
24   What is performance tuning in SQL?
25   How you can retrieve data which is case sensative using SQL query?
26   Are there any index present other than clustered and non-clustered index?
27   How to find employee's data alongwith its manager's data if you have table which has following columns empid , manager's id , name,salary, designation etc.
28   What is the purpose of an Index?
Answer:
An index is used when we need a bookmark for our table. They are just used to speed up searches/queries. A table can only have one Clustered index and up to 249 Non-Clustered Indexes.
Clustered Index:
A clustered index physically sorts the data in a table.The value of a clustered index is a key-value pair,where key is the index key and value is the actual value.
If you create a primary key in a table,a clustered index is created by default.
Non- Clustered Index:
A non-clustered index sorts the data logically but not physically.The value of a non-clustered index is not the data but a pointer to the data page.So, we can say a non-clustered index is dependent on the clustered index.In the absence of clustered index, it refers a physical location in the Heap for value.

29   Difference between Stored procedure and function?
Answer:
• Function has a return type but Stored procedure doesn't have a return type.
• Stored Procedure supports IN/OUT/IN-OUT Parameters while function supports only IN parameters.
• Stored procedure can contain all the DML(Select,update,insert,delete) statements but function can contain only select statement.
• Function can be called from a stored procedure but stored procedure cannot be executed from a function.
• For Exception Handling, the stored procedure can contain try---catch block but Function doesn't support try---catch block.
• Function can be called in a SELECT statement not a stored procedure

30   What are the different types of joins you know? And Explain them.
Answer:
The different type of joins I know are:
Inner Join, Outer Join and Self Join.
I. Inner Join/Join: 
The First table and second table are matched row by row. The result set contains only the matching records from both the tables, unmatched rows are ignored. If the 2 tables has no matching records, then it returns NULL.
II. Outer Join:
Outer join is of 3 types,such as:
Left outer Join, Right outer Join, Full outer Join.
Left outer Join:
This join returns all the rows from the left table along with the matching rows from the right table. If there are no columns matching in the right table, it returns NULL values.
Right outer Join: 
This join returns all the rows from the right table along with the matching rows from the left table. If there are no columns matching in the left table, it returns NULL values.
Full outer Join:
It returns all the rows from both the table when the conditions are met and returns null value when there is no match.
III. Self Join: 
Joining the table itself called self join. Self join is used to retrieve the records having some relation or similarity with other records in the same table. Here we need to use aliases for the table to join 2 different column of the same table.

31   What is the maximum number of non-clustered index that can be created by for a table?
Answer: 249

32   What is the difference between "Having" and "Where" clause?
Answer:
• Having clause is a search condition like Where clause but is used only for an aggregate(Avg, Sum, etc.) or Group By statement.
• Having can be used only in a Select statement unlike Where clause which can be used in any DML Statement.
Other Answer 1:
When the where clause is not able to evaluate the condition which consists of group functions, Having clause is used. Having clause is always followed by the Group By clause.
Where clause is used to filter the records based on the conditions. If there is the requirement to get the group data in the select statement and where clause is not able to get it, we can use the Having clause.
e.g. Display DeptNo, No.of Employees in the department for all the departments where more than 3 employees are working
SELECT DEPTNO, COUNT(*) AS TOTAL_EMPLOYEE
FROM EMP
GROUP BY DEPTNO HAVING COUNT(*) >3
Other Answer 2:
Where clause is used to get the result based on condition. If condition is satisfied we get the result otherwise it returns empty data.
In some scenarios where clauses will not perform the total operation in that case we will use Having clause using that we can able to fetch our data properly.

33   Difference between Primary Key and Unique Key?
Answer:
I. A table can have only one primary key column but it can have more than one unique key columns.But the combination of the columns must be having a unique value.
II. Primary key cannot have a NULL value but an Unique Key column can have only one NULL value.
III. By default,primary key creates a clustered Index whereas unique key creates a non-clustered Index.

34   Can a foreign key reference a non-primary key?
Answer:
Yes, a foreign key can actually reference a key that is not the primary key of a table. But, a foreign key must reference a unique key.

35   Difference between delete and truncate?
Answer:
i. Delete command delete the rows from a table row by row but Truncate command delete all the rows from a table at one time.
ii. TRUNCATE is much faster than DELETE.
iii. You cann't rollback in TRUNCATE but in DELETE you can rollback.TRUNCATE removes the record permanently.
iv. TRUNCATE is a DDL command whereas DELETE is a DML command.
v. In case of TRUNCATE ,Trigger doesn't get fired.But in DML commands like DELETE .Trigger get fired.
vi. You cann't use conditions(WHERE clause) in TRUNCATE.But in DELETE you can write conditions using WHERE clause.

36   Difference between Union and Union All?
Answer:
The only difference between UNION and UNION ALL is the fact Union removes all the duplicate rows between 2 tables whereas Union All returns all the values from both tables.
Performance wise Union All is faster than Union as itt requires some extra effort to eliminate the extra rows.
Union command is basically used to return all related rows between 2 tables

37   What are different type of subqueries?
Answer:
A query nested inside another query is called a subquery. The different types of subqueries are:
i. Single row subquery : Returns zero or one row. 
ii. Multiple row subquery : Returns one or more rows. 
iii. Multiple column subquery : Returns one or more columns. 
iv. Correlated subqueries : Reference one or more columns in the outer SQL statement. The subquery is known as a correlated subquery because the subquery is related to the outer SQL statement. 
v. Nested subqueries : Subqueries are placed within another subqueries.

38   write the query for top 2nd ?
Answer:
Select Top(2) * from tablename
39   what Sp and UDF and tell difference?
40   what is trigger and explain it?
41   can you insert/delete in view and its reflect in the table?
Answer:
Yes, we can perform All CRUD operations using View it’s get reflected in a table also.

42   what are joins available? 
Answer:
In SQL we have different types of joins are available.
Inner Join, Outer Join, Join, Left Outer join, Right Outer Join, Self Join, Cross Join.

43   what is cursors?
44   what is index and explain?
Answer:
To get the table data without delay for that purpose we go for indexes. There are 2 types 
1) Clustered Index
2) Non-Clustered Index.

45   what is default non-cluster index value in 2005 and 2008?
Answer:
In SQL 2005 – 249
In SQL 2008- 999

46   how you handle error in SQl?
Answer:
Using Try and Catch Blocks we can able to handle errors

47   What is the difference between a View and a Cursor?
Answer:
View: It is one of the database object which is also called as virtual table. We can also say that it is a window through which we can see some part of database. View is also called as stored query because we are going to fetch some data using View.
View doesn’t contain any data. It’s just a virtual table which is used to get the records from the base table for which the view is created. View is faster than ad hoc queries because when we create the view and execute it once. Next time onwards it will be available as the compiled format. So whenever the view is called, it will just execute rather than compiling.

Cursor: Cursor is a database object which is also the buffer area which is created as a result of any sql statement to hold the intermediate values.
Views are used to format the rows individually. By using the views, we can process the individual rows. There are 4 types of cursors in Sql Server-
a. Static Cursor
b. Dynamic Cursor
c. Key set cursor
d. Read-only cursor

48   How to execute multiple update on different conditions in a single query?
Answer:
To execute multiple update using a single Sql update statement is the new feature available with the SQL Server 2008. In this, we can update multiple rows using a single update command.
Other Answer:
UPDATE set col1=value, col2=value
WHERE condition1=condition and condition2=condition.

49   Left outer joins and Right Outer joins
Answer:
Joins are used to join 2 or more tables using some conditions. There are 3 types of Joins in SQL Server database-
a. Left Outer Join
b. Right Outer Join
c. Full Join
In order to extract the matched row from both the tables and unmatched row from the first table, left Outer join is used. The syntax for left outer join condition is:
T.Col1* = T2.Col1
In order to extract the matched row from both the tables and unmatched row from the second table, right Outer join is used. The syntax for right outer join condition is:
T.Col1 = *T2.Col1
In order to extract the matched row from both the tables and unmatched row from the first table and then unmatched row from the second table, full join is used. The syntax for full join condition is:
T.Col1* = *T2.Col1
Other Answer:
Left Join : It returns all the rows from Left table if there is no matching values then in result it will show null values
Right Join: It returns all the rows from Right table if there is no matching values then in result it will show null values

50   Exception handling.
Answer:
Exception Handling is the way to handle the unexpected error. From the SQL Server 2005 version, try…catch block is also supported to catch the exceptions in SQL Server database. There is various other ways to catch the error like @@Error which is the global variable and used to get the error. RaiseError is another inbuilt method which is used to display the error.
Other Answer:
We wrote some queries if we get any error while execute that we can able to handle that using TRY,CATCH and finally block. We just wrote our code part under try lock we return error messages in catch block and we finally return that statement in finally block.

51   What is Performance Tuning? How do you implement it.
Answer:
Performance Tuning is the process through which we can optimize the SQL Server objects like functions, triggers, stored procedure so that we can achieve high response time to the front end. In the performance tuning process we generally check for the below point and optimize the objects processing:
a. Through Query Execution plan, check for the processing time of the query execution.
b. Check the join conditions and break all the condition for executions of the queries individually
c. Check for the error prone process, conditions in the queries.
d. Check for the loops whether they are terminated if any error occurs
e. Check for the processes which are taking more time in execution and how to reduce the response time.

52   Difference between Temp tables and Tables variables?
Answer:
Temp Table in SQL Server: 
a. Temp table is the special type of tables which are used to store the intermediate data of the actual table.
b. Temp tables are only visible to the current sessions of the sql server instance. When the session end, these table data automatically drops.
c. We can’t join the temp tables as they don’t allow the foreign key constraints.
d. Temp tables are created in TempDB database.
e. We can use the same temp table name for the different user sessions.
f. Mostly used in stored procedure to handle the intermediate data.

Other Answer:
Temporary table we can create while implement Stored Procedures, it’s won’t occupy physical memory but if we create table it will occupy memory. We can’t able to call temporary table at any time. But we can able to call tables at any time.

53   What does @ and @@ suffixed by property names specify?
Answer:
@- This is used for the variable declaration
e.g. @name varchar2(50)
@@- This is used for the Global variable declaration
e.g. @@Error=0
Other Answer:
@- is used to declare Parameter
@@- is used to declare global variable

54   Self-join queries
Answer:
Self-Join is a type of join which is used to join the same table by creating the second instance of the same table. So we join 2 instances of the same table in case of self-join. This type of join is used when there is the requirement to get the referenced data which is available in the same table

Ex: A table contains EmpId, Ename and ManagerId
As the manager id is also an employee id. Now if we want that who is the manager of which employee. In this situation, we need to create the instance of the same table and get the required data as:
SELECT EMPID, ENAME, ENAME AS [MANAGER NAME]
FROM EMP E1, EMP E2
WHERE E1.EMPID= E2.MANAGERID
Other Ans:
Self join is a join with same tables and fetch the result.
EX:
Select *
From emp a,
Emp b
Where a.empid=b.empid

55   Difference between Primary key , Unique key and Candidate key?
Answer:
Primary Key- It is a key to make the unique identification of the row in a table. It doesn't allow null values in the primary key column. We can create the look-up columns based on the primary key. One table allows maximum of 1 primary key and in 1 table, we can create the primary key column by using 16 columns. Due to one of the normalization rule

56   What is the default value for Date type. What are Min and Max values for Date in 2008
Answer:
The default value of Date is CURRENT_TIMESTAMP
Below are the new date and time values in Sql Server 2008:
In SQL Server 2008:
1. DateTime2
Min Value: 0001-01-01 00:00:00.0000000
Max Value: 9999-12-31 23:59:59.9999999
2. Date
Min Value: 0001-01-01
Max Value: 9999-12-31

You can go through the below link for couple of work around:
http://dhaneenja.blogspot.in/2008/06/minimum-year-value-in-sql-server.html

57   Difference between Stored Procedure and Function?
58   What is Pivot?
59   Employee table has two columns - eId, eName;
What is the output of the following queries?
Select eId eName as Name from Employee
Select eId eName from Employee

60   can you write query for get Top 7th row?
61   can you write query for 2nd max salary?
62   can writ the query for delete duplicate rows in the table base on the use name?
63   what is CTE?
64   What is cursors,any other option for that?
65   Two tables and Asked to wirte a select query on thta( Employee details who earns salary mode that highest paid manager). 
66   what are constraints in sql
67   how to remove duplicate records in a table
68   how to get the second highest value in a column from a table
what is a stored procedure, trigger and a function
69   If a database has 100 thousand users, then write an improved code for below
Select code, Name, Age, Mobile from employee where designation = upper(@user Provided)
Answer:
We can use Index for improving the performance. Check for the indexed column and then use it:
Select code, Name, Age, Mobile from employee (Index= ode) where designation = upper(@user Provided)

70   How you will handle exception in sql? Wheather you will save the exception in log files or any other ways which you give exceptions details to team member for anlaysing?
Answer:
As I told my role is team lead in project handling they asked this question how you give the exceptions details to your team member. I told through log files we used to catch the error exceptions.

71   What is Normalization?
Answer:
It is used for effective organizing and binding of data is called normalization. Two goal of normalization. Eliminate redundant data and ensure relational data.

72   Difference between query and stored procedure?
Answer:
In stored procedure you don't have to recompile your C# app whenever you want to change some SQL and better performance. You end up reusing SQL code. Using query, it will take more time to execute than stored procedure.

73   What is Group By Clause?
Answer:
GROUP BY clause will group selected set of rows into a set of summary rows by the values of columns specified in group by clause. It returns one row for each group. 
For ex: below query will list the average of marks scored by each student in each subject.
select studentid,subject, avg(marks)
from student
group by studentid,subject

SELECT a.City, COUNT(bea.AddressID) AS EmployeeCount
FROM Person.BusinessEntityAddress AS bea 
INNER JOIN Person.Address AS a
ON bea.AddressID = a.AddressID
GROUP BY a.City

74   Do you have knowledge in SSIS/SSRS in SQL Server?
75   Have you ever used scheduler in SQL Server?
76   Using Indexes and its advantages.
77   SQL Profiler
78   How do you check the performance of SQL queries?
79   How to Increase SQL Server stored procedure performance
Answer:
The following three tips can help you maximize performance when you're using stored procedures.
1:SET NOCOUNT ON
This help to stored procedures to stop the message indicating the number of rows affected by a Transact-SQL statement.
This can reduce network traffic.

2.Use return values
3.Don't write select * from [tablename]
write select [columnname1],[columnname2] from [tablename]
This helps to speed of the query.

4.Don't use Prefix "Sp_" in your store procedure.
Becoz if you use "Sp" then SQL Server looks in the master database then your database.

5.Use sp_executesql stored procedure instead of the EXECUTE statement.

6.Avoid using temporary tables inside your stored procedure.
Becoz Using temporary tables inside stored procedure reduces the chance to reuse the execution plan.

7.Avoid using DDL (Data Definition Language) statements inside your stored procedure.
Using DDL statements inside stored procedure reduces the chance to reuse the execution plan.

80   What is ssrs?
81   How to use ssrs in web application?
82   What is SSIS?
83   What is triggered?types
84   When do we use the UPDATE_STATISTICS command?
85   What is the purpose of using COLLATE in a query?
86   What is CHECK Constraint?
Answer:
The CHECK constraint is used to limit the value range that can be placed in a column.If you define a CHECK constraint on a single column it allows only certain values for this column.If you define a CHECK constraint on stable it can limit the values in certain columns based on values in other columns in the row

87   Difference between Drop and Truncate?
Answer:
When you Truncate a Table
1) Removes all Rows from a Table
2) Releases the storage space used by that table
3) You cannot roll back row removal when using TRUNCATE.
4) If the table is Parent of a refrential integrity constraint,you cannot truncate the TABLE.Disable the constraint before issuing the TRUNCATE statement.

Syntax: TRUNCATE TABLE tablename 

Drop:-
When you drop the Table:
1)All data and structure in the table is deleted
2)Any Pending transaction are commited
3)All Indexes are dropped
4)You cannot RollBack the DROP Table statement.
5)DROP TABLE is commited automatically
6)Indexes, tables, and databases can easily be deleted/removed with the DROP statement

Syntax:DROP INDEX table_name.index_name

88   Difference between varchar and char?
Answer:
varchar are variable length strings with a maximum length specified.
If a string is less than the maximum length, then it is stored verbatim 
without any extra characters.
char are fixed length strings with a set length specified.
If a string is less than the set length, then it is padded with extra characters
so that it's length is the set length.
89   can you write a code for Inserting a rows using storedprocedure?
(Recruiter told to write on a Paper)
Ans)
  CREATE PROCEDURE [dbo].[InsertUser] (
    @Username varchar(50),
    @Password varchar(50)
) AS
INSERT INTO Users VALUES(@Username, @Password)
string username = textusername.Text;
string password =txtpassword.Text;
SqlConnection conn = new SqlConnection("Data Source=localhost;Database=MyDB;Integrated Security=SSPI");
SqlCommand command = new SqlCommand("InsertUser", conn);
command.CommandType = CommandType.StoredProcedure;
command.Parameters.Add("@Username", SqlDbType.VarChar).Value = username;
command.Parameters.Add("@Password", SqlDbType.VarChar).Value = password;
conn.Open();
int rows = command.ExecuteNonQuery();
conn.Close();
90    
91    



ØDesign Patterns
5     What is design pattern?
6     Why to use design patterns?
7     How to use observer design pattern for user control?
8     How to implement singleton and façade pattern?
9     What is publisher subscriber model? Any design pattern can be implemented for it?
Answer:
It is also called as Observer design pattern.
Windows Communication Foundation (WCF) is the best exampled for this model.
The user can publish a Service and it can be consumed by many clients at the end point.
The Publisher gives the data to the clients who have subscribed to their methods.

10   what is MVC architecture?
11   Can you tell me about MVC?
12   what is SSIS?
13   what are pattern ? 
14   What is PRISM?
15   what is MVVM?
16   Difference between MVVM and MVC?
17   How will implement gate pass entry application using MVVM
18   What is UML?
19   What is singleton, how will you implement?
20    
                                                          
ØWPF
5     What is WPF why we are going for WPF?
6     Diff between XML and XAML.
Answer:
XAML is the declarative XML based language which is used to define the objects and properties. XAML document is loaded by XAML parser. So XAML Parser initiates the objects and set those properties. XAML is mainly used in creating the objects in WPF and Silverlight applications. 
For more detailed explanation, you can go through the below link:
http://www.differencebetween.net/technology/software-technology/difference-between-xml-and-xaml/

7     Stack Panel and Wrap Panel
Answer:
StackPanel is one of layout control in WPF. We can place the child controls inside the stack panel either horizontally or vertically. So it provides two types of orientations- Horizontal Orientation and Vertical orientation.
You can go through the below link for more detailed explanation and the code snippet:
http://wpftutorial.net/StackPanel.html

Wrap panel is another layout control which is similar to the StackPanel. Wrap panel not only keep the control in horizontal and vertical orientation but also wrap them in to new line if there is no space. Here also the orientation can be set as Horizontal or Vertical. Its main use is to arrange the tabs in the tab control, menu control or in toolbar items.
You can go through the below link for more details:
http://wpftutorial.net/WrapPanel.html

8     Hierarchical Data Template.
Answer:
Hierarchical Data Template is a type of data template which is used to bind the controls which supports HeaderedItemsControl, like TreeViewItem or MenuItem
We can bind those controls items using the Hierarchical Data Template. It displayed the data in to Hierarchical structure in the tree structure. It could be in the left to right or top to bottom.
You can go through the below link for more details:
http://msdn.microsoft.com/en-us/library/system.windows.hierarchicaldatatemplate.aspx

9     Virtualisation.
Answer:
This is the feature in WPF which increases the efficiency of the programs when there are the large data objects. If the WPF ItemsControl is bound with the large collection data source object and we enabled the virtualization, then the controls will show only the data which is in the visual container for those items which are visible currently. This visual data is only the small part of the large data object. Now when the user will scroll down or up, the rest of the data will be visible and previous data will be hidden again. So this is increase the efficiency of the program from the UI prospective.

10  Events and Routed Events.
Answer:
Routed event is special type of event which can invoke and handle multiple events from different objects rather than the event which is coming from one object. So it generally handles the object from the element tree. So whatever the elements inside the element tree and if they generate the event-may be multiple events, the routed event is capable of handling those events.
The routed event can be invoked in both the directions but in general it comes from the source element and then bubbled up in the element tree until the root element.

11  Bubbling and Tunnelling
Answer:
Bubbling: When the events are raised form the innermost element in the visual tree and comes up towards the root element, is called as bubbling.
Tunneling: It is the opposite process of Bubbling where the events fired by the root element goes down towards the last child element control.
Please go through the below link for more details:
http://www.dotnetspider.com/forum/130497-event-bubbling-event-tunneling.aspx

12  Resource Dictionary, Static Resources and Dynamic Resources
Answer:
Static and Dynamic resources are used for binding the resources to the control objects. 
The main difference between StaticResource and DynamicResource is that how the resource is retrieved elements. If the resource is StaticResource, it will be retrieved only once by the element whoe is referencing it and it will be used for all the resources. While the DynamicResource gets its value each time they reference to the objects. So StaticResource is faster than the DynamicResource , because StaticResource needs to get the value only once while the DynamicResource needs each time to get it.

13  What is Prism?
Answer:
Prism is the framework or the set of guidelines which is used to develop the WPF desktop application as well as the Silverlight Rich Internet applications. So it’s a kind of Design pattern to Develop the XMAL based application. It also used to develop the Windows 7 applications. Prism mainly helps to design the loosely coupled components which can be easily integrated with the other components of the overall application. Prism mainly used to build the composite applications which need various other components to be integrated. 
Prism mainly guides of creating the applications using the Model-View-ViewModel (MVVM) model, Managed Extensibility Framework (MEF), and navigation in the application.
To use the Prism framework, we need to use their library called as Prism Library. So prism Library is the inbuilt set of components which can be used in developing the WPF and Silverlight applications.
You can go through the below link for more details and the use of the components of the Prism framework:
http://msdn.microsoft.com/en-us/library/ff648465.aspx

14  Dependency Injection, Event Aggregator
Answer:
For the details about the dependency injection, you can follow the below link:
http://wpftutorial.net/ReferenceArchitecture.html
EventAggregator : It is the utility service which contains the events and allows the decouple the publisher and subscriber so that they can be buildup independently. Decouple is primarily useful when a new module needs to be added or removed or modified. The new module can be added as per the event fired and defined in the shell.
For more details about the Event Aggregator, you can follow the below link:
http://msdn.microsoft.com/en-us/library/ff921122(v=pandp.20).aspx

15  Shell, Bootstrapper and Region Managers
Answer:
Bootstrapper:- An utility in WPF engine which is mainly responsible for the initialization of the application by using the composite application library. By using the bootstrapper we can find out how the components of the application are wired up in the composite application library. The bootstrapper responsibility to create the Shell or main window. Composite application library has the default abstract class UnityBootstrapper which actually handles the initialization.
You can go through the below link for more details about the bootstrapper:
http://msdn.microsoft.com/en-us/library/ff921139(v=pandp.20).aspx
Region and Region Managers: This is concept of Prism framework. We define the region through XAML code and once a region is defined, automatically it will be registered with the RegionManager. Actually the Bootstrapper registers a service called the RegionManager at run time. RegionManager is a dictionary where the key is name of the region. The value of the key is the reference of the IRegion interface. RegionAdapter is used to create the instance reference of the IRegion interface.
You can go through the below link for more details about the Region and Region Manager:
http://msdn.microsoft.com/en-us/magazine/cc785479.aspx#id0090091

16  What are MEF and Unity?
Answer:
The MEF (Managed Extensibility Framework) is the new concept in .net 4.0. It is used to create the lightweight and extensible applications to create Managed Extensibility Framework. It is not only allows the extension but also reused within the application. Extension can be easily encapsulating the code using the MEF.
For more details, you can go through the below link:
http://msdn.microsoft.com/en-us/library/dd460648.aspx

17  How to navigate to another page?
Answer:
There is a class NavigationService which can be used for navigation of the WPF window:
this.NavigationService.GoForward();
//or
this.NavigationService.Navigate("MysecondPage.xaml")

18  WPF Architecture, TwoBinding, PresentationCore, Resources

ØOther
5     What is agile methodology? What are the advantages?
6     Explain about all your project feed in Resume.(asked lot of questions regards about project 30 min)
7     Why you are looking for other offer?
8     what kind of architecture is available and s/w life cycle?
9     Did you communication with client?
10  How will you implement Google's suggestions while searching something
11  How you will handle your project? Are you using software to work simultaneous with your team members?
ØPersonal
5     Tell about your last project you worked on?
Answer:
Tell about the recent project you have worked on. The technology and the database you have worked on. Your roles and responsibilities.
6     When was the last time you did coding?
7     what is your achievement in your company?

I told I received best performer award from my managing director and everyone respect me in my office.
8      
ØHR

Description- After technical rounds of interviews, candidates have to face HR and managerial round hence you can go through these questions while going for HR and managerial round.
Questions- 
1 Which technical book you have recently read?
Answer: Tell any Programming language book or database book with author name.

2 What you expect from our company?
Answer: I believe that this company has the capacity to offer me a rich and satisfying career, and I would like to remain employed here for as long as I am having a positive impact.

3 Which is the thing you dislike about your current company?
Answer: The purpose of this question is twofold: to find out about your professional dislikes, but also to gain some insight into why you are looking for another job. The interviewer assumes that there must be something you dislike about your current job, because otherwise you presumably wouldn’t be looking for another one.

It’s always best to present yourself in the most positive light and not to whinge about your employer or workplace, but certain dislikes are legitimate and can even reflect well on you.

4 Why you are leaving your current company?
Answer: Make Sure the Reasons Match

One thing to keep in mind is that it's important that the reason you give matches what your previous employers are going to say. It's a red flag for a hiring manager if the reason you give for leaving doesn't match the answer your past employers give when they check your references.

Here's a list of some good, and some bad, reasons for leaving your job.

Good Reasons for Leaving Your Job

These reasons all work well because they are all legitimate reasons an employee can decide to move on to a new position.

Limited growth at company
Good reputation and opportunity at the new company
Looking for a new challenge
Good career opportunity
Went back to school
Relocation
Change in career path
Company downsized
Company went out of business
Reorganization or merger
Long commute
Needed a full-time position
Position eliminated
Position ended
Offered a permanent position
Landed a higher paying job
Seeking a challenge
Seeking more responsibility
Seasonal position
Not enough hours
Not enough work or challenge
Stayed home to raise family
Not compatible with company goals
Retired

5 What was feedback you got from your manager at the time of performance evaluation?
Answer: Excellent

6 Which thing you have recently improved in you?
Answer: Could be any thing in positive. Like - Cummunication skills...

7 Do you have any aspiration? If yes, then what are those? 
Answer: Yes, My Dad...

8 How you try to achieve your goals?
Answer: 
My long-term goals involve growing with a company where I can continue to learn, take on additional responsibilities, and contribute as much of value as I can.
I see myself as a top performing employee in a well-established organization, like this one. I plan on enhancing my skills and continuing my involvement in (related) professional associations.
Once I gain additional experience, I would like to move on from a technical position to management.
In the XYZ Corporation, what is a typical career path for someone with my skills and experiences? 

9 Do you work during weekend?
Answer: Yes

10 How good you are as a team player?
Answer: Here are five qualities that make a good team player great:



1. Always reliable. A great team player is constantly reliable day in and day out, not just some of the time. You can count on them to get the job done, meet deadlines, keep their word and provide consistent quality work. With excellent performance, organization and follow-through on tasks they develop positive relationships with team members and keep the team on track.



2. Communicates with confidence. A good team player might silently get the work done but may shy away from speaking up and speaking often. Great team players communicate their ideas honestly and clearly and respect the views and opinions of others on the team. Clear, effective communication done constructively and respectfully is the key to getting heard.



3. Does more than asked. While getting the work done and doing your fair share is expected of good team players, great team players know that taking risks, stepping outside their comfort zones, and coming up with creative ideas is what it’ll take to get ahead. Taking on more responsibilities and extra initiative sets them apart from others on the team.



4. Adapts quickly and easily. Great team players don’t passively sit on the sideline and see change happen; they adapt to changing situations and often drive positive change themselves. They don’t get stressed or complain but are flexible in finding their feet in whatever is thrown their way.



5. Displays genuine commitment. Good team players are happy to work 9-5 and receive their paycheck at the end of the month. Great team players take the time to make positive relationships with other team members a priority and display a genuine passion and commitment toward their team. They come to work with the commitment of giving it 110% and expect others on the team to do the same. 

11 What are things you need to know about our company?
Answer: Always be prepared to ask the interviewer a few questions as well. This helps to demonstrate your preparation and interest.

Sample questions might include:

How would you describe a typical week/day in this position?
Is this a new position? If not, what did the previous employee go on to do?
How would you describe the company’s management style?
Who does this position report to? If I am offered the position, can I meet him/her?
How many people work in this office/department?
Is travel expected in this position? If so, how much?
What are the prospects for growth and advancement?
What would you say are the best things about working here?
Would you like a list of references?
If I am extended a job offer, how soon would you like me to start?

12 If you are changing the current company for growth then what exactly make you,to choose our company as your next level company?
Answer: Yes.

13 Why should we hire you?
Answer: Be prepared for this question because this answer will sell your story. Know clearly what you bring to the organization such as your knowledge, skills, experience, education/training and personal qualities that demonstrate why you are the best person for the job. Be able to show how you add value to the company. Always qualify your answers with quantifiable results you have achieved in previous jobs or assignments. This will add tremendous credibility!

Sample Answer: “I think I am a great match for this position. My degree in management coupled with more than 10 years of experience managing 100+ employees and delivering top notch training, helped me to improve staff productivity by 30% and reduce employee turnover. I believe that I can do the same for your organization and would be a great addition to your team.”

14 How you fill technical gaps incase of any?
Answer: I always give 10% in study for new things in my office time and also in home. I always try to learn new technologies.

15 How you communicate with your peers/seniors in case you have better solution for any problem statement?
Answer: In positive manner and polite way.

16 If more number of resources given under you then how you delegate work and how you recognize which resource is contributing more for project?
17 What are your strengths and weaknesses?
18 What are recent trends which should be known to every IT professional? 
19 How much you rate yourself in coding, out of 10?
20 What is leadership? What is a difference between a manager and a leader?
21 What is cloud ? Have you ever used?
22 What are your short term goals?
23 What are your long term goals?