Sei sulla pagina 1di 54

.Net..........................................................................................................................................

1
LINQ.......................................................................................................................................14
ASP.NeT.................................................................................................................................15
Database................................................................................................................................25
WCF........................................................................................................................................33
AJAX.Net.................................................................................................................................48
PL \ SQL:-................................................................................................................................49
SSRS........................................................................................................................................49

.Net

1. What is Generics
2. What’s new in 3.5 -- See below for examples.
Implicitly Typed Local Variables and Arrays
Object Initializers
Collection Initializers
Extension Methods
Anonymous Types
Lambda Expressions
A lambda expression is an anonymous function that can contain expressions and
statements, and can be used to create delegates or expression tree types.
Query Keywords
Auto-Implemented Properties
Partial Method Definitions

real world Example

Using extension methods to extend this approach…

C# 3.0 introduces extension methods. Using extension methods we might add new methods to a
class without deriving new classes. For example if a class can calculate sum of a series of numbers, we
might add a method to it in order to calculate the average of them:

public class extended


{

public int sum()

return 7+3+2; } }

public static class extending

public static float average(this extended extnd)

return extnd.sum() / 3;

}}

As you see, the class Extending is adding a method named average to class Extended. To get the
average, you call average method, as it belongs to extended class:

extended ex = new extended();

Console.WriteLine(ex.average());

A complete description of how extended methods work is out of the scope of this article.

3. What is LINQ
Good link on LINQ and all flavor’s in it.
http://msdn.microsoft.com/en-us/library/bb397926.aspx

4. What is new in .Net 4.0 and Sql Server 2008?


5. What is new in ASP.Net 3.5?

ListView Control
Data Pager
ASP.Net Ajax enabled sites for WCF and web services.
6. What is boxing and unboxing?
7. What is reflection? How did you use it? 2
Reflection is used to introspect an object or assembly at run time. It can be used to find the
properties and methods of an object at run time. For example in web services , when you want to
see if the incoming object has necessary properties you can use reflection to dynamically check the
properties at run time .

8. What is appdomain ?

9. What is assembly?

Assemblies are the building blocks of .NET Framework applications; they form the
fundamental unit of deployment, version control, reuse, activation scoping, and security
permissions. An assembly is a collection of types and resources that are built to work
together and form a logical unit of functionality. An assembly provides the common
language runtime with the information it needs to be aware of type implementations. To the
runtime, a type does not exist outside the context of an assembly

It also defines a type boundary, reference

10. Where is assembly stored?

 An Assembly is a  logical unit of code its not a physical thing


 Assembly physically exist as DLLs or EXEs
 One assembly can contain one or more files
 The constituent files can include any file types like image files, text files etc. along
with DLLs or EXEs
 When you compile your source code by default the exe/dll generated is actually an
assembly
 Unless your code is bundled as assembly it can not be used in any other application
 When you talk about version of a component you are actually talking about version
of the assembly to which the component belongs.
 Every assembly file contains information about itself. This information is called as
Assembly Manifest.

How will you load \ create a assembly at run time

Assem = System.Reflection.Assembly.Load(" ddlname “ )

helloType = assem.GetType("HelloWorld") ---- Getting a type

printMethod = helloType.GetMethod("PrintHello") --- Getiing a method


11. What is GAC ?
The Global Assembly Cache or GAC is a machine-wide .NET assemblies cache for Microsoft's
CLR platform
It’s found in C:\Winndows\assembly

12. How does GC work in .Net?


13. What is GC.Collect(GC.MaxGeneration);
14. GC.WaitForPendingFinalizers ();

is it possible to force the GC? The answer is yes, but use it sparingly. It’s preferable that the garbage
collector decide for you when to collect because it does when it is really needed. Anyway, it is possible to
force the garbage collection by calling the static method Collect and then waiting until it is finished with
WaiForPendingFinalizer

15. What is difference between Finalize and Dispose?

1) The very clear difference is that dispose can be called by user


The finalize is only called by Garbage collector.

2). In Dispose you can be sure of the calling order in hierarchy of classes
but in finalize, the order can never be predicted.

3). Objects with only Dispose method take less time in allocation and removal,
but objects with Finalize method take longer to be allocated and removed, in short it is
because their references’ are added in Finalization queue used by GC.
(You can read in detail about it in the link http://msdn.microsoft.com/msdnmag/issues/1100/gci/

16. What are the different objects you used in ADO.Net


Command Object, SQLDataAdapter, Connection, DataSet, DataTable etc

17. What are Iterators , Generics , Anonymous Methods

Iterators:
Iterators allow you to easily create enumerable classes: classes that allow you to
iterate through their collection of values via a foreach-in loop. Classes that implement
the IEnumerable() interface allow you to use foreach-in against them. The IEnumerable
interface demands that you implement a GetEmumerator method that returns an
IEnumerator object. It's the IEnumerator object that allows a foreach-in to work the way it
does.

The new iterator pattern makes use of the yield keyword. Using yield eliminates the
need for you to have to actually create and implement an IEnumerator object. It does
it for you. yield handles all of the storage and retrieval operations that come with
GetEnumerator().

Iterators are much faster than the old way of implementation with IEnumerable.
http://www.dotnetfun.com/articles/csharp/2.0/whatsnew20iterators.aspx
Another Explanation:
public interface IEnumerable
{
IEnumerator GetEnumerator();
}
public interface IEnumerator
{
object Current{get;}
bool MoveNext();
void Reset();
}
When you implement iterator ( that is thru ‘yield’ ) the interface IEnumerator is automatically
implemented and provides the ‘Current’ method.

Generics:
Generics are an extension to the CLR's type system that allow developers to define types for
which certain details are left unspecified. Instead, these details are specified when the code is
referenced by consumer code. The code that references the generic type fills in the missing
details, tailoring the type to its particular needs. The name generics reflects the goal of the
feature: to enable the writing of code while not specifying details that might limit the scope of
its usefulness.

Generics thus allow you to create type-safe collections without having to duplicate code. Even
better, because the generic types are expanded to their specific types at run time, the Just In Time
compiler is able to share code among different instances, dramatically reducing the code bloat that
you see, for example, in C++.

As a final tip to using Generics, my general approach is to write my generic class first using a
specific type (e.g., Employee) and get it working. Once it is fully debugged, I then genericize it,
converting the type from the specific Object or Employee to the generic T.

Another Explanation :

What are Generics?


Generics allow you to define a type-safe data structure or a utility helper class without
committing to the actual data types used. This results in a significant performance boost and
higher-quality code because you get to reuse data processing algorithms without duplicating type-
specific code. For example, instead of defining a linked list in terms of System.Object, you can define
it in generic terms, using generic type parameters:

public class LinkedList<T>

T[] m_Items = new T[100];

public void AddHead(T item)

{...}
public T RemoveHead(T item);

{...}

T is a merely a placeholder for the actual type to be used. When the client declares and
instantiates the list, it provides the type to use instead of the generic type parameter:

LinkedList<int> list = new LinkedList<int>();


list.AddHead(3);

http://www.ondotnet.com/pub/a/dotnet/2004/05/17/liberty.html
Good article on Generics

http://msdn2.microsoft.com/en-us/library/sz6zd40f(VS.80).aspx (Very Good)

http://www.15seconds.com/issue/031024.htm

What are constraints in Generics?

When you define a generic class, you can apply restrictions to the kinds of types that client code can
use for type arguments when it instantiates your class. If client code attempts to instantiate your class
with a type that is not allowed by a constraint, the result is a compile-time error. These restrictions are
called constraints. Constraints are specified using the where contextual keyword
Example: where T: struct
where T : class
where T : new()
class EmployeeList<T> where T : Employee, IEmployee, System.IComparable<T>, new()

Anonymous Methods
C# supports delegates for invoking one or multiple methods. Delegates provide operators and
methods for adding and removing target methods, and are used extensively throughout the .NET
Framework for events, callbacks, asynchronous calls, and multithreading. However, you are
sometimes forced to create a class or a method just for the sake of using a delegate. In such cases,
there is no need for multiple targets, and the code involved is often relatively short and simple.
Anonymous methods is a new feature in C# 2.0 that lets you define an anonymous (that is, nameless)
method called by a delegate.
For example, the following is a conventional SomeMethod method definition and delegate
invocation:
class SomeClass

{ delegate void SomeDelegate();

public void InvokeMethod()

SomeDelegate del = new SomeDelegate(SomeMethod);

del();
}

void SomeMethod()
{
MessageBox.Show("Hello");
}
}

You can define and implement this with an anonymous method:


class SomeClass
{
delegate void SomeDelegate();
public void InvokeMethod()
{
SomeDelegate del = delegate()
{
MessageBox.Show("Hello");
};
del();
}
}

18. What objects did you use in XML?

I have used XPATH , XPathNavigator , XmlNodeReader , XMLSerializer ,


XpathNodeIterator , XML Document , XML DataDocument , XPATH Document etc

19. Explain about XPATH?

XPATH is a quick way to get nodes from an xml document which matches a specific pattern.

Let’s take a simple XML

<Music>
  <Artist name="Evanescense">
    <Album name="Fallen">
      <Track number="1">Going Under</Track>
      <Track number="2">Bring Me To Life</Track>
      <Track number="3">Everybody's Fool</Track>
    </Album>
  </Artist>
</Music>

You want to quickly get ‘ Track’s contained in an album .

Step 1. Get the XML into an XPATHDocument. An XPath Document allows you to do find
operations in its data
// Load a document.
  XPathDocument doc = new XPathDocument ("Music.xml");

Step 2:

 // Get a navigator initialized to the root.


  XPathNavigator nav = doc.CreateNavigator();

An XPath Navigator is an object that allows you to move


around nodes in an XML document.

Step 3 : The XPath expression is //Album , this will get all


tracks in the album.

  // Compile the query first.


  XPathExpression exp = nav.Compile("//Album");

You don’t have to compile . Compiling will make it faster .

Step 4 : Now get the nodes that meet the criteria.


 // Perform a query using the compiled expression.
  XPathNodeIterator iter = nav.Select(exp);
This will return a list of nodes.

Step 5 : Loop thru the nodes and do the operation what ever
you want to do .

// Iterate through the results.


  while (iter.MoveNext())
  {
    XPathNavigator navCurrent = iter.Current;
    ProcessAlbum(navCurrent);
  }

Done .

The whole code is

  // Load a document.


  XPathDocument doc = new XPathDocument("MusicBase.xml");
  // Get a navigator initialized to the root.
  XPathNavigator nav = doc.CreateNavigator();
  // Compile the query first.
  XPathExpression exp = nav.Compile("//Album");
  // Perform a query using the compiled expression.
  XPathNodeIterator iter = nav.Select(exp);
  // Iterate through the results.
  while (iter.MoveNext())
  {
    XPathNavigator navCurrent = iter.Current;
    ProcessAlbum(navCurrent);
  }

20. What is serialization ?

Serialization is process of persisting state information into a stream for later recovery. In
sending objects across in a webservice the object is actually serialized implicitly, it’s also used In
remoting to send objects across.

Serialization is the process of converting the state of an object into a form that can be persisted or
transported. The complement of serialization is deserialization, which converts a stream into an object.
Together, these processes allow data to be easily stored and transferred.
The .NET Framework features two serializing technologies:

 Binary serialization preserves type fidelity, which is useful for preserving the state of
an object between different invocations of an application. For example, you can share an
object between different applications by serializing it to the Clipboard. You can serialize an
object to a stream, to a disk, to memory, over the network, and so forth. Remoting uses
serialization to pass objects "by value" from one computer or application domain to
another.
 XML serialization serializes only public properties and fields and does not preserve
type fidelity. This is useful when you want to provide or consume data without restricting
the application that uses the data. Because XML is an open standard, it is an attractive
choice for sharing data across the Web. SOAP is likewise an open standard, which makes it
an attractive choice.

21. What is difference between XPathDocument , XMLDataDocument , XML Document .

 The XmlDocument class, which is an XML parser and in-memory store that implements the W3C
Level 2 XML DOM core functionality. An XPathNavigatorcan be created over the document to provide a
wide range of extra features that allow easier access to the nodes and values, support the XML Infoset
model, and allow cursor-style navigation and updating of the content.
 
 The XmlDataDocument class, which is basically the same as the XmlDocument (it inherits from it), but
has the additional capability to expose the XML content as an ADO.NET DataSet instance - providing easy
interaction between relational and XML-based views of the data.  
 
 The XPathDocument class (in the System.Xml.XPath namespace), which is a high-performance in-
memory document store that is optimized for use with XPath queries. It is read-only and does not
support the W3C XML DOM functionality, making it leaner and more efficient where these features are
not required. An XPathNavigator must be created over the document to access the content.
 
The XmlDocument class is the primary choice for tasks where an in-memory store is required, unless
you can meet all of your requirements using the XPathDocument class with XPath queries. The
XmlDataDocument should only be used where you need to access the contents as a DataSet.

22. Which XMLDocument type will you use for fast processing?
Use XPATHDocument. Remember this read only.

23. Types of Serialization?


The XmlSerializer can be used when you need the data in the object to be stored in an XML Format.
However, this serialize has the limitation that it can serialize only the public fields of an object.

The Soap Formatter is ideal in scenarios where you need interoperability. This is ideal in applications spanning
heterogeneous environments.

The BinaryFormatter generates a very compact stream when an object is serialized as compared to the other
two techniques and hence is useful when data needs to travel electronically across the wire. This is appropriate
when the applications do not involve heterogeneous environments.

http://www.interviewcorner.com/Answer/Answers.aspx?
QuestionId=499&MajorCategoryId=1&MinorCategoryId=19

24. What types can you serialize?

You must apply the ‘Serializable ‘attribute on top of classes if you want it to be serialized.

25. What is deserialization?


26. What namespace for serialization?
System.Runtime.Serialization

20 Why can't I serialize hashtables?

A: The XmlSerializer cannot process classes implementing the IDictionary interface. This was
partly due to schedule constraints and partly due to the fact that a hashtable does not have a
counterpart in the XSD type system. The only solution is to implement a custom hashtable that does not
implement the IDictionary interface.

27. What is remoting?


28. What will you do if you don’t want certain properties not to be serialized?

Mark the property with [NonSerialized] attribute.

29. What are the basic classes involved in remoting.


30. What is an enum?
31. What is a Struct?
32. Why do you create a struct?
Structures can be defined as a tool for handling a group of logically related data items. They are user-
defined and provide a method for packing together data of different types. Structures are very similar to
Classes. Like Classes, they too can contain members such as fields and methods. The main difference between
classes and structures is, classes are reference types and structures are value types. In practical terms,
structures are used for smaller lightweight objects that do not persist for long and classes are used for larger
objects that are expected to exist in memory for long periods.

33. How many ways can you pass \ retrieve parameters to a method?
34. What is the difference between out and ref in C#?

1) Out parameters return compiler error if they are not assigned a value in the method. Not
such with ref parameters.

2) Out parameters need not be initialized before passing to the method, whereas ref
parameters need to have an initial value before they are passed to a method.

35. How do you pass arrays as parameters in c#?.


Using the ‘Params’ key word , this should be the last argument passed to the method.

Example

Public Array GetAdress(int SerialNumber , params string[] orderids)


{
…….
}

36. What are web services ? Steps Involved ?

The following table summarizes the differences


between the Heap and the Stack:

Memory Contents Item Item Item Timing


Order Lifetime Removal

Stack value types, sequentia scope pop determinis


stack frames l (LIFO) tic

Heap objects random referenc Garbage nondeter


e count Collection ministic
37.
38. Where did you implement Web services in last project(s) ?
39. How did you implement security in web services ?
40. What are delegates ? What is multi cast Delegates .

Delegate is a type safe method reference .It can invoke target methods and provide
help for events, callback etc.

41. What are new features in .Net 2.0


Iterators , Generics , Anonymous Methods , Master Pages , Themes , GridView , TreeView ,
Ajax.net
42. What are attributes ? Where do you use them
Attributes are decorative elements in .Net , that will help metadata be created in an
assembly . You can mark Classes or properties with attributes .
For example in Serialization . When you want to serialize a XML to a class , you can use XML
attributes like [XMLRoot] and [XMLElement] to map a specific class or property to a node in
XML .

Example : Let’s have a XML like this

<Products>
<Product>
<Name></Name>
<Price></Price>
</Product>
<Product>
<Name></Name>
<Price></Price>
</Product>
<Products>

We have a class like this

[XmlRoot("Product")]
public class Product
{
[XmlElement("Name")]
public string ProductName;

[XmlElement("Price")]
public string Price;
}

When you serialize the XML the attributes will help map a node value to a property.

28 . What is passing by ref and by value .


29 . What collections did you use . Hashtable , List<T>, Collection<T>,ArrayList, SortedList
30 . What will you do to write a custom collection .
31. What are Access Specifiers for Properties and methods .
What are access specifiers for a class ?
What modifiers can be used on methods ?
What is new keyword in methods ?

32 . What is difference between internal and public in .Net .


32. What is over-riding ?
33. What is overloading ?
34 . What are OOP’s concepts in C# or .Net .
35. What is an interface ?
36 . What is an Abstract Class ?. Can this have solid \ concrete methods in it . Yes

37 . What is polymorphism and how is it implemented in .Net .


38 . What are indexers ?.
39 . What is Virtual key word?.
40 . What is value type and reference types?

Reference types are stored on the run-time heap; they may only be accessed through a reference to that
storage. This allows the garbage collector to track outstanding references to a particular instance and free the
instance when no references remain. A variable of reference type always contains a reference to a value of that type
or a null reference. A null reference refers to nothing; it is invalid to do anything with a null reference except assign it.
Assignment to a variable of a reference type creates a copy of the reference, not a copy of the value being
referenced.
Value types are stored directly on the stack, either within an array or within another type. When the location
containing a value type instance is destroyed, the value type instance is also destroyed. Value types are always
accessed directly; it is not possible to create a reference to a value type. Prohibiting such a reference makes it
impossible to refer to a value class instance that has been destroyed. A variable of a value type always contains a
value of that type. Unlike reference types, the value of a value type cannot be a null reference, nor can it reference an
object of a more derived type. Assignment to a variable of a value type creates a copy of the value being assigned.

http://www.dotnetspider.com/kb/Article1897.aspx

41 . What are destructors ? Will you use them ? What are alternatives ?
42 . What is string Builder ?
43 . What is CLR profiler ?
44 . Threads in Appdomain
45 . What is thread pool .
46 . What are the problems with generics ?. ( Not sure about this )

Although using Generics is type safe, you don't have type-safe access while developing the class
itself. Because the type with which the generic class is used later is absolutely unknown, it's internally
assumed to be object. Specific members of the data type can only be accessed after an explicit and
therefore unsafe conversion. Possible failures will only be detected at run time.

47 . Difference between Passing a Struct and Passing a Class Reference to a Method .

This example shows that when a struct is passed to a method, a copy of the struct is passed, but
when a class instance is passed, a reference is passed
48.What's the difference between a const type and a read-only type?
A: Const types are ones where useful constants can be expressed at compile time - int, floats, etc. If your
type needs to be constructed through a "new", then you use read-only. Another difference is that any
use of the const type is replaced with the literal value, while read-only ones refer to the value in the
type where it's defined. If you change the value, clients see the new value with read only, where they'd
have to recompile to see that value with const.

49. What is abstraction?

50. What are different ways to use the “using “key word?

51. What is difference between event and delegate?

http://blog.monstuff.com/archives/000040.html
Three main differences:
- events can be included in interfaces,
- events can only be invoked by the containing class,
- events' signatures are constrained (depends on language and CLS compliance).

Events also add a pair of customizable methods "add" and "remove" similar to properties ("get" and
"set").

52 . What is a strong name ?

A name that consists of an assembly's identity—its simple text name, version number, and culture
information (if provided)—strengthened by a public key and a digital signature generated over the
assembly.

53 . What’s the difference between Response.Write () and Response.Output.Write ()?


Response.Output.Write() allows you to write formatted output. 

54 . What is dataset?

55 . What is difference between datareader and dataset?

56. What are interfaces? Which one will you use Abstract Classes or Interfaces.

57 . What is a static method ?.

58 . How will you stop a method from being overridden ?

You have to use the ‘ Sealed ‘ key word .

Public sealed string GetAccountNumber()

{………………..

59. What is difference in List and Linked List ?


The difference between List and Linked List lies in their underlying implementation. List is array based collection (ArrayList).
Linked List is node-pointer based collection (LinkedListNode). On the API level usage, both of them are pretty much the same since
both implement same set of interfaces such as ICollection, IEnumerable, etc.

The key difference comes when performance matter. For example, if you are implementing the list that has heavy "INSERT"
operation, Linked List outperforms List. Since Linked List can do it in O(1) time, but List may need to expand the size of underlying
array. For more information/detail you might want to read up on the algorithmic difference between LinkedList and array data
structures

60. What are nullable types.


Nullable types are instances of the System.Nullable struct. A nullable type can represent the normal range of
values for its underlying value type, plus an additional null value

int? x = null ;

61. Multithreading : Interview Questions


http://www.dotnetspider.com/forum/168861-Want-Interview-Question-MultiThreading-with-
answers.aspx

62. How do you implement a class if it implements two interfaces with same method name?

63. What are differences between remoting and WCF?

65. Code Access Security


http://www.devx.com/vb2themax/article/19886/1954

<FileIOPermission(SecurityAction.Demand, Unrestricted := True)>


Public Shared Function ReadData() As String
...
End Function

Similarly SQLClient permission.

LINQ
1. Linq keywords
Distinct, Skip<(Of <(TSource>)>), and Reverse<(Of <(TSource>)>).
2.
string[] names = { "Burke", "Connor", "Frank",

"Everett", "Albert", "George",

"Harris", "David" };

IEnumerable<string> query = from s in names


where s.Length == 5

orderby s

select s.ToUpper();

Can also be written as


IEnumerable<string> query = names

.Where(s => s.Length == 5)

.OrderBy(s => s)

.Select(s => s.ToUpper());

This form of query is called a method-based query. The arguments to the Where, OrderBy, and Select
operators are called lambda expressions, which are fragments of code much like delegates. They allow the
standard query operators to be defined individually as methods and strung together using dot notation. Together,
these methods form the basis for an extensible query language.

Uses :
1. You can write extension methods for data tier?

LINQ another link


http://www.hookedonlinq.com/LINQtoObjects5MinuteOverview.ashx

http://msdn.microsoft.com/en-us/vcsharp/aa336760.aspx

2. What is CRUD?
3. What is Entity Framework?
http://msdn.microsoft.com/en-us/library/bb399572.aspx

4. Types that support IEnumerable<(Of <(T>)>) or a derived interface such as the generic IQueryable<(Of
<(T>)>) are called queryable types.

5. Data transformation can be achieved in Linq, by subselecting, merging results from the main
select operation.
LINQ walkthrough
http://msdn.microsoft.com/en-us/library/bb397914.aspx
ASP.NeT

1. How can you pass information between pages in asp.net ? 0

There are 4 ways you can pass information between pages .

Using Application , Session , Query String and Previous Page Property


2. What is Post Back ?
3. What is Cross Post Back , and how does this work ?
4. What are Master Pages . How does this work
5. What are themes and skins ? How does this work.
6. What is view state ?
7. What are advantages and disadvantages of view state ?
8. What will you do to solve a slow rendering page ?
Decrease the view state
Have only necessary controls as Server Controls
Don’t access all the data beforehand . Get data when necessary.
Using Ajax is good.

9. What are user controls ?


10. What is caching and how many types of caching are there ?
Page Data Caching
Page Fragment Caching

11. What are new features in ASP.Net 2.0


Master Pages
Themes and Skins
New events in page life cycle available
Web Parts
Grid View , Tree View etc
SQL Cache Dependency

Pre init - Checks the IsPostBack property. To create or recreate dynamic controls. To set
master pages dynamically. Gets and Sets profile property values.
Init - Raised after all controls are initialized, and skin properties are set.
InitComplete - This event may be used, when we need to be sure that all initialization tasks are
complete.
Preload - If processing on a control or a page is required before the Load event.
Load - invokes the OnLoad event on the page. The same is done for each child control on the
page. May set properties of controls, create database connections.
Control Events - These are the control specific events, such as button clicks, listbox item selects
etc.
Load Complete - To execute tasks that require that the complete page has been loaded.
PreRender - Some methods are called before the PreRenderEvent takes place, like
EnsureChildControls, data bound controls that have a dataSourceId set also call the DataBind
method.
Each control of the page has a PreRender event. Developers may use the PreRender event to
make final changes to the controls before it is rendered to the page.
SaveStateComplete - ViewState is saved before this event occurs. However, if any changes to
the viewstate of a control is made, then this is the event to be used. It cannot be used to make
changes to other properties of a control.
Render - This is a stage, not an event. The page object invokes this stage on each control of the
page. This actually means that the ASP.NET server control's HTML markup is sent to the
browser.
Unload - This event occurs for each control. It takes care of cleanup activities like wiping the
database connectivity’s

12 . What are web services ?


Did you write\ expose or consume web services ?

In retail mode all interaction between application and database is thru Web services call
.

We exposed webservices that will get all order details , inventory details , back ordered
item details.

What are the steps involved in creating web service ?.


How did you implement security in web services .

13 . What files do you need to deploy a web application ?.

Only files needed to run this application: this option copies built output files (DLLs and
references from the bin folder) and any content files (such as .aspx, .asmx files). Most of the time, you
should be able to deploy the application using this default option.
How do you do deployment in web servers .

XCOPY and Copy Project options are ideal deployment scenarios that are simple and
manually executed. Although they work well for simple scenarios, there are many cases, where
a more robust deployment solution is required. In those scenarios, it is recommended that you
use the Windows Installer technology to deploy applications. The following advantages of
Windows Installer make it an ideal candidate for creating deployment packages for ASP.NET
Web applications.

 If the application installed using the Windows installer gets corrupted, the applications
can do a self-repair by using the repair feature of Windows installer packages. In the case of the
deployments, you need to manually replace the corrupted component with the newer version.
 By using Windows installer technology, you can also take advantage of the automatic
rollback feature, which not only ensures that the installed components are uninstalled but the
machine is also brought back to the same stage before the installer started, if the installation
fails.

Since the Windows installer uses an MSI installation database for storing all of the
information, it is possible to get the information about what files are copied, what
registry keys are created, and so on.

 If you're developing an application that you want to distribute to multiple users (or sell as
package), you need a more convenient, automated approach to deploy them. A manual
deployment process such as XCOPY will not work due to the magnitude of the work involved.
However by using a sophisticated installer technology such as Windows Installer, you can
automate the entire installation process, thereby simplifying the deployment.

14. What is difference between Server.Transfer and Response.Redirect ?


Which one will you use ?
Is there is a disadvantage on using server.Transfer

The URL is not changed .


Example if you are using Server.Transfer to redirect from page1 to page2 .
The URL will still show page1 even though it was redirected onto page2 . This will confuse the users
if they want to bookmark page2.

15. What are the steps in executing a stored procedure in .net ?.


16 . What is an Http Handler ?

HTTP handlers sit on top of IIS as a layer where you can process HTTP Requests coming in for
different file extensions instead of regular .aspx extensions

Example : ItemPage.ashx , browsepage.ashx

To implement a HTTP handlers there are 2 steps

1. Implement a class implementing IHttpHandler


Here implement Process Request Method and Is Reusable Property .
2. Register the class in Web.config
Like this
<httpHandlers>
<add verb="*" path="*.ash" type="Assembly Name"/>
</httpHandlers>

Let your HTTP handlers implement the following methods.

Method
Description
Name
This method is actually the heart of all http handlers .In this method you have a
Process
HTTP Context object available . You can manipulate the Response or Request
Request
Object as necessary.
This property is called to determine whether this instance of http handler can be
IsReusa
reused for fulfilling other requests of the same type. HTTP handlers can return
ble
either true or false in order to specify whether they can be reused.

Example Code :

public class NewHandler : IHttpHandler


{

public void ProcessRequest(System.Web.HttpContext context)


{

HttpResponse objResponse = context.Response ;

objResponse.Write("<html><body><h1>Hello 15Seconds Reader ") ;

Response.Write("</body></html>") ;

public bool IsReusable


{
get
{
return true;
}
}
#endregion
}
}

17. What is Http Module ?


HTTP modules are .NET components that implement the IHttpModule interface. These components
plug themselves into the ASP.NET request processing pipeline by registering themselves for certain
events. Whenever those events occur, ASP.NET invokes the interested HTTP modules so that the
modules can play with the request.

All events that you see in Global.asax file like BeginRequest , PreSendRequestContent etc
can be handled here .

There are 2 steps creating custom HTTP Modules

1. Let your class implement IHttpModule

2. Register your HTTP module in Web.config

<httpModules>
<add type="classname, assemblyname" name="modulename" />
<httpModules>

General Diagram

The following figure describes this flow.

http://www.eggheadcafe.com/tutorials/aspnet/c6526574-cd2a-40e3-beac-fe3b10a1e694/design-
patterns-for-net.aspx
Notice that during the processing of an http request, only one HTTP handler will be called, whereas
more than one HTTP modules can be called.

18 . What are Soap Extensions ?.

http://msdn2.microsoft.com/en-us/library/ms972353.aspx

19, What is difference between HTTP Get and Post?

20.

21.

22 . What is the parent object for all web forms 0


23 . What is smart navigation ?.

To avoid flickering of pages in a website we can turn on smart navigation .

It’s done by adding this line in Web.config


<Smartnavigation enabled=”true”>

24 . What is Connection pooling? What is syntax? Will you turn it on or not ?

Opening a database connection is a resource intensive and time consuming operation. Connection
pooling increases the performance of Web applications by reusing active database connections instead of
creating a new connection with every request. Connection pool manager maintains a pool of open
database connections. When a new connection requests come in, the pool manager checks if the pool
contains any unused connections and returns one if available. If all connections currently in the pool are
busy and the maximum pool size has not been reached, the new connection is created and added to the
pool. When the pool reaches its maximum size all new connection requests are being queued up until a
connection in the pool becomes available or the connection attempt times out.

Connection pooling behavior is controlled by the connection string parameters. The following are four
parameters that control most of the connection pooling behavior:

 Connect Timeout - controls the wait period in seconds when a new connection is requested, if this
timeout expires, an exception will be thrown. Default is 15 seconds.
 Max Pool Size - specifies the maximum size of your connection pool. Default is 100. Most Web
sites do not use more than 40 connections under the heaviest load but it depends on how long your
database operations take to complete.
 Min Pool Size - initial number of connections that will be added to the pool upon its creation.
Default is zero; however, you may chose to set this to a small number such as 5 if your application needs
consistent response times even after it was idle for hours. In this case the first user requests won't have
to wait for those database connections to establish.
 Pooling - controls if your connection pooling on or off. Default as you may've guessed is true.
Read on to see when you may use Pooling=false setting.
25 . What is difference between Trace and debug ?.

26 , What is ‘ Validation Group ‘ property in Validation Controls


This is used to group a set of validation controls.

27. How do you implement transactions in ASP.Net?

28. Should user input data validation occur server-side or client-side? Why?

All user input data validation should occur on the server and minimally on the client-side,
though it is a good way to reduce server load and network traffic because we can ensure that only
data of the appropriate type is submitted from the form. It is totally insecure. The user can view the
code used for validation and create a workaround for it. Secondly, the URL of the page that handles
the data is freely visible in the original form page. This will allow unscrupulous users to send data
from their own forms to your application. Client-side validation can sometimes be performed where
deemed appropriate and feasible to provide a richer, more responsive experience for the user.

29 Can the view state be encrypted?

The view state can be encrypted by setting EnableViewStateMac to true and either
modifying the <machineKey> element in Machine.config to <machineKey
validation="3DES” /> or by adding the above statement to Web.config.

30 When during the page processing cycle is ViewState available?

The view state is available after the Init() and before the Render() methods are called
during Page load.

31. Can I Use Generics in Web Services?

Unfortunately, no. Web services have to expose a WSDL-based contract. Such contracts are always
limited by the expressiveness of the message format being used. For example, HTTP-GET based web
services only support primitive types such as int or string, but not complex types like a DataSet. SOAP-
based web services are more capable, but SOAP has no ability to represent generic type parameters. As a
result, at present, you cannot define web services that rely on generic types. That said, you can define .NET
web services that rely on closed constructed generic types, for example:

[C#]

public class MyWebService


{
[WebMethod]
public List<string> GetCities()
{
List<string> cities = new List<string>();
cities.Add("New York");
cities.Add("San Francisco");
cities.Add("London");
return cities;

32 . Can I Use Generics in Enterprise Services?

Unfortunately, no. All methods and interfaces on a ServicedComponent-derived class must be COM-
visible. The COM type system is IDL, and IDL does not support type parameters.

Can I Use Generics in .NET Remoting?

Yes. You can expose generic types as remote objects, for example:

Where Does the .NET Framework Itself Use Generics?

Version 2.0 of the .NET Framework makes use of generics in three main areas: The System namespace
added a large set of static generic methods to the Array type. These methods automate and streamline
common manipulations of and interactions with arrays. The System namespace also defined a number of
generic utility delegates, which are used by the Array type and the List<T> class, but can be used freely in
other contexts as well. In addition, System provides support for nullable types. The System namespace
defines the IComparable<T> interface and the EventHandler<E> delegate, both generic reincarnations of
their non-generic predecessors. The System namespace also defines the IEquatable<T> interface, used to
check for equality of two values. The System namespace defines the ArraySegment<T> used to allocate a
strongly typed portion of an array.

The System.Collections.Generic namespace defines generic collection interfaces, collections and iterator
classes, similar to the old, non generic ones available in the System.Collections namespace. The
System.Collections.Generic namespace also defines a few generic helper classes and structures.

The System.ComponentModel namespace defines the class BindingList<T>. A binding list is used very
similar to a mere generic list, except it can fire events notifying interested parties about changes to its state.

The System.Collections.ObjectModel namespace defines a few types such as Collection<T> that can be
used as base types for custom collections.

Finally, all the types that supported IComparable in .NET 1.1 support IComparable<T> and
IEquatable<T> in .NET 2.0. This enables you to use common types for keys, such as int, string, Version,
Guid, DateTime, and so on.
http://msdn2.microsoft.com/en-us/library/aa479866.aspx

Database to Objects Link

http://www.codeproject.com/KB/database/Lightweight_DAL_in_NET_2.aspx?print=true

33. Difference between Soap Extensions and HTTP Modules.

You might be wondering how SOAP extensions differ from HTTP Modules. First, you can selectively
place SOAP extensions on certain Web methods, and ignore other ones, which is much more difficult to
do with HTTP Modules. Second, you can access the de-serialized objects in the AfterDeserialize and
BeforeSerialize stages, but you cannot access these objects in HTTP Modules; HTTP Modules allows you
to see only the SoapMessage object, and little else. Third, it is easier to modify values before and after
the Web method has processed the request by using extensions instead of HTTP Modules. HTTP
Modules still serve a purpose however. It is just a matter of selecting the right tool for the job, so it's
important to understand when to use each tool.

34. What is Diffgram in ADO.NET? When do we use Diffgram?

A DiffGram is an XML format. It is used to identify current and original versions of data
elements. A DataSet may use a DiffGram format to load and persist the contents, and further to
serialize its contents for porting across a network connection. Whenever a DataSet is written as
a DiffGram, the DataSet populates the DiffGram with all the important information to accurately
recreate the contents. Note that schema of the DataSet is not recreated. This includes column
values from both the Current and the Original row versions, row error information, and row
order.

Optimization – Design Patterns

1. Managed code optimization

http://msdn2.microsoft.com/en-us/library/ms998547.aspx

 Optimize assembly and class design.


 Maximize garbage collection (GC) efficiency in your application.

 Use Finalize and Dispose properly.


 Minimize boxing overhead.

 Evaluate the use of reflection and late binding.


 Optimize your exception handling code.

 Make efficient use of iterating and looping constructs.


 Optimize string concatenation.

 Evaluate and choose the most appropriate collection type.


 Avoid common threading mistakes.

 Make asynchronous calls effectively and efficiently.


 Develop efficient locking and synchronization strategies.

 Reduce your application's working set.


 Apply performance considerations to code access security.

2. Explaining Design patterns

5.2.1 Pattern Name and Classification


The pattern's name conveys the essence of the pattern succinctly. A good name is vital,
because it will become part of your design vocabulary. The pattern's classification reflects the
scheme introduced in the next section.
5.2.2 Intent
A short statement that answers the following questions: What does the design pattern do?
What is its rationale and intent? What particular design issue or problem does it address?
5.2.3 Also Known As
Other well-known names for the pattern, if any.
5.2.4 Motivation
An example describing the function and use of the pattern.
5.2.5 Applicability
What are the situations where this design pattern can be applied? How can you recognize
these situations?
5.2.6 Sequence of Events
A step by step description of how the pattern executes. This should describe the high level
steps, not implementation specific details. Take particular care to document the sequence of
HTTP requests.
5.2.7 Participants
The patterns and / or classes participating in the design pattern and their responsibilities.
5.2.8 Collaborations
How the participants collaborate to carry out their responsibilities.
5.2.9 Consequences
How does the pattern support its objectives? What are the trade-offs and results of using the
pattern?
5.2.10 Implementation
What pitfalls, hints, or techniques should you be aware of when implementing the pattern?
Are there language-specific issues?
5.2.11 Sample Code
Code fragments that illustrate how you might implement the pattern in PHP, Java or your
favorite web programming language.
5.2.12 Related Patterns
What design patterns are closely related to this one? What are the important differences?
With which other patterns should this one be used?

3. What are design Patterns ? What design patterns did you use ?.

Ans : Design patterns are specifics about how objects will be created and persisted and how
they will communicate with each other . Design patterns help in effective development of code ,
because they can help optimize how objects will be utilized.

Design patterns Available are of three types


3. Creational Patterns 2. Structural Patterns 3.Behavioural patterns

I have used Factory method pattern , Abstract Factory Method Pattern , Observer
Pattern , State Pattern and sometimes Singleton pattern .
Look at this link

http://www.developer.com/design/article.php/10925_1502691_1

4. What is RUP and how did you use it .

RUP is rational unified process and it a methodology to develop applications . Advantage is you
have system development with all steps being documented for better maintenance later on .

The 4 phases in RUP are

1. Inception
2. Elaboration
3. Construction
4. Transition

There are standard templates that can be used in different phases for documentation . These
are called articrafts.

Inception involves Requirement Gathering and Requirement Analysis , Use Case Diagrams , Use
Case Specifications .

Elaboration involves Class Diagrams , Component diagrams , Sequence Diagrams

Construction phase is actual Code development stage .

Transition is moving code onto testing and Production . . It involves Component diagrams and
System Hardware diagrams .
5. What is difference between Aggregation and composition ?.

The instance of aggregated class can be shared by many other classes. While those classes are
deleted, the instance of aggregated class won't be deleted.
In the other hand, the instance of composited class can only be used by one other class. While that
class is deleted. The composited class will also be deleted
Composition
A car is composed of Chassis, Engine and Wheels without all these it is not really a car.

Aggregation
A car is aggregated with a spoiler and go-faster strips, without these it is still a car.
Database

4. What is a cursor ? Types of cursor

[ STATIC | KEYSET | DYNAMIC | FAST_FORWARD ]

STATIC
Defines a cursor that makes a temporary copy of the data to be used by the cursor. All requests to the
cursor are answered from this temporary table in tempdb; therefore, modifications made to base tables
are not reflected in the data returned by fetches made to this cursor, and this cursor does not allow
modifications.

KEYSET
Specifies that the membership and order of rows in the cursor are fixed when the cursor is opened.
The set of keys that uniquely identify the rows is built into a table in tempdb known as the keyset.

Note:

If the query references at least one table without a unique index, the keyset cursor is converted to
a static cursor.
Changes to nonkey values in the base tables, either made by the cursor owner or committed by other
users, are visible as the owner scrolls around the cursor. Inserts made by other users are not visible
(inserts cannot be made through a Transact-SQL server cursor). If a row is deleted, an attempt to fetch
the row returns an @@FETCH_STATUS of -2. Updates of key values from outside the cursor resemble a
delete of the old row followed by an insert of the new row. The row with the new values is not visible, and
attempts to fetch the row with the old values return an @@FETCH_STATUS of -2. The new values are
visible if the update is done through the cursor by specifying the WHERE CURRENT OF clause.

DYNAMIC
Defines a cursor that reflects all data changes made to the rows in its result set as you scroll around
the cursor. The data values, order, and membership of the rows can change on each fetch. The ABSOLUTE
fetch option is not supported with dynamic cursors.

FAST_FORWARD
Specifies a FORWARD_ONLY, READ_ONLY cursor with performance optimizations enabled.
FAST_FORWARD cannot be specified if SCROLL or FOR_UPDATE is also specified.

5. Write a sample cursor.


http://msdn2.microsoft.com/en-us/library/ms180169.aspx

6. How will you improve a ill performing store proc


http://www.microsoft.com/technet/prodtechnol/sql/2005/tsprfprb.mspx
 Avoid table scans by specifying correct joins and adequate Where clause and its better to
have joins on indexed columns.
 Create indexes if not there
 Introduce de-normalization if necessary.
 Return only necessary data , write specific stored procedures if necessary.
 Use SetNoCount On , NOLOCK
 Do not use Cursors
 Reduce use of table variables and Local temporary table
 In .Net
 Cache Data
 Use connection pooling
 Use MARS
 Don’t use Data Sets
 Cache Look up Data and perform in memory selects.
 Implement Paging in result sets ( preserve the last ID in memory and in next select ,get
results greater than this ID ).

7. What is sql Profiler


8. Types of isolation and locking in sqlserver
http://www.mssqlcity.com/Articles/Adm/SQL70Locks.htm

9. What is execution plan


10. What are the types of triggers
http://msdn.microsoft.com/en-us/library/ms178134.aspx DML trigger only

11. What is a ‘instead of’ trigger.


INSTEAD OF
Specifies that the DML trigger is executed instead of the triggering SQL statement, therefore,
overriding the actions of the triggering statements. INSTEAD OF cannot be specified for DDL triggers

At most, one INSTEAD OF trigger per INSERT, UPDATE, or DELETE statement can be defined on a table
or view. However, you can define views on views where each view has its own INSTEAD OF trigger.

INSTEAD OF triggers are not allowed on updatable views that use WITH CHECK OPTION. SQL Server
raises an error when an INSTEAD OF trigger is added to an updatable view WITH CHECK OPTION specified.
The user must remove that option by using ALTER VIEW before defining the INSTEAD OF trigger.

12. What are indexes? Clustered Indexes, Non-clustered index.


13. Difference between Outer Join and Inner Join
An inner join will return a row only if there is a joined row with data in both tables- being joined. An
outer join will return a row even if the other table doesn't have a corresponding row

14. Write a sample trigger for Audit table


15. What is SQLXML

16. How will you out Xml from your stored procedure?
17. How do you debug a stored procedure?
18. What is difference between trigger and stored procedures?
The two main differences between a SP and trigger is:
1. Triggers are fired implicitly where there a change in the database.
Where as SP are fired only when a call is made to it.
2. We can write a stored procedure within a trigger but we cannot write a trigger within a stored
procedure
19. What is difference between functions and stored procedures?
Difference between Function and Stored Procedure?
UDF can be used in the SQL statements anywhere in the WHERE/HAVING/SELECT section where as
Stored procedures cannot be.
UDFs that return tables can be treated as another rowset. This can be used in Joins’ with other tables.
Inline UDF’s can be though of as views that take parameters and can be used in Joins and other Rowset
operations

20. What is the difference between a HAVING CLAUSE and a WHERE CLAUSE?
Specifies a search condition for a group or an aggregate. HAVING can be used only with the SELECT
statement. HAVING is typically used in a GROUP BY clause. When GROUP BY is not used, HAVING
behaves like a WHERE clause. Having Clause is basically used only with the GROUP BY function in a
query. WHERE Clause is applied to each row before they are part of the GROUP BY function in a query.
HAVING criteria is applied after the grouping of rows has occurred

21. What kind of User-Defined Functions can be created?


There are three types of User-Defined functions in SQL Server 2000 and they are Scalar, Inline Table-
Valued and Multi-statement Table-valued.

Scalar User-Defined Function


A Scalar user-defined function returns one of the scalar data types. Text, ntext, image and timestamp
data types are not supported. These are the type of user-defined functions that most developers are
used to in other programming languages. You pass in 0 to many parameters and you get a return value.

Inline Table-Value User-Defined Function


An Inline Table-Value user-defined function returns a table data type and is an exceptional alternative to
a view as the user-defined function can pass parameters into a T-SQL select command and in essence
provide us with a parameterized, non-updateable view of the underlying tables.

Multi-statement Table-Value User-Defined Function


A Multi-Statement Table-Value user-defined function returns a table and is also an exceptional
alternative to a view as the function can support multiple T-SQL statements to build the final result
where the view is limited to a single SELECT statement. Also, the ability to pass parameters into a T-SQL
select command or a group of them gives us the capability to in essence create a parameterized, non-
updateable view of the data in the underlying tables. Within the create function command you must
define the table structure that is being returned. After creating this type of user-defined function, It can
be used in the FROM clause of a T-SQL command unlike the behavior found when using a stored
procedure which can also return record sets

22. What is the STUFF function and how does it differ from the REPLACE function?
STUFF function to overwrite existing characters. Using this syntax, STUFF(string_expression, start,
length, replacement_characters), string_expression is the string that will have characters substituted,
start is the starting position, length is the number of characters in the string that are substituted, and
replacement_characters are the new characters interjected into the string.
REPLACE function to replace existing characters of all occurrences. Using this syntax
REPLACE(string_expression, search_string, replacement_string), where every incidence of search_string
found in the string_expression will be replaced with replacement_string.

23. Describe Self Join and cross Join?

Self Join
This is a particular case when one table joins to itself, with one or two aliases to avoid confusion. A self
join can be of any type, as long as the joined tables are the same. A self join is rather unique in that it
involves a relationship with only one table. The common example is when company has a hierarchal
reporting structure whereby one member of staff reports to another.

Example of Self Join :

Using a self-join to find the products supplied by multiple vendors

The following example uses a self-join to find the products that are supplied by more than one vendor

USE AdventureWorks;

GO

SELECT DISTINCT pv1.ProductID, pv1.VendorID

FROM Purchasing.ProductVendor pv1

INNER JOIN Purchasing.ProductVendor pv2

ON pv1.ProductID = pv2.ProductID

AND pv1.VendorID <> pv2.VendorID

ORDER BY pv1.ProductID

Using Left Outer Joins


Consider a join of the Product table and the ProductReview table on their ProductID columns. The
results show only the products for which reviews have been written.

To include all products, regardless of whether a review has been written for one, use an ISO left outer join.
The following is the query:

Copy Code
USE AdventureWorks;

GO

SELECT p.Name, pr.ProductReviewID

FROM Production.Product p
LEFT OUTER JOIN Production.ProductReview pr

ON p.ProductID = pr.ProductID

The LEFT OUTER JOIN includes all rows in the Product table in the results, whether or not there is a match
on the ProductID column in the ProductReview table. Notice that in the results where there is no matching
product review ID for a product, the row contains a null value in the ProductReviewID column

Cross Join
A cross join that does not have a WHERE clause produces the Cartesian product of the tables involved in
the join. The size of a Cartesian product result set is the number of rows in the first table multiplied by
the number of rows in the second table. The common example is when company wants to combine each
product with a pricing table to analyze each product at each price

Good link on query fundamentals

http://msdn.microsoft.com/en-us/library/ms190659.aspx

24. What is Lock Starvation?

Lock starvation occurs when read transactions can monopolize a table or page, forcing
a write transaction to wait indefinitely

25. Examine the Execution Plan


After you confirm that the correct indexes exist, and that no hints are restricting the optimizer's ability
to generate an efficient plan, you can examine the query execution plan. You can use any of the following
methods to view the execution plan for a query:
SQL Profiler

If you captured the MISC:Execution Plan event in SQL Profiler, it will occur immediately before the
StmtCompleted event for the query for the particular system process ID (SPID).
SQL Query Analyzer: Graphical Showplan

With the query selected in the query window, click the Query menu, and then click Display Estimated
Execution Plan.

NOTE: If the stored procedure or batch creates and references temporary tables, you must use a SET
STATISTICS PROFILE ON statement or explicitly create the temporary tables before you display the
execution plan.
SHOWPLAN_ALL and SHOWPLAN_TEXT

To receive a text version of the estimated execution plan, you can use the SET SHOWPLAN_ALL and SET
SHOWPLAN_TEXT options. See the "SET SHOWPLAN_ALL (T-SQL)" and "SET SHOWPLAN_TEXT (T-SQL)"
topics in SQL Server 7.0 Books Online for more details.

NOTE: If the stored procedure or batch creates and references temporary tables, you must use the SET
STATISTICS PROFILE ON option or explicitly create the temporary tables before displaying the execution
plan.
STATISTICS PROFILE

When you are displaying the estimated execution plan, either graphically or by using SHOWPLAN, the
query is not actually executed. Therefore, if you create temporary tables in a batch or a stored procedure,
you cannot display the estimated execution plans because the temporary tables will not exist.
STATISTICS PROFILE executes the query first, and then displays the actual execution plan. See the "SET
STATISTICS PROFILE (T-SQL)" topic in SQL Server 7.0 Books Online for more details. When it is running
in SQL Query Analyzer, this appears in graphical format on the Execution Plan tab in the results pane.

26. How to improve slow performing Queries?

http://www.mssqlcity.com/Tips/tipTSQL.htm

27. Improving ADO.net performance

http://msdn2.microsoft.com/en-us/library/ms998569.aspx
Implement Paging in result sets .
The client needs to maintain the lastxxxxID value and increment or decrement it by the chosen page
size between successive calls.

29 . SQL for removing duplicate rows

SELECT col1, col2, count (*) FROM t1 GROUP BY col1, col2 HAVING
count (*) > 1

30. What’s new in sql server 2008?

1. Sparse Columns and Column Sets


2. Merge Statement
3. Table-Valued Parameters
4. T-SQL Row Constructor

Sparse Columns and Column Sets

Sparse columns are ordinary columns that have an optimized storage format for null values. Consider using
sparse columns when at least 20 percent to 40 percent of the values in a column will be NULL. For more
information, see Using Sparse Columns.

MERGE Statement

This new Transact-SQL statement performs INSERT, UPDATE, or DELETE operations on a target table based on
the results of a join with a source table. The syntax allows you to join a data source with a target table or view,
and then perform multiple actions based on the results of that join. For more information, see MERGE (Transact-
SQL).

How MERGE works


The MERGE statement basically works as separate insert, update, and delete statements all within the same statement.
You specify a "Source" record set and a "Target" table, and the join between the two. You then specify the type of data
modification that is to occur when the records between the two data are matched or are not matched. MERGE is very
useful, especially when it comes to loading data warehouse tables, which can be very large and require specific actions to
be taken when rows are or are not present

Table-Valued Parameters

The Database Engine introduces a new parameter type that can reference user-defined table types. Table-
valued parameters can send multiple rows of data to a SQL Server statement or routine (such as a stored
procedure or function) without creating a temporary table. For more information, see Table-Valued Parameters
(Database Engine).

Transact-SQL Row Constructors

Transact-SQL is enhanced to allow multiple value inserts within a single INSERT statement. For more
information, see INSERT (Transact-SQL).

Link to what’s New : http://msdn.microsoft.com/en-us/library/bb510411.aspx

31. What is the difference between UNION and UNION ALL?


UNION statement eliminates duplicate rows whereas UNION ALL statement includes duplicate rows. UNION
statement can be used to combine any number of queries whereas UNION ALL statement can be used to combine a
maximum of two queries. UNION statement cannot be used with aggregate functions whereas UNION ALL statement
can be used with aggregate functions.

32. What is difference between Delete and Truncate?

Truncate

 Truncate command is used to remove all rows of the column.


 The removed records are not recorded in the transaction log.
 It is the fast way to remove all the records from the table.
 The records once removed can’t be rolled back.
 It can’t activate trigger.
 It resets the identity of the column.

Delete

Delete command removes records one at a time and logs into the transaction log.
It can be used with or without where clause.
The records can be rolled back.
It activates trigger.
It doesn’t reset the identity of the column.

33 . What is a deadlock and what is a live lock?


ANSWER - When two processes, each having a lock on one piece of data, attempt to acquire a lock on the
other's piece. Each process would wait indefinitely for the other to release the lock unless one of the user processes
is terminated. SQL Server detects deadlocks and terminates one user's process.          
A livelock is one, where a  request for an exclusive lock is repeatedly denied because a series of overlapping
shared locks keeps interfering. A live lock also occurs when read transactions monopolize a table or page, forcing a
write transaction to wait indefinitely.
 
34. What is blocking?          
ANSWER - When one connection from an application holds a lock and a second connection requires a
conflicting lock type

.NET 3.5

Implicitly typed local variables.


Anonymous Types
Automatic Properties, Object Initializers, and Collection Initializers
Extension Methods
Extension methods allow developers to add new methods to the public contract of an existing
CLR type

Implicitly Typed Local Variables

 Local variables can be declared as type ‘var’ which means compiler to determine the
actual type based on the data by which its is initialized.
 var i = 10; // i is created of type int
 var name = “MyName” ; // name is created of type string
 can only be used when declared and initialized in same statement.
 Cannot be initialized to null.
 Cannot be used as class members.
 Mostly used to store anonymous types as in LINQ based programming.

Object & Collection Initializers

 Allow assigning values to any accessible members or properties of a type at the time
of initiation without invoking the constructor with parameters.
 The default constructor gets executed before assigning the values.
 E.g. Coordinate c1 = new Coordinate {x=1 , y=2};
 Used in LINQ query expressions along with anonymous types.
 Collection Initializers use Object Initializers to specify multiple elements of collection
without calling Add method multiple times.

Extension Methods

 Allows adding new methods to existing types without modifying the existing type.
 Are special kind of static methods but are called as if they are instance methods.
 The first parameter passed to Extension methods specifies to which type they
operate on preceded by ‘this’ keyword.
 They cannot access the private variables of type which they are extending.
 Extension Methods need to defined in a non-nested and non-generic static class.
 Instance methods take priority over extension methods in case they have same
signature.

Anonymous Types

 Are of class types which can have only public read-only properties as their members.
No other class members like methods are allowed.
 They are of reference types and are derived from ‘Object’ class.
 Internally compiler gives them the name but it’s not accessible by application code.
 They have a method scope.
 Can be initiated directly e.g. new { property1=1, property2=”Hello World”};

Lambda Expressions

 Very similar to anonymous methods introduced in C# 2.0.


 It’s an inline expression or statement block which can be used to pass arguments to
method call or assign value to delegate.
 All lambda expression use lambda operator => where the left side denotes result
and right contains statement block or expression.

Auto-Implemented Properties

 Helps in simplifying property declaration in cases where there is no custom logic


required in accessors methods.
 E.g. public int Price {get; set;};
 Internally compiler creates an anonymous field for assigning values.

WCF

1. What are Bindings

Bindings specify how a Windows Communication Foundation (WCF) service endpoint


communicates with other endpoints. At its most basic, a binding must specify the transport (for
example, HTTP or TCP) to use. You can also set other characteristics, such as security and transaction
support, through bindings.

Bindings define protocols, Encoding and Transport

The information in a binding can be complex, and some settings may not be compatible with others. For
this reason, WCF includes a set of system-provided bindings. These bindings are designed to cover most
application requirements. The following classes represent some examples of system-provided bindings:
 BasicHttpBinding: An HTTP protocol binding suitable for connecting to Web services that conforms
to the WS-I Basic Profile specification (for example, ASP.NET Web services-based services).
 WSHttpBinding: An interoperable binding suitable for connecting to endpoints that conform to the
WS-* protocols.
 NetNamedPipeBinding: Uses the .NET Framework to connect to other WCF endpoints on the same
machine.
 NetMsmqBinding: Uses the .NET Framework to create queued message connections with other WCF
endpoints.
The binding specifies the set of protocols for communicating with the application. The following table
lists the system-provided bindings that represent common options.

Name Purpose

BasicHttpBinding Interoperability with Web services and clients supporting the WS-
BasicProfile 1.1 and Basic Security Profile 1.0.

WSHttpBinding Interoperability with Web services and clients that support the WS-*
protocols over HTTP.

WSDualHttpBinding Duplex HTTP communication, by which the receiver of an initial message


does not reply directly to the initial sender, but may transmit any number of
responses over a period of time by using HTTP in conformity with WS-*
protocols.

WSFederationBindin HTTP communication, in which access to the resources of a service can


g be controlled based on credentials issued by an explicitly-identified
credential provider.

NetTcpBinding Secure, reliable, high-performance communication between WCF


software entities across a network.

NetNamedPipeBindi Secure, reliable, high-performance communication between WCF


ng software entities on the same machine.

NetMsmqBinding Communication between WCF software entities by using MSMQ.

MsmqIntegrationBin Communication between a WCF software entity and another software


ding entity by using MSMQ.

NetPeerTcpBinding Communication between WCF software entities by using Windows Peer-


to-Peer Networking.

2. What is WS*
WS* is webservices interoperability specifications of which WCF supports WS-Addressing ( in soap
header ), WS-MetadataExchange, WS-Policy, and WS-Security Policy, WS-Security, WS-Trust,
and WS-Secure Conversation , WS-Reliable Messaging

 What tools are used for the debugging?

It’s in built in VS2008.


Limitations on Stepping Into a Service
To step into a service from client applications that you are debugging, the following conditions must
be met:
The client must call the service by using a synchronous client object.
 The contract operation cannot be one-way.
 If the server is asynchronous, you cannot view the full call stack while you are executing
code inside the service.

To Step Back to client you have to manually attach process again once inside Service.
For Self Hosting Service, you need to attach process.

 Is it possible to log the messages on the service side? On the client side? How to switch on the
logging?

Windows Communication Foundation (WCF) does not log messages by default. To activate message
logging, you must add a trace listener to the System.ServiceModel.MessageLogging trace source, and
set attributes for the <messagelogging> element in the configuration file.

http://msdn.microsoft.com/en-us/library/ms730064.aspx

system.serviceModel>
<diagnostics>
<messageLogging
logEntireMessage="true"
logMalformedMessages="false"
logMessagesAtServiceLevel="true"
logMessagesAtTransportLevel="false"
maxMessagesToLog="3000"
maxSizeOfMessageToLog="2000"/>
</diagnostics>
</system.serviceModel>

 What the difference between the service messages and transport messages?
 Transport and Message security differences.

In brief, message security differs from transport security by encapsulating the security credentials
and claims with every message along with any message protection (signing or encryption). Applying the
security directly to the message by modifying its content allows the secured message to be self-
containing with respect to the security aspects. This enables some scenarios that are not possible when
transport security is used.
http://msdn.microsoft.com/en-us/library/ms733137.aspx

 How to set security modes in WCF


http://msdn.microsoft.com/en-us/library/ms731884.aspx
 What the difference between the SoapUi utility and the VS2008 test functionality used for the
Web-service testing?

Config files:

 Enumerate the high level elements of the <system.serviceModel> section.

<service behaviorConfiguration="DataDeliveryService.EmailDeliveryBehavior"
name="DataDeliveryService.EmailDelivery">
<endpoint address="" binding="wsHttpBinding"
contract="DataDeliveryService.IEmailDelivery">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding"
contract="IMetadataExchange" />
<behaviors>
<serviceBehaviors>
</service>
<behavior name="DataDeliveryService.DataEmailDeliveryBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>

</system.serviceModel>

 What is the name attribute of the <service> element?

This is the name of the actual service implementing class.

 What is the contract attribute of the <endpoint> element?

This is name of the Interface defining the service contract.

 What is the difference in the attributes the binding and the bindingConfiguration of the
<endpoint> element?
Binding is the type of protocol binding that is basichtttpBinding , netBinding etc.
bindingConfiguration
bindingConfiguration : enables you to configure settings for message encoding and security mode
for the end point.

<bindings>
<basicHttpBinding>
<binding name=”basicConfig” messageEncoding=”Mtom”>
<security mode=”Transport”/>
</binding>
</basicHttpBinding>

 What is the difference in the attributes the binding and the bindingName of the <endpoint>
element?

<endpoint configurationName="myClient"
address="http://localhost:8080/people"
bindingSectionName="basicProfileBinding"
contractType="SelfHostedService.IPeople"/>
<wsProfileBinding>

<binding configurationName="MyWsBinding"
securityMode="WSSecurityOverHttp">
<wsSecurity authenticationMode="Windows"
protectionLevel="EncryptAndSign"/>
</binding>
</wsProfileBinding>

 Are the addresses, the bindings, the contracts unique between services?

Yes they are.

 Bindings Detailed ( Different types, channel Stack etc)


http://msdn.microsoft.com/en-us/magazine/cc163394.aspx

An end point is an abstraction provided to configure ChannelStack.


Just as its name implies, the channel stack is a stack of channel components that all messages pass
through during runtime processing. The bottom-most component is the transport channel.

 How are dependent the app.config and the machine.config files?


 What is MTOM ?
 Differences between XMLSerializer and DataContractSerializer
http://msdn.microsoft.com/en-us/library/aa738737.aspx

How to make WCF multiThread compatible


[ServiceBehavior(ConcurrencyMode=ConcurrencyMode.Multiple]
public class DerivativesCalculatorServiceType: IDerivativesCalculator
 Difference between XmlWebService and WCF
Web Service does not support MultThreading , Singleton
Different types of bindings available in WCF
Serialization is XML Serialization
Web Service can only be hosted in IIS, WCF can self host.
 How to configure WCF for windows authentication, Impersonation
 What are security modes available.

Enumerate the high level of the <bindings> and <binding> element.


<bindings>

<basicProfileBinding>
<binding configurationName="MyBpBinding"
securityMode="HttpAuthenticationOverHttps">
<httpAuthentication scheme="Digest" realm="example.com"/>
</binding>
</basicProfileBinding>
<wsProfileBinding>
<binding configurationName="MyWsBinding"
securityMode="WSSecurityOverHttp">
<wsSecurity authenticationMode="Windows"
protectionLevel="EncryptAndSign"/>
</binding>
</wsProfileBinding>
</bindings>

Service contracts:
Enumerate three message exchange patterns in the WCF model. 
This gives you a total of six message exchange patterns to choose from:

 Datagram
 Request-response
 Duplex
 Datagram with sessions
 Request-response with sessions
 Duplex with sessions

 If the service operation returns void, what is the message exchange pattern? Is the client waiting
the operation to complete in this case?
 What the difference between the request-response pattern and the duplex pattern?
 In the duplex communication is the server set up the client address or the client set it up? This
address is used by the server to sent the data back to the client.
Fault contracts:

 In what order do we have to catch the exceptions: TimoutException, FaultException,


FaultException<MyException>, CommunicationException?

Sessions, Instancing, and Concurrency:

 Why we need the sessions?


 Where session stores the session information? What is the general store for the WCF session?

WCF provides support for sessions where a key is negotiated between the client and service once
for the duration of the connection. In addition, the client’s identity in terms of claims, is
calculated upon the creation of the session. The contents of the session key and the client's
identity are stored in a SecurityContextToken (SCT).

It also can be maintained with cookies

 What is it a correlation? What parameters are mandatory for the correlation?


 Who initiate the WCF session, service or a client? 

Client
 What order are processed the delivered messages in during the session?

Messages delivered during a session are processed in the order in which they are received

 How can we create a singleton service?


 Is the SessionMode.NotAllowed increase the performance?
 What is it the Terminating and Initiating of the OperationContract? Could be the
OperationContract Terminating and Initiating at the same time?

Yes it can be done , but here SessionMode must be set to required.


 Asynchronous call in wcf

[System.ServiceModel.OperationContractAttribute( AsyncPattern=true)]
 How does a client start a session?
Services do not start sessions with clients. In WCF client applications, a direct relationship exists
between the lifetime of the session-based channel and the lifetime of the session itself. As such,
clients create new sessions by creating new session-based channels and tear down existing
sessions by closing session-based channels gracefully. A client starts a session with a service
endpoint by calling one of the following:

 System.ServiceModel.ICommunicationObject.Open on the channel returned by a call to


System.ServiceModel.ChannelFactory.CreateChannel.
 System.ServiceModel.ClientBase.Open on the WCF client object generated by the ServiceModel
Metadata Utility Tool (Svcutil.exe).
 An initiating operation on either type of WCF client object (by default, all operations are
initiating). When the first operation is called, the WCF client object automatically opens the channel and
initiates a session.
Typically a client ends a session with a service endpoint by calling one of the following:

 System.ServiceModel.ICommunicationObject.Close on the channel returned by a call to


System.ServiceModel.ChannelFactory.CreateChannel.
 System.ServiceModel.ClientBase.Close on the WCF client object generated by Svcutil.exe.
 A terminating operation on either type of WCF client object (by default, no operations are
terminating; the contract must explicitly specify a terminating operation). When the first operation is
called, the WCF client object automatically opens the channel and initiates a session

http://msdn.microsoft.com/en-us/library/ms733040.aspx

 Types of InstanceContext
PerCall
PerSession ( default )
Single ( this is singleton)
 Types of Concurreny modes ( this can go along with instancing)
single
Multiple
Re-entrant
 Difference between WCF and ASP.net sessions

:
 ASP.NET sessions are always server-initiated.
 ASP.NET sessions are implicitly unordered.
 ASP.NET sessions provide a general data storage mechanism across requests.
 What types of bindings support sessions?

When the runtime loads an endpoint configured with a Session=true contract, it validates that the
specified binding can actually provide the required session support (bindings that support sessions
include WSHttpBinding, WSDualHttpBinding, NetTcpBinding, NetNamedPipeBinding, + custom). If
the binding doesn't support sessions, the runtime reports an error and the service won't load.
 Instancing and concurrency are defined in Service Behaviour attribute
 Session Mode are defined in Service Contract attribute
 Implementing callback in wcf

The client also has to facilitate hosting the callback object. Not all bindings support callback
operations. Because of its connectionless nature, HTTP can't be used for callbacks and therefore
you can't use callbacks over BasicHttpBinding or WSHttpBinding. Windows Communication
Foundation offers callback support for NetTcpBinding and NetNamedPipeBinding because the
underlying transport is bidirectional. To support callbacks over HTTP, Windows Communication
Foundation provides WSDualHttpBinding, which actually sets up two HTTP channels: one for the
calls from the client to the service and one for the calls from the service to the client.
A service contract can have at most one callback contract. Once the callback contract is
defined, the clients are required to support the callback and also to provide the callback endpoint
to the service in every call. The ServiceContract attribute offers the CallbackContract property of
the type Type. You need to set it to the callback contract type and provide the definition of the
callback contract, as shown here:

http://msdn.microsoft.com/en-us/magazine/cc163537.aspx

Transports:

 How to enable streaming?


 What types of the operation contract parameters could be streamed?
 Do we have to change the maxReceivedMessageSize parameter to use streaming?
 What types of the quota have the WCF transports?
 What is it the Teredo? How we can use it?
 What is it the Net.TCP Port Sharing? How we can use it?

Queues and Reliable Sessions:

 What types of reliable messaging are implemented in the WCF?


 What is it the Reliable session?
 Is the Reliable session asynchronous?
 Is the Reliable session tied to the transport session?
 Can the Reliable session be established with the one-way, or the request-reply, or with the
duplex, or with all those exchange message patterns?

Ans : RM is not supported with one way .

 What the system-provided bindings have the support for the Reliable session and what of those
bindings are these options enabled by default?
 Reliable sessions in Windows Communication Foundation (WCF) use a transfer window. What is
it the Transfer window? What does it means for the sender, for the receiver? How is it depend of
the latency?
 What is it the Transmission queue and the Target queue? What the defference? 
 What is it the Dead-letter queue and the Poison queue? What the defference? 
 Can we use the two-way service opertions with queued binding?
 Could the ExactlyOnce property of the netMsmqBinding be true if the queue is not
transactional? 
 When is the MsmqIntegrationBinding or the NetMsmqBinding used?

NetMsmqBinding Communication between WCF software entities by using MSMQ.


MsmqIntegrationBin Communication between a WCF software entity and another
ding software entity by using MSMQ.
 Is there an error in the Msmq address the "net.msmq://MyHost/private$/MyQueue"?
 Can we use the public queues without the Windows domain? If cannot then why?
 Is the MsmqIntegrationBinding used the msmq.formatname scheme or the net.msmq scheme?

Hosting:

 What hosting functionality is unique for the Vista OS?


 Do we have to use the relative addresses when hosting in the IIS or the absolute addresses?
Why?
 Could the IIS-hosted WCF service make use of HTTP transport security if the IIS virtual derectory
that contains the service is not support it?

What is datacontractserializer

difference between xmlserializer and datacontractserializer

1. What is MessageParameterAttribute

To isolate .NET parameter names from contract names, you can use the MessageParameterAttribute
attribute, and use the Name property to set the contract name. For example,

[OperationContract]

public float GetAirfare(

[MessageParameter(Name=”fromCity”)] string originCity,

[MessageParemeter(Name=”toCity”)] string destinationCity);

Messagecontract

[ServiceContract]

public interface IAirfareQuoteService

[OperationContract]

GetAirfareResponse GetAirfare(GetAirfareRequest request);

}
[MessageContract]

public class GetAirfareRequest

[MessageHeader] public DateTime date;

[MessageBodyMember] public Itinerary itinerary;

FaultContractAttribute attribute

[OperationContract]

[FaultContract(typeof(ItineraryNotAvailableFault))]

float GetAirfare(string fromCity, string toCity, DateTime date);

//code omitted…

[DataContract]

public class ItineraryNotAvailableFault

[DataMember]

public bool IsAlternativeDateAvailable;

[DataMember]

public DateTime alternativeSuggestedDate;


}

ServiceKnownTypeAttribute attribute

Using Derived Types

You may want to use a base type in an operation or a message contract, and then use a derived type
when actually invoking the operation. In this case, you must use either the ServiceKnownTypeAttribute
attribute or some alternative mechanism to allow the use of derived types. Consider the following
operation.

[OperationContract]

public bool IsLibraryItemAvailable(LibraryItem item);

Assume that two types, Book and Magazine, derive from LibraryItem. To use these types in the
IsLibraryItemAvailable operation, you can change the operation as follows:

[OperationContract]

[ServiceKnownType(typeof(Book))]

[ServiceKnownType(typeof(Magazine))]

public bool IsLibraryItemAvailable(LibraryItem item);

How is versioning done for Services


Sessions, Instancing, and Concurrency

A session is a correlation of all messages sent between two endpoints. Instancing refers to
controlling the lifetime of user-defined service objects and their related InstanceContext objects.
Concurrency is the term given to the control of the number of threads executing in an InstanceContext
at the same time.

http://msdn.microsoft.com/en-us/library/ms731193.aspx

Configuration files.

The <services> Element

The services element contains the specifications for all services the application hosts.

<services> element reference

The <service> Element

Each service has these attributes:

 name. Specifies the type that provides an implementation of a service contract. This
is a fully qualified name (namespace and type name).
 behaviorConfiguration. Specifies the name of one of the behavior elements found
in the behaviors element. The specified behavior governs actions such as whether the
service allows impersonation.
 <service> element reference
The <endpoint> Element

Each endpoint requires an address, a binding, and a contract, which are represented by the
following attributes:

 address. Specifies the service's Uniform Resource Identifier (URI), which can be an
absolute address or one that is given relative to the base address of the service. If set to
an empty string, it indicates that the endpoint is available at the base address that is
specified when creating the ServiceHost for the service.
 binding. Typically specifies a system-provided binding like WsHttpBinding, but can
also specify a user-defined binding. The binding specified determines the type of
transport, security and encoding used, and whether reliable sessions, transactions, or
streaming is supported or enabled.
 bindingConfiguration. If the default values of a binding must be modified, this can
be done by configuring the appropriate binding element in the bindings element. This
attribute should be given the same value as the name attribute of the binding element
that is used to change the defaults.
 contract. Specifies the interface that defines the contract. This is the interface
implemented in the common language runtime (CLR) type specified by the name
attribute of the service element.
 <endpoint> element reference
The <bindings> Element

The bindings element contains the specifications for all bindings that can be used by any
endpoint defined in any service.

<bindings> element reference

The <binding> Element

The binding elements contained in the bindings element can be either one of the system-
provided bindings (see System-Provided Bindings) or a custom binding (see Custom Bindings).
The binding element has a name attribute that correlates the binding with the endpoint
specified in the bindingConfiguration attribute of the endpoint element.

For more information about configuring services and clients, see Configuring Windows
Communication Foundation Applications.

<binding> element reference

The <behaviors> Element

This is a container element for the behavior elements that define the behaviors for a service.

<behaviors> element reference

The <behavior> Element

Each behavior element is identified by a name attribute and provides either a system-
provided behavior, such as <throttling>, or a custom behavior.

<behavior> element reference

1. What are different types of contacts?

Service Contract, Data Contract, Message Contract

2. What attributes go along with Service Contract Attribute

Name, NameSpace, CallbackContract, Protection Level, Session Mode.


3. What attributes go along with Operation Contract Attribute

Name, Action, IsOneWay, ProtectionLevel, IsInitiating, Isterminating.

4. Attributes of Data Member attribute

Name
Isrequired – specifies that is required in the serializing XSD
Order – specifies order in XSD

Emit Default Value – true by default , if set to false the default value for that type is not
emitted.

5. CollectionDataContract

6. This is used if service is using a custom collection in the signature. The collection object must be
marked with [CollectionDataContract] attribute.

7. How is versioning done for Services ?

When we plan for a new version we have 2 approaches. Let’s assume you have IServiceA as the
original service interface , to introduce a new version for this service . Both of them have
disadvantages.

1. Create a new contract that inherits from original contract, adding new operations to the new
one. In the service contract Attribute have the name the same but with different namespace .
The advantage is that both new and old versions can have the same end point.

Disadvantage: You cannot differentiate old clients from new clients. Also cannot modify
existing operations

2. Create a new service with different name and namespace and provide a new end point.
Under the cover you can re-use the existing implementation for old methods.

8. Can I pass arrays as parameters to methods?

Enums are by default implement DataContract .

9. What are Known Types?


The KnownTypeAttribute class allows you to specify, in advance, the types that should be included
for consideration during deserialization
Example :

DataContract(Namespace="http://Microsoft.ServiceModel.Samples")]
[KnownType(typeof(ComplexNumberWithMagnitude))]
public class ComplexNumber
{
Here ComplexNumberWithMagnitude inherits from ComplexNumber .

9. How do you handle exceptions in services.

10. Attributes of Message Contract


Is Wrapped
Protection Level
WrapperName
WrapperNameSpace

11. How do you control serialization in Services?


Ans : BY applying XML attributes like XMLElementAttribute, XMLTypeAttribute you can control
how the object is serialized .

12. How to manually switch to XMLSerializer ?


Ans : Mark the service with [XMSerializerFormat] along with the ServiceContract attribute.
AJAX.Net

2.Name Space for Ajax ? Sys.


3.Calling WebServices from AJAX .
<scriptservice> attribute on top of WebService
To enable Web service calls from script, you must register the ScriptHandlerFactory HTTP
handler in the application's Web.config file. The handler processes calls made from script to .asmx Web
services. The following example shows the Web.config element for adding the handler.

The ServiceReference object instructs ASP.NET to generate a JavaScript proxy class for calling the
specified Web service from client script.

<asp:ScriptManager runat="server" ID="scriptManager">


<Services>
<asp:ServiceReference
path="~/WebServices/SimpleWebService.asmx" />
</Services>
</asp:ScriptManager>
4. Calling Static Methods in an ASP.NET Web Page

You can add static page methods to an ASP.NET page and qualify them as Web methods. You can
then call these methods from script in that page as if they were part of a Web service, but without
creating a separate .asmx file

To be able to call static page methods as Web methods, you must set the EnablePageMethods
attribute of the ScriptManager control to true.

5. Jason

http://dotnetslackers.com/articles/aspnet/Using-JSON-With-ASPNET-35.aspx

http://msdn.microsoft.com/en-us/library/bb299886.aspx Introduction to
JSON

PL \ SQL:-

1. What is a ref cursor ?


Simply put, a ref cursor is a PL/SQL data type whose value is an address that represents
the memory location of a query work area on the database server. This may, in turn, cause you to
subsequently wonder just what a query work area is. A query work area can be thought of as the
result set (sometimes also referred to as a row set) on the server—

http://www.oracle.com/technology/pub/articles/mastering_dotnet_oracle/will
iams_refcursors.html

2. PL-SQL link
http://cas.uah.edu/mokw/oracle/a89856/toc.htm

SSRS

1. Reporting Services Host

2. SSRS Deployment Mode

Deployment Modes for Reporting Services

Reporting Services and SharePoint Technology Integration.( Tell them this is


how the users get online access to Reports , else we have to use report Viewer
control , to interface thru web service services against the report server ).

3. Creating Data-Driven Subscription

http://msdn.microsoft.com/en-us/library/ms169673(SQL.90).aspx

4.SSRS virtual Lab

http://go.microsoft.com/?linkid=4267440

5. Resume Bullets

Created Data-Driven Subscription

6. What is a Group Row : Allows to have a sub-header in a section


Example : For example grouping by sales person.

Sales Person OrderDate Order#

Vempala 12/12/06 34242

12/13/08 65345

Sam 10/1/08 3492234


1/1/09 3443

7. Sending Parameters to report dynamically ??

8. Report Layout types are Tabular Layout , Matrix ( or pivot table ) layout.

9. Report Execution Modes –( Move content to document later )

http://msdn.microsoft.com/en-us/library/ms159241.aspx

Stopped at this URL

http://msdn.microsoft.com/en-us/library/ms159267(SQL.90).aspx

Potrebbero piacerti anche