DOTNET Framework Difference FAQs-1.pdf HTML-XML Difference Faqs.pdf ASP.NET Difference FAQs.

pdf Design Patterns Difference FAQs.pdf Dotnet Programming Concepts Difference FAQs.pdf LINQ Difference FAQs.pdf OOPs Difference FAQs.pdf Sql Server Difference FAQs.pdf WCF Difference FAQs.pdf ADO.NET Difference FAQs-1.pdf Comparative Chart of ASP.Net 2.0,3.0 and 3.5 Features.pdf Difference Between ASP.Net 2.0 and ASP.Net 3.5.pdf

1) What is the difference between CCW and RCW? S.No 1 CCW COM to .NET communication happens through COM Callable Wrapper RCW .NET to COM Communication happens through Runtime Callable Wrapper

2) What are the differences between Dll and Exe? S.No 1 2 3 Dll Objects of Dlls can be created Dll is In-Process It cannot be started as a standalone Exe Objects of Exe cannot be created Exe is Out-Process It can be started as a standalone

3) What are the differences between Managed Code and Unmanaged Code? S.No 1 2 3 4 Managed Code It is executed under CLR It compiles to intermediate language It provides services like security, exception handling, garbage collection etc It can access both managed and unmanaged code Unmanaged Code It is not executed under CLR It compiles directly to machine code It does not provide security, exception handling, garbage collection etc It can access only unmanaged code

1) What are differences between XML and HTML? S.No 1 2 3 XML XML provides user definable tags XML is content driven End tags are essential in a well formed XML document. In a well formed document, elements can be defined as single tag or a pair of tags like <student/> or the <student>… </student> pair Quotes required around attribute values Slash required in empty tags XML is used for describing data HTML HTML provides defined set of tags designed for web display HTML is format driven End tags are not always required.<HTML> tag needs an equivalent </HTML> tag but <br> tag does not require </br> tag Quotes are not required for the values of attributes Slash not required HTML is used for designing pages

4 5 6

ASP.NET Difference FAQs-1.pdf ASP.NET Difference FAQs-2.pdf

1) What are the differences between Inline code and Code Behind Code? S.No Inline code Code Behind Code 1 Its within .aspx file Its in a external class file 2 Dynamically compiled Compiled prior to deployment and linked with .aspx file 2) What are the differences between Global.asax and Web.Config? S.No global.asax web.config 1 It is a class file It is an XML file 2 There can be only one for an There can be many if under different application sub-folders 3 Can have Application and Session Cannot have Application and Session events events 4 Need to be recompiled when No need to compile when changes are changes are made made 3) What are the Differences between Server.Transfer and Response.Redirect? S.No Server.Transfer Response.Redirect 1 The navigation happens on the The navigation happens on the clientserver-side ,so client history is side ,so client history is updated not updated 2 Data can be persist across the Context.Items loses the persistence pages using Context.Item collection 3 No Round-trips Makes a Round-trip 4 Has Good encapsulation No 4) What is the difference between a custom control and a user control? S.No User Control Custom Control 1 Is a file with the .ascx extension Is a file with the .dll extension 2 Can be only used with the Can be used in any number of application applications 3 Language dependent They are language independent, a control created in c# can be used in vb.net 4 Cannot be added to Visual studio Can be added to Visual studio Toolbox Toolbox 5 Inherits from Server controls and We have to develop from scratch , easy to create so comparatively difficult 6 Generally used for static content Used when dynamic content is required 5) What is the difference between Caching and Application? S.No Caching Application 1 Cache have expire policy Application does not have expire policy 2 Cache does not require explicit Application require explicit locking locking 3 Cache has the Property of timeout, Application variables exist as long as

which allows us to control the the application is alive duration of the Objects so cached 4 Output can be cached in 4 ways, Application does not have options as like Cache object  Page Output Caching  Page Partial Caching  DataSource Caching  Data Caching 5 It is accessible to page level to all It is accessible to both page level and the users application level to all the users 6) What is the difference between web farm and web garden? S.No Web farm Web garden 1 A web application running on A web application running on a single multiple servers is called a web server that has multiple CPUs is farm called a web garden 7) What is the difference between Application and Session Events? S.No Application Event Session Event 1 Application events are used to Session events are used to initialize initialize objects and data that we data that we want to keep throughout do want to make available to all individual sessions, but that we do not the current sessions of our web want to share between sessions application 8) What is the difference between Session Cookies and Persistent Cookies? S.No Session Cookies Persistent Cookies 1 Session Cookies do not have Persistent Cookies have an expiration expiration date date. The expiration date indicates to the browser that it should write the cookie to the client’s hard drive 9) What are the differences between Server Controls and HTML Controls? S.No Server Controls HTML Controls 1 Server Controls can trigger HTML Controls can trigger only control-specific events on the page-level events on server (postback) server 2 Data entered in a server control is Data is not maintained in an HTML maintained across requests. Server control. Data must be saved and controls retain state restored using page-level scripts 3 The Microsoft .NET Framework HTML controls have HTML attributes provides a set of properties for only each server control. Properties allows us to change the server control’s appearance and behavior within server-side code 4 Server controls automatically We must detect browser in code or detect browser and adapt display write for least common denominator as appropriate 10) What are the differences between ViewState and Hidden fields? S.No ViewState Hidden fields 1 This is used for pages that will This is used for pages that will postback to itself postback to itself or to another page

2 3

This is built in structure for maintaining state of a page Security is more as data is hashed, compressed and encoded

This is not an inbuilt structure Security is less when compared to ViewState

11) What is the difference between SQL Cache Notification and SQL Cache Invalidation? S.No SQL Cache Notification SQL Cache Invalidation 1 Using SQL Cache Notification, Using SQL Cache Invalidation, we we can generate notifications can make a cached item invalid that when the data of a database on depends on the data stored in a SQL which a cached item depends server database, when the data in the changes SQL server database is changed 12) What is the difference between absolute time expiration and sliding time expiration? S.No Absolute time expiration Sliding time expiration 1 In absolute time expiration, a In sliding time expiration, the time for cached item expires after the which the item is cached is each time expiration time specifies for it, incremented by its expiration time if it irrespective of how often it is is accessed before completion of its accessed expiration time 13) What is the difference between adding items into cache through Add() method and Insert() method? S.No Cache.Add() Cache.Insert() 1 Cache.Add() method also returns Cache.Insert() method adds only the an object representing the item we item in the cache have added in the cache ,besides adding the item in the cache 2 It is not possible to replace an We can replace an existing item in the existing item in the cache using cache using the Cache.Insert() method the Cache.Add() method 14) What is the difference between page-level caching and fragment caching? S.No Page-level caching Fragment caching 1 In Page-level caching, we cache In Fragment caching, we cache parts a whole page of the web page such as a user control added to the web page 15) What is the difference between Label control and Literal control? S.No Label control Literal control 1 Final HTML code of a Label Final HTML code of a Literal control control has an HTML tag contains only text, which is not surrounded by any HTML tag 16) What is the difference between HyperLink control and LinkButton control? S.No HyperLink control LinkButton control 1 A HyperLink control do not have A LinkButton control have Click and Click and Command events Command events, which can be handled in the code behind file of the web page

17) What is the difference between an HtmlInputCheckBox control and an HtmlInputRadioButton control? S.No HtmlInputCheckBox control HtmlInputRadioButton control 1 We can select more than one We can select only a single HtmlInputCheckBox control from HtmlInputRadioButton control from a a group of HtmlInputCheckBox group of HtmlInputRadioButton controls controls 18) How a content page differs from a master page? S.No Content page Master page 1 A content page does not have A master page has complete HTML complete HTML source code source code inside its source file 19) How will you differentiate a submaster page from a top-level master page? S.No Submaster page Top-level master page 1 Like a content page, a submaster Top-level master page has complete page also does not have complete HTML source code inside its source HTML source code file 20) What is the difference between a page theme control and a global theme? S.No Page theme Global theme 1 A page theme is stored inside a A global theme is stored inside the subfolder of the App_Themes Themes folder on a web server folder of a web application 2 It can be applied to individual web It can be applied to all the web sites pages of the web application on the web server 21) What is the difference between a default skin and a named skin? S.No Default skin Named skin 1 A default skin does not have a A named skin has a SkinId attribute SkinId attribute 2 It is automatically applied to all It is applied to a control explicitly by the controls of the same type setting the SkinId property of the present on a web page control from the Properties window 22) Differentiate Globalization and Localization S.No Globalization Localization 1 Globalization is the process of Localization is the process of identifying the specific portion of configuring a web application to be a web application that needs to be supported for a specific language or different for different languages locale and isolating that portion from the core of the web application 23) What are the differences between web.config and machine.config? S.No web.config machine.config 1 This is automatically created This is automatically installed when when we create an ASP.Net web we install Visual Studio. Net application project 2 This is also called application This is also called machine level level configuration file configuration file

3 4

We can have more than one web.config file This file inherits setting from the machine.config

Only one machine.config file exists on a server This file is at the highest level in the configuration hierarchy

Difference between Web site and Web application S.No 1 2 3 4 Web site Can mix vb and c# page in single website. Can not establish dependencies. Edit individual files after deployment. Right choice when one developer will responsible for creating and managing entire website. i.e.,In web site development, decoupling is not possible. Web site is easier to create than Web application Web application We can't include c# and vb page in single web application. We can set up dependencies between multiple projects. Can not edit individual files after deployment without recompiling. Right choice for enterprise environments where multiple developers work unitedly for creating,testing and deployment. i.e.,In Web application, different different groups work on various components independently like one group work on domain layer, other work on UI layer. Web application is more difficult to create than a Web site

5

Difference between Local storage and cookies S.No 1 2 3 Local storage Good to store large amount of data, up to 4MB Easy to work with the JavaScript Local storage data is not sent to the server on every request (HTTP header) as it is purely at the client side No way to specify the time out period as the Cookies have Cookies Good for small amount of data, up to 4KB Difficult to work with JavaScript All data is transferred to and from server, so bandwidth is consumed on every request Can specify timeout period so that cookies data are removed from browser

4

Difference between Session and Cache S.No 1 2 Session Ssession retains state per user Items put into a session will stay there, until the session ends Cache Cache is used for retaining state for application scoped items. Items in the cache can expire (will be removed from cache) after a specified amount of time. And also there is no guaranty that objects will not be removed before their expiration times as ASP.NET remove items from cache when the amount of available memory gets small. This process is called as Scavenging.

3

The session state can be kept external This is not the case with the cache. (state server, SQL server) and shared between several instances of our web app (for load balancing).

Difference between Datalist and Repeater S.No 1 Datalist Datalist supports multiple columns displaying and using repeat columns property Repeater Repeater doesn't support multiple columns display,no repeat columns property

2 3

Datalist supports styles for formating Repeater does not provide styles templates data[headerstyle,...] Datalist rendering output[html content]will be slow compare with repeater. Repeater performanace is better than Datalist

Summary: If the requirement can achieve using repeater and datalist,choose repeater for better performance

1. Difference between Factory Pattern and Abstract Factory Pattern S.No 1 2 3 Factory Pattern Create object through inheritance Produce only one product Implements code in the abstract creator that make use of the concrete type that sub class produces Abstract Factory Pattern Create object through composition Produce families of products Concrete factories implements factory method to create product

2.Difference between Abstract Factory Pattern And Builder Pattern S.No 1 Builder Pattern Abstract Factory Pattern

In Builder Pattern, there will be one Abstract Factory Pattern will return the Director class which will instruct Builder instance directly. class to build the different parts/properties of our object and finally retrieve the object. It will have reference to the created object. It does not keep the track of it's created object.

2

3.Difference between Builder Pattern And Composite Pattern S.No 1 Builder Pattern It is used to create group of objects of predefined types. Composite Pattern It creates Parent - Child relations between our objects.

4.Difference between MVC and MVP

S.No 1

MVP MVP is a bit more complex to implement than MVC .Also, it has additional layer for view interfaces. The request is always received by the View and delegated to the presenter which in turn gets the data does the processing The presentation and view logic an be unit tested as the view is loosely coupled. MVP is best suitable for Windows Programming as the flow naturally tend towards this pattern.

MVC MVC is easier to implement than MVP.

2

The request is received by the controller which in turn gets the required data and loads up the appropriate view The controller logic can be unit tested. Note: We can unit test view if we are using Razor view engine. ASPX viewengine are not that easily unit testable MVC is best suitable for Web Programming.

3

4

5.Difference between Proxy Pattern and Observer Pattern S.No 1 Proxy Pattern Observer Pattern

The Proxy Pattern is used for wrapping a The Observer Pattern is used by a publisher kind of special object with 1 or more object to notify subscriber objects with other objects. information. Either because we don't always have the wrapped object or because it needs to be managed in a certain way that can be simplified via the proxy object(s). This is kind of a way to exchange the API of an existing class with a proxy class. We are not just talking events here, but whatever kind of functionality to define via the proxy object instead of the real object. The publisher object does not know the subscribing objects - except that the conform to a certain subscriber interface. This is a very flexible pattern for distributing events, since those that wants to listen on certain object has the power to do so without changing the code of the publishing object.

2

6. Difference between Singleton Pattern and a static class S.No 1 2 Singleton Pattern Singleton pattern maintains single instance. A singleton can extend classes and implement interfaces. A singleton can be initialized lazily or asynchronously. Singletons can be handled polymorphically without forcing their users to assume that there is only one instance. static class We cannot create instance for static class. A static class cannot . Note: It can extend classes, but it does not inherit their instance members. A static class is generally initialized when it is first loaded, leading to potential class loader issues. static class cannot be handled polymorphically.

3

4

5

Singleton Class can have value when Static are always just shared and have no Class object instantiated between server instance but multiple references. and client, such a way if three client want to have a shared data between them Singleton can be used.Thats why singleton class can be used for state mangement in stateless scenarios like shopping cart scenario. We can pass singleton object as parameter Singleton provides flexibility and also provides sort of a mechanism to control object creation based on various requirements. They can be extended as well if need arises. In other words we are not always tied to a particular implementation. With Singleton we We cannot pass parameter in static class Static classes once defined could not accomodate any future design changes as by design static classes are rigid and cannot be extended.

6 7

have the flexibility to make changes as when situation demands. 7.Difference between Strategy and Inversion of Control (IOC)

S.No 1

Strategy Pattern The strategy pattern is useful when we want classes to depend on the interface rather than the implementation.And we can easily swap out behavior depending on which concrete implementation we provide.

Inversion of Control (IOC) Pattern Inversion of Control/Dependency Injection (IoC/DI) comes into play when we want the concrete strategy implementation injected into a class. For example, we could use the DI Framework Ninject and configure it so that it will know which concrete strategy implementation to inject into a class in specific scenarios. Note: Strategy is just one of the ways that IOC is implemented

8.DIfference between IDictionary and Dictionary

S.No 1 2

IDictionary

Dictionary

IDictionary is just a contract, abstraction Dictionary is concrete implementation. It is recommended for example to expect Argument or Property is not required for as argument an IDictionary rather than Dictionary. concrete Dictionary, or to expose property of IDictionary rather than Dictionary, because this promotes loose coupling. Than we are able to change underlying objects in the future without affecting those who use your object.

9.Difference between Factory Pattern and Dependency Injection

S.No 1 2

Factory Pattern Factory is used to create objects

Dependency Injection(DI) DI is used to move the responsibility of creating an object outside the main code. Some of the well known framework available for DI are 1. 2. 3. 4. 5. 6. Unity Application Block (Microsoft) Ninject StructureMap Castle Windsor Munq/Funq Autofac

10.Difference between String.Clone() and String.Copy() method S.No 1 String.Clone() Returns a reference to this instance of String. i.e., it gives pointer value(ie Current memory Reference) String.Copy() Creates a new instance of String with the same value as a specified String. i.e., it creates an instance in Heap Memory and gives pointer value(ie New Memory Reference)

11.Difference between Strategy Pattern and Factory Pattern S.No 1 Strategy Pattern Factory Pattern

Strategy's sole intent to is to provide a Factory's sole purpose is to create objects . mechanism to select different algorithm. We cannot use "strategy" to create objects of "factory". We can use "factory" to create objects of "strategy".

2

12.Difference between Proxy and Adaptor S.No 1 Proxy Pattern Proxy on the other hand represents a standin object for the real object. This is required when the real object is complex to create, is not available, or for authentication purpose. For e.g. web service proxy, proxy authentication server etc. Proxy can be categorized into Virtual Proxy Remote Proxy Protection Proxy 13.Difference between Decorator and Visitor S.No 1 2 3 Decorator Pattern Decorator may have just a single object to customize. Decorator does not require a traverser for successful implementation. Decorator pattern is a structural pattern that help us to add new function to an object in the run time , note that in the run time not design time . Visitor Pattern Visitor has a tree of objects to be worked upon. Visitor requires a traverser for successful implementation. Visitor pattern is Behavioral pattern that seperate the data structure from the operation (functionality ) that work on it , this mean we can add different operation on the same data structure Adaptor Pattern Adapter is used to adapt to incompatible interfaces. It's more directed from the client (those who consume the object) perspective. A client expects an interface to be of particular type and adapter plays a role in filling that gap. It's more from making it easier for the client to adapt to other third party libraries within there own by adapting to it.

Dotnet Programming Concepts Difference FAQs-1.pdf Dotnet Programming Concepts Difference FAQs-2.pdf

Difference between hash table and arraylist S.No 1 2 3 Arraylist Array List is a List Here, we can only add items to the list Retrieving data using Arraylist is slower than Hashtable because If we want to find something in a arraylist we have to go through each value in arraylist. Hash table Hash Table is a map Here, we can add data with the key Retrieving by key in Hashtable is faster than retrieving in Arraylist because If we want to find something in a hashtable we dont have to go through each value in hashtable, instead search for key values and is faster.

Difference between Hash Table and Arrays Hash Table Hash table stores data as name,value pair. To access value from hash table, we need to pass name. We can store different type of data in hash table, say int,string etc. Difference between Dictionary and Hashtable Dictionary Dictionary is a generic type Hashtable Hashtable is not generic type. Array Array stores only value In array, to access value , we need to pass index number. In array ,we can store only similar type of data.

In Dictionary we need to specify the types of Hashtable is a collection of name/value pairs both the key and the corresponding value.The that are organised on the basis of hash code of value represents the actual object stored and the the key being specified. key represents a means to identify a particular object. In Dictionary public static members are type safe but any instance members are not type safe. Hashtable is thread safe for use by multiple reader threads and a single writing thread.

We cannot use Dictionary with Web Services We can use Hashtable withWeb Services The reason is no web service standard supports generic standard. Dictionary is aster than Hashtable because boxing is not required. It is slower than dictionary because to retrieve a value we must cast it as its actual type, because it will be returned via object reference.

Difference between array and stack Array An array can be multi-dimensional An array allows direct access to any of its elements Stack Stack is strictly one-dimensional With a stack, only the 'top' element is directly accessible; to access other elements of a stack, we must go through them in order, until we get to the one we want

Difference between Stack and Heap Stack Memory will be allocated at the compile time. Here the memory is allocated by the compiler. Memory will be allocated only in sequential locations. The memory will also be deleted by the compiler. There is lot of chance of memory wastage. Heap Memory will be allocated at the run time. Here the memory is allocated by the user. Memory will be allocated in sequential locations and non- sequential locations. The memory must be deleted explicitly by the user. There is no chance of memory wastage if the memory is handled perfectly.

Difference between Array and ArrayList Array They are fixed length. They are compiled strong type collection. Because arrays are of fixed size and strong type collection performance is faster. Array is in the System namespace Ex:Char[] vowel=new Char[]; ArrayList They are resizable and variable length They are flexible and can accommodate any data types. In arraylist lots of boxing and unboxing are done there for its performance is slower. ArrayList is in the System.Collections namespace. Ex:ArrayList a_list=new ArrayList();

1.Difference between for and foreach loop S.No 1 For loop Foreach loop

In case of for the variable of the loop is In case of Foreach the variable of the loop always be int only. while be same as the type of values under the array. The For loop executes the statement or block of statements repeatedly until specified expression evaluates to false. There is need to specify the loop bounds(Minimum, Maximum). example: using sytem; class class1 { static void Main() { int j=0; for(int i=0; i<=10;i++) { j=j+1; } Console.ReadLine(); } } The Foreach statement repeats a group of embedded statements for each element in an array or an object collection. We do not need to specify the loop bounds minimum or maximum. example: using sytem; class class1 { static void Main() { int j=0; int[] arr=new int[] {0,3,5,2,55,34,643,42,23}; foreach(int i in arr) { j=j+1; } Console.ReadLine(); } }

2

3 4

2. Difference between Covariance and Contravariance S.No 1 Covariance Converting from a broader type to a specific type is called co-variance.If B is derived from A and B relates to A, then we can assign A to B. Like A=B. This is Covariance. Contravariance Converting from a more specific type to a broader type is called contra-variance. If B is derived from A and B relates to A, then we can assign B to A. Like B= A. This is Contravariance.

2

Co-variance is guaranteed to work Contra-variance on the other hand is not without any loss of information during guaranteed to work without loss of data. As conversion. So, most languages also such an explicit cast is required. provide facility for implicit conversion. e.g. Converting from cat or dog to animal is e.g. Assuming dog and cat inherits from called contra-variance, because not all animal, when you convert from animal features (properties/methods) of cat or dog is type to dog or cat, it is called copresent in animal. variance.

3

Example:

class Fruit { } class Mango : Fruit { } class Program { delegate T Func<out T>(); delegate void Action<in T>(T a); static void Main(string[] args) { // Covariance Func<Mango> mango = () => new Mango(); Func<Fruit> fruit = mango; // Contravariance Action<Fruit> fr = (frt) => { Console.WriteLine(frt); }; Action<Mango> man = fr; } } 4 Note: 1. Co-variance and contra-variance is possible only with reference types; value types are invariant. 2. In .NET 4.0, the support for co-variance and contra-variance has been extended to generic types. No now we can apply co-variance and contra-variance to Lists etc. (e.g. IEnumerable etc.) that implement a common interface. This was not possible with .NET versions 3.5 and earlier.

3.Difference between IList and IEnumerable

S.No 1

IList IList is used to access an element in a specific position/index in a list. IList is useful when we want to Add or remove items from the list. IList can find out the no of elements in the collection without iterating the collection. IList does not support filtering.

IEnumerable IEnumerable is a forward only collection, it can not move backward and between the items. IEnumerable does not support add or remove items from the list. Using IEnumerable we can find out the no of elements in the collection after iterating the collection. IEnumerable supports filtering.

2 3

4

4.Difference between IEnumerable and IQueryable

S.No 1 2

IEnumerable IEnumerable exists in System.Collections Namespace. IEnumerable is best to query data from in-memory collections like List, Array etc. While query data from database, IEnumerable execute select query on server side, load data in-memory on client side and then filter data. IEnumerable is suitable for LINQ to Object and LINQ to XML queries. IEnumerable does not supports custom query. IEnumerable does not support lazy loading. Hence not suitable for paging like scenarios. Extension methods supports by IEnumerable takes functional objects. IEnumerable Example

IQueryable IQueryable exists in System.Linq Namespace. IQueryable is best to query data from outmemory (like remote database, service) collections. While query data from database, IEnumerable execute select query on server side with all filters. IQueryable is suitable for LINQ to SQL queries. IQueryable supports custom query using CreateQuery and Execute methods. IQueryable support lazy loading. Hence it is suitable for paging like scenarios. Extension methods supports by IEnumerable takes expression objects means expression tree.

3

4 5 6

7

8

MyDataContext dc = new MyDataContext (); IEnumerable list = dc.loyees.Where(p => p.Name.StartsWith("S")); list = list.Take(10); Generated SQL statements of above query will be : SELECT [t0].[EmpID], [t0].[EmpName], [t0].[Salary] FROM [Employee] AS [t0] WHERE [t0].[EmpName] LIKE @p0

Note: In this query "top 10" is missing since IEnumerable filters records on client side IQueryable Example MyDataContext dc = new MyDataContext (); IEnumerable list = dc.loyees.Where(p => p.Name.StartsWith("S")); list = list.Take(10); Generated SQL statements of above query will be : SELECT TOP 10 [t0].[EmpID], [t0].[EmpName], [t0].[Salary] FROM [Employee] AS [t0] WHERE [t0].[EmpName] LIKE @p0 Note: In this query "top 10" is exist since IQueryable executes query in SQL server with all filters. 5.Difference between IEnumerable and IEnumerator S.No 1 IEnumerable The IEnumerable interface is a generic interface that provides an abstraction for looping over elements. In addition to providing foreach support, it allows us to tap into the useful extension methods in the System.Linq namespace, opening up a lot of advanced functionality The IEnumerable interface contains an abstract member function called GetEnumerator() and return an interface IEnumerator on any success call. IEnumerable does not remember the cursor state i.e currently row which is iterating through IEnumerable is useful when we have only iterate the value IEnumerator IEnumerator provides two abstract methods and a property to pull a particular element in a collection. And they are Reset(), MoveNext() and Current The signature of IEnumerator members is as follows: void Reset() : Sets the enumerator to its initial position, which is before the first element in the collection. bool MoveNext() : Advances the enumerator to the next element of the collection. object Current : Gets the current element in the collection IEnumerator does remember the cursor state

2

3

IEnumerator is useful when we have to pass the iterator as parameter and has to remember the value

LINQ Difference FAQs-1.pdf LINQ Difference FAQs-2.pdf

1.Difference between LINQ and SQL S.No 1 2 LINQ LINQ Stands for language integrated query. LINQ Statements are verified during compile time. To use LINQ we can depend upon our .Net Language syntaxes and also we can consume base class library functionalities. LINQ Statements can be debugged as they execute under framework environment. SQL . SQL SQL stands for Structured Query Language. SQL statements can be used in a application gets verified for their syntaxes only in the run time. To use SQL we need to be familiar with SQL syntaxes and also the predefined functions of SQL like MAX,MIN,LEN and SUBSTRING etc... As SQL statements execute on Database server debugging of the code is not possible.

3

4

2.Difference between LINQ to SQL and Entity Framework S.No 1 2 3 4 5 6 LINQ to SQL It only works with Sql server. Used for rapid application development. It does not support for complex type. It cannot generate db from model. Mapping type ( class to single table) We can query data using DataContext. Entity Framework It works with variety of db products. Cannot used for rapid application development. It provides support for complex type. It can generate db from model. Mapping type ( class to multiple tables) We can query data using esql,object services,entity client and linq to entities.

Another Good Reference: http://jinaldesai.net/linq-to-sql-vs-entity-framework/ (OR) http://www.slideshare.net/jinaldesailive/linq-to-sql-vs-entity-framework-jinal-desai

3.Difference between LINQ and Stored Procedures

S.No 1

LINQ As LINQ is part of .NET, we can use visual studio’s debugger to debug the queries With LINQ everything gets complied into single DLL hence deployment becomes easy. LINQ is type safe, so queries errors are type checked at compile time.It is really good to encounter an error when compiling rather than runtime exception! LINQ supports multiple databases LINQ supports abstraction which allows framework to add additional improvements like multi threading. It is much simpler and easier to add this support through LINQ than Stored Procedures.

Stored Procedures It is really very hard to debug the Stored Procedure With Stored Procedures, we need to provide an additional script for deployment Stored Procedures are not type safe i.e., error can be caught only during runtime.

2

3

4 5

With Stored Procedures which need to be re-written for different databases. As Stored Procedures does not support abstaction , so it is difficult to add additional impovements like multi threading

6

LINQ queries need to compile Stored Procedures are ster thn LINQ before execution.Therefore, LINQ because they are precompiled i.e., is slower than Stored Procedures. Stored Procedures have a predictable execution plan.Therefore, if a stored procedure is being executed for the second time, the database gets the cached execution plan to execute the stored procedure.

4.Difference between LINQ to SQL and LINQ to Objects

S.No 1

LINQ to SQL

LINQ to Objects

LINQ to SQL needs a Data LINQ to Objects does not need any Context object. The Data Context intermediate LINQ provider or API. object is the bridge between LINQ and the database. LINQ to SQL returns data of type IQueryable<T> LINQ to Objects returns data of type IEnumerable<T>.

2

3

LINQ to SQL is translated to SQL by way of Expression Trees, which allow them to be evaluated as a single unit and translated to the appropriate and optimal SQL statements. LINQ to SQL is translated to SQL calls and executed on the specified database

LINQ to Objects does not need to be translated.

4

LINQ to Objects is executed in the local machine memory.

5.Difference between LINQ to SQL and LINQ to Entities

S.No 1 2 3 4 5 6 7 8

LINQ to SQL
Does not support Conceptual Data Model Does not support Storage Schema Does not support Mapping Schema Does not support New Data Access Provider Does not support Non-SQL Server Database Support

LINQ to Entities
Supports Conceptual Data Model Supports Storage Schema Supports Mapping Schema Supports New Data Access Provider

Supports Non-SQL Server Database
Support Does not support Direct Database Connection

Supports Direct Database
Connection Does not support Multiple-table Inheritance Does not support Single Entity from Multiple Tables

Supports Multiple-table Inheritance Supports Single Entity from Multiple
Tables

1.Difference between LINQ to SQL and ADO.NET S.No 1 LINQ to SQL Used for data handling with SQL Server databases only. Uses the extension methods of System.Linq.Queryable class. Introduced in .net Framework 3.0 DataContext is used for Database connectivity. Syntax and coding is somewhat complex. ADO.NET Used for data handling with any database: SQL Server/Access/Oracle/Excel etc. Does not use the extension methods of System.Linq.Queryable class. It is there since the .net Framework 1.0 SqlConnection/OleDbConnection are used for database connectivity Easier syntax and coding.

2 3 4 5

Note: Both LINQ TO SQL and ADO.NET have connected / disconnected modes of data handling 2.Difference between LINQ and nHibernate S.No 1 2 3 4 LINQ LINQ is not an open-source LINQ is an incomplete ORM tool as it needs additional extensions. LINQ is primarily a querying language LINQ is much more useful in small applications where there is no massive dependence on databases. With LINQ, database already exists and the relationships and some programming will be dependent on how the database is defined. nHibernate nHibernate is an open source. nHibernate is an ORM tool nHibernate has a limited querying language. nHibernate is much more useful in largel applications where there is massive dependence on databases. With nHibernate, database does not already exist and it needs to be defined .

5

3.Difference between LINQ and Entity Framework

S.No 1 2

LINQ Used for Rapid Application Development Works with objects in database

Entity Framework Used for Enterprise Development Works with Conceptual model of database Works with all data sources ".EDMX" is created while using Entity Framework

3 4

Mainly woks with SQL Server ".dbml" is created while using LINQ to SQL

OOPs Difference FAQs-1.pdf OOPs Difference FAQs-2.pdf OOPs Difference FAQs-3.pdf

1) What are the differences between TypeOf() and GetType()? S.No TypeOf() GetType() 1 Its an operator Its a method 2 Can't be overloaded Has lot of overloads 2) What are the differences between const and readonly? S.No const readonly 1 It cannot be static It can be instance level or static 2 It is evaluated at design time It is evaluated at run time 3 It is initialized at declaration It is initialized at declaration or in constructor 4 It must be of integral type or In addition, it can have complex types enumeration with new keyword and enumerations are not allowed 3) What are the Differences between Abstract Class and Interface? S.No Abstract Class Interface 1 It can have implemented Methods It cannot have implemented Methods 2 A class can inherit only one abstract A Class can implement any number of class Interfaces 3 We go for Abstract classes on such We go for Interface on such situations situations where we need to give where we need to give common common functionality for group of functionality for group of un-related related classes classes 4 If we add a new method, then we can If we add a new method, then we need to provide a default implementation and change all the existing work so no need to make any change to existing work 5 Static and Instance constants are Only Static constants are possible possible 4) What are the differences between Structure and Class? S.No Structure Class 1 It is value type It is reference type 2 It is stored on stack It is stored on heap 3 It does not support inheritance It supports inheritance 4 It is suitable for small data structure It is suitable for complex data structures 5) What are the differences between property and indexer? S.No Property Indexer 1 A property can be static member An indexer is always an instant member 2 The get accessor of a property The get accessor of an indexer corresponds to a method with no corresponds to the same formal parameter parameters lists as the indexer 6) What are the differences between overloading and overriding? S.No Overloading Overriding 1 Same name in same / derived class We need to provide different but with different / type of parameter implementation than base class 2 Has different signature Has same signature 3 Otherwise called Compile-time Otherwise called Run-time Polymorphism

Polymorphism 7) What are the differences between Value Types and Reference Types? S.No Value Types Reference Types 1 It is stored on stack It is stored on heap 2 It can be accessed directly It can be accessed through references 3 Life time of value type is determined Lifetime of reference type is managed by lifetime of variable that contain by .net framework them 4 Examples: All numeric data type, Examples: All arrays, String, Class types, Boolean, char, Date, Structure, Delegate enumerations Note: Object is not any kind of type. You can create object of structure as well as Class Are not type: Namespaces, Modules, Events, properties, procedures, variables, constants, & fields.

Difference between Events and Delegates S.No
1 2 3

Events
Event can be used in an interface definition Event can only be invoked from the class that declares it Event comes with its pair of accessors i.e Add and Remove. An event is always assigned and unassigned with a += and -= operator. Event has a restrictive signature and must always be of the form Event (object source, EventArgs args)

Delegates
Delegate cannot be used in an interface definition Delegates can be invoked from child classes and clients. There is no pair of accessors concept in delegates.

4

Delegates do not have restrictive signature as like events

Difference between Class and Object S.No
1 2 3

Class
It is a datatype that contains the programming logic. Class is visible in the source code and resides in hard disk. Class is like a template or blueprint of the object. It implements reusability,encapsulation, inheritance Example:Button is a class with properties like Text,BackColor, events like click, methods like Focus We can create subclasses

Object
It is a chunk of memory that implements the class logic. Object is in the RAM and not visible in source code. It is the real world implementation of the class. Each object has its own copy of data.

4

Example: Button1, Button2 are the
objects of Button class. We cannot create sub-objects

5

Difference between Private and Static Constructor S.No Static constructor Private constructor
1 A static constructor is called before the first instance is created. i.e. global initializer. Static constructor will be called first time when the class is referenced.Static constructor is used to initialize static members of the class. Private constructor is called after the instance of the class is created. Static members will not be initialized either by private or public constructor.

2

3

The static constructor will only be The private constructor will be executed once. executed each time it is called.

Difference between properties and methods S.No
1 2

Properties
Properties are used to represent data Properties are created by using getter and setter i.e., get{} and set{}

Methods
Methods are used to performs actions Methods create like public void method1(parameter list here)

Difference between Singleton Pattern and a static class S.No Singleton Pattern
Singleton pattern maintains single instance. 2

static class
We cannot create instance for static class.

A singleton can extend classes and A static class cannot . implement interfaces. Note: It can extend classes, but it does not inherit their instance members. A singleton can be initialized lazily or asynchronously. Singletons can be handled polymorphically without forcing their users to assume that there is only one instance. Singleton Class can have value when Class object instantiated between server and client, such a way if three client want to have a shared data between them Singleton can be used.Thats why singleton class can be used for state mangement in stateless scenarios like shopping cart scenario. We can pass singleton object as parameter Singleton provides flexibility and also provides sort of a mechanism to control object creation based on various requirements. They can be extended as well if need arises. In other words we are not always tied to a particular implementation. With Singleton we have the flexibility to make changes as when situation demands. A static class is generally initialized when it is first loaded, leading to potential class loader issues. static class cannot be handled polymorphically.

3

4

5

Static are always just shared and have no instance but multiple references.

6 7

We cannot pass parameter in static class Static classes once defined could not accomodate any future design changes as by design static classes are rigid and cannot be extended.

Difference between Abstraction and Encapsulation Abstraction Abstraction solves the problem in the design level. Encapsulation Encapsulation solves the problem in the implementation level.

Abstraction is used for hiding the Encapsulation means hiding the code unwanted data and giving relevant data. and data into a single unit to protect the data from outside world. Abstraction allows us to focus on what the object does instead of how it does it Abstraction- Outer layout, used in terms of design. For Example:Outer Look of a Mobile Phone, like it has a display screen and keypad buttons to dial a number. Encapsulation means hiding the internal details or mechanism of how an object does something. Encapsulation- Inner layout, used in terms of implementation. For Example:- Inner Implementation detail of a Mobile Phone, how keypad button and Display Screen are connected with each other using circuits

Difference between Composition and Aggregation Composition Defines a strong-coupled relationship between two entities, where the one entity is part of another, and both need each other for their existence. e.g. Human body and the Heart. Composition implies real ownership of its components Composition has a stronger bond of its components. Composition has components that exist at the inner level. Aggregation Defines a weak-coupled relationship between two entities, where one entity could be part of another, but either can exist without the other, independantly. e.g.School and teacher. Aggregation does not necessarily own any of its aggregates. Aggregation has weaker or looser bonds with its aggregates. Aggregation has aggregates that live at the outer level.

Difference between Private Class and Sealed Class Private Class Sealed Class

A Private class can only be accessed by A Sealed class can be accessed by any the class it is defined and contain within class.Private Constructor of a Private - it is completely inaccessible to outside Class = Sealed Class. classes. In private Class,we can create a constructor and therefore we can create an instance of that class. public class A { private class B { } B b = new B(); } public class C { A.B b = new A.B(); // ERROR } In Sealed class we can not create a constructor of that class, so no instance of that class is possible. public sealed class A { } public class B : A //ERROR { }

The main use of Private class is to create The sealed classes are mainly used to a user-defined type, which we want to be prevent inheritance features of object accessible to that class only. oriented programming. Private class(i.e private constructor) is also used to implement singleton classes(pattern). Singleton means "A single-instance object, and it simplify complex code. Singletons have a static property that we must access to get the object reference." Difference between Static Class and Sealed Class Static Class We can neither create their instances, nor inherit them They can have static members only. ex: static class Program Sealed Class We can create their instances, but cannot inherit them They can contain static as well as nonstatic members. ex:

{ }

sealed class demo { } class abc:demo { --Wrong }

Static classes are used when a class The sealed classes are mainly used to provides functionality that is not specific prevent inheritance features of object to any unique instance. oriented programming. Difference between Virtual method and Abstract method

Feature Overriding

Virtual method

Abstract method

Virtual method may or may An abstract method should be not override by inherited class. overriden by inherited class. i.e.,Virtual method provide the derived class with the option of overriding it. Virtual = = Overridable i.e.,Abstract method forces the derived class to override it. abstract == MustOverride Abstract method does not provide an implementation. Abstract methods in a class contain no method body, and are implicitly virtual Abstract method's scope to members and classes Abstract method - direcly NO, but other way, Yes. We can create an instance of a class that derives from an abstract class. And we can declare a type Abstract class and instantiate that as a derived class.

Implementation Necessity to Implement

Virtual method has an implementation. Virtual methods allow subclasses to provide their own implementation of that method using the override keyword Virtual methods scope to members only. Virtual methods - Not applicable, as we can't create instance for members, it is possible only with classes.

Scope Instancing

Example: public abstract class Test { public abstract void A(); // Abstract method

public virtual void B() { Console.WriteLine("Test.B"); } // Virtual Method } public class InheritedTest : Test { public override void A() { Console.WriteLine("InheritedTest.A"); } //Method B implementation is optional public override void B() { Console.WriteLine("InheritedTest.B"); } }

Difference between Class and Static Class Class Class has Instance Members In Class, Constructor has Access Specifier. In Class Constructor, initiation is done every time when an object is created for the class In Class, Class members can be accessed through class object. Static Class Static class does not have Instance Members In Static Class, Constructor does not have Access Specifier. In Static Class ,Constructor will be called only one time .

In Static Class, members can be accessed through its Class name only

Difference between Method Overloading and Method overriding in C# Method Overloading Method Overloading is passing same message for different functionality Method Overloading is between the same function name with the different signature Method overriding Method Overriding is redifining parent class function to the child class Method Overriding is between the same method.

Method Overloading does not check for Method Overriding checks the return the return type. type. Method Overloading takes place in the same class. Method Overloading is static binding Method Overriding takes place between parent and child classes Method Overriding is a dynamic binding.

SQL Server Difference FAQs-1.pdf SQL Server Difference FAQs-2.pdf SQL Server Difference FAQs-3.pdf SQL Server Difference FAQs-4.pdf SQL Server Difference FAQs-5.pdf

1) What are the Differences between TRUNCATE and Delete? S.No Truncate Delete 1 Truncate is faster Delete is comparatively slower 2 Removes all rows from a table Can remove specific rows with Where clause 3 Is DDL Command Is DML Command 4 Resets identity of the table Does not reset identity of the table 5 Removes the data by deallocating Removes one row at a time and the data pages and logs the records an entry in the transaction log deallocation. for each deleted row. 6 Cannot be rolled back Can be rolled back 2) What are the differences between Primary key and Unique key? S.No Primary Key Unique Key 1 Creates Clustered index Creates Non-Clustered index 2 Null values are not allowed Allows only one null value 3) What are the Differences between Clustered Indexes and Non-Clustered Indexes? S.No 1 2 3 Clustered Indexes It reorders the physical storage of records in the table There can be only one Clustered index per table The leaf nodes contain data Non-Clustered Indexes It sorts and maintain a separate storage More than one The leaf node contains pointer to data

4) What are the differences between Stored Procedures and User Defined Functions? S.No Stored Procedures User Defined Functions 1 Stored Procedure cannot be used User Defined Function can be used in in a Select statement a Select statement 2 Stored procedure supports User Defined Function does not Deferred Name Resolution support Deferred Name Resolution 3 Stored Procedures are generally User Defined Functions are generally used for performing Business used for Computations Logic 4 Stored Procedure need not return User Defined Functions should return a value a value 5 Stored Procedures can return any User Defined Functions cannot return datatype Image 6 Stored Procedures can accept User Defined Functions accept lesser more number of input parameters number of input parameters than than User Defined Functions. Stored Procedures. UDF can have Stored Procedures can have upto upto 1023 input parameters 21000 input parameters 7 Stored Procedures can use Temporary Tables cannot be used in a Temporary Tables User Defined Function 8 Stored Procedures can execute User Defined Functions cannot Dynamic SQL execute Dynamic SQL 9 Stored Procedure supports error User Defined Function does not handling support error handling. RAISEERROR or @@ERROR are

10

Non-deterministic functions can be used in Stored Procedures.

not allowed in UDFs Non-deterministic functions cannot be used in User Defined Functions (UDFs). For example, GETDATE() cannot be used in User Defined Functions(UDFs)

5) What are the differences between Where and Having clauses? S.No Where clause Having clause 1 It applies to individual rows It applies to a group as a whole 2 It selects rows before grouping It selects rows after grouping 3 It cannot contain aggregate It can contain aggregate functions functions 4 It can be used in select, delete It is used only in select clause ,insert etc. 6) What are the differences between Union and UnionAll? S.No Union UnionAll 1 This is used to eliminate duplicate It will not eliminate duplicate rows rows 2 This selects only distinct rows It selects all the values 3 It can be used to combine any It can be used to combine maximum number of queries of 2 queries 4 It cannot contain aggregate It can contain aggregate functions functions 7) What is the difference between normal Select statement and a Cursor? S.No Select statement Cursor 1 Select statements are used for Cursors are used for row-level table-level processing processing

1) What are the differences between Instead of Triggers and After Triggers? S.No Instead of Triggers After Triggers 1 Each table or view can have one A table can have several AFTER INSTEAD OF trigger for each triggers for each triggering action. triggering action (UPDATE, DELETE, and INSERT) 2 INSTEAD OF triggers fire in AFTER triggers fire after the place of the triggering action and triggering action (INSERT, UPDATE, before constraints are processed. or DELETE) and after any constraints are processed. 2) What are the differences between Views and User-Defined Functions? S.No Views User-Defined Functions 1 Views cannot accept parameters. User-Defined Functions can accept parameters. 2 Output of the Views cannot be Output of the User-Defined Functions directly used in the SELECT can be directly used in the SELECT clause. clause. 3) What are the differences between Triggers and Stored Procedures? S.No Triggers Stored Procedures 1 Triggers cannot return a value Stored Procedures may return a value 2 We cannot pass parameters in We can pass parameter in Stored Triggers Procedures 3 We can write a Stored procedure We cannot write a Trigger within a within a Trigger Stored Procedure 4 Triggers are implicitly fired Stored Procedures need to be whenever insert, update or delete explicitly called by the programmer operations take place on table 5 Triggers can only be implemented Stored procedures can be written for on Tables or Views the Database

1.Difference between Identity and Sequence in SQL Server 2012 S.No 1 2 Identity Dependant on table. Identity is a property in a table. Example : CREATE TABLE Table test_Identity ( [ID] int Identity (1,1), [Product Name] varchar(50) ) Sequence Independent from table. Sequence is an object. Example : CREATE SEQUENCE [dbo]. [Sequence_ID] AS [int] START WITH 1 INCREMENT BY 1 MINVALUE 1 MAXVALUE 1000 NO CYCLE NO CACHE 3 If we need a new ID from an identity column we need to insert and then get new ID. Example : Insert into [test_Identity] Values (‘SQL Server’) GO SELECT @@IDENTITY AS ‘Identity’ –OR Select SCOPE_IDENTITY() AS ‘Identity’ 4 We cannot perform a cycle in identity column. Meaning, we cannot restart the counter after a particular interval. In the sequence, we can simply add one property to make it a cycle. Example : ALTER SEQUENCE [dbo]. [Sequence_ID] In the sequence, we do not need to insert new ID, we can view the new ID directly. Example : SELECT NEXT VALUE FOR dbo.[Sequence_ID]

CYCLE; 5 We cannot cache Identity column property. Sequence can be easily cached by just setting cache property of sequence. It also improves the performance. Example : ALTER SEQUENCE [dbo]. [Sequence_ID] CACHE 3; 6 We cannot remove the identity column from the table directly. The sequence is not table dependent so we can easily remove it Example : Create table dbo.[test_Sequence] ( [ID] int, [Product Name] varchar(50) ) GO –First Insert With Sequence object INSERT INTO dbo.test_Sequence ([ID],[Product Name]) VALUES (NEXT VALUE FOR [Ticket] , ‘MICROSOFT SQL SERVER 2008′) GO –Second Insert without Sequence INSERT INTO dbo.test_Sequence ([ID],[Product Name]) VALUES (2 , ‘MICROSOFT SQL SERVER 2012′) 7 We cannot define the maximum value in identity column it is based on the data type limit. Here we can set up its maximum value. Example :

ALTER SEQUENCE [dbo]. [Sequence_ID] MAXVALUE 2000; 8 We can reseed it but cannot change the step size. Example : DBCC CHECKIDENT (test_Identity, RESEED, 4) We can reseed as well as change the step size. Example : ALTER SEQUENCE [dbo]. [Sequence_ID] RESTART WITH 7 INCREMENT BY 2; 9 We cannot generate range from identity. We can generate a range of sequence values from a sequence object with the help of sp_sequence_get_range.

2.Difference between Temp table and Table variable S.No 1 Temp table A Temp table is easy to create and back up data. Temp table result can be used by multiple users. Temp table will be stored in the tempdb. It will make network traffic. When we have large data in the temp table then it has to work across the database. A Performance issue will exist. Temp table can do all the DDL operations. It allows creating the indexes, dropping, altering, etc.., Table variable But the table variable involves the effort when we usually create the normal tables. But the table variable can be used by the current user only. But a table variable will store in the physical memory for some of the data, then later when the size increases it will be moved to the tempdb.

2 3

4

Whereas table variable won't allow doing the DDL operations. But the table variable allows us to create the clustered index only.

5

Temp table can be used for the But the table variable can be used up current session or global. So that a to that program. (Stored procedure) multiple user session can utilize the results in the table. Temp variable cannot use the But we cannot do it for table variable.

6

transactions. When we do the DML operations with the temp table then it can be rollback or commit the transactions. 7 Functions cannot use the temp variable. More over we cannot do the DML operation in the functions . The stored procedure will do the recompilation (can't use same execution plan) when we use the temp variable for every sub sequent calls. But the function allows us to use the table variable. But using the table variable we can do that. Whereas the table variable won't do like that.

8

Another Good Reference: http://sqljunkieshare.com/2011/11/05/difference-between-temporary-tables-and-table-variables/ 3.Difference between RAISERROR and THROW statements

S.No 1

RAISERROR Statement If a msg_id is passed to RAISERROR, the ID must be defined in sys.messages. The msg_str parameter can contain printf formatting styles. The severity parameter specifies the severity of the exception.

THROW Statement The error_number parameter does not have to be defined in sys.messages. The message parameter does not accept printf style formatting. There is no severity parameter. The exception severity is always set to 16.

2 3

4.Difference between Local temporary table and Global temporary table

S.No 1 2

Local temporary table Denoted by # symbol. Valid for the current connection only. They are cleared as soon as the current connection closes. Cannot be shared between multiple users.

Global temporary table Denoted by ## symbol. Available to all the connections once created. They are deleted when all users referencing the table disconnect from SQL Server . Can be shared between multiple users.

3

1.Difference between Correlated subquery and Nested subquery S.No 1 Correlated subquery Correlated subquery runs once for each row selected by the outer query. It contains a reference to a value from the row selected by the outer query. Correlated subquery follows down to top approach i.e., main query is executed first(even though parenthesis are present) and then child query. We can also say: in a Correlated subquery,Inner query condition is used in the outer query 4 Example: select e1.empname, e1.basicsal, e1.deptno from emp e1 where e1.basicsal = (select max(basicsal) from emp e2 where e2.deptno = e1.deptno) Nested subquery Nested subquery runs only once for the entire nesting (outer) query. It does not contain any reference to the outer query row. Nested subquery follows top-down approach i.e., child query is executed first and then parent . We can also say:In a subquery Outer query condition is used in the the inner query.

2

Example: select empname, basicsal, deptno from emp where (deptno, basicsal) in (select deptno, max(basicsal) from emp group by deptno)

2.Difference between Weak Entity Set and Strong Entity Set

S.No 1

Weak Entity Set An entity set which does not possess sufficient attributes to form a primary key is known as a weak entity set. Member of a weak entity set is a subordinate entity. Example: Specific Person,Company,Event,Plant

Strong Entity Set An entity set which does have a primary key is called a strong entity set. Member of a strong entity set is a dominant entity. Example: Set of all Persons,Companies,Trees,Holidays

2 3

3.Difference between char and varchar data types in Sql Server S.No 1 2 Char Fixed length memory storage CHAR takes up 1 byte per character Use Char when the data entries in a column are expected to be the same size like phone number Ex: Declare test Char(100); test="Test" Then "test" occupies 100 bytes first four bytes with values and rest with blank data Varchar Variable length memory storage(Changeable) VARCHAR takes up 1 byte per character, + 2 bytes to hold length information Use Varchar when the data entries in a column are expected to vary considerably in size like address Ex: Declare test VarChar(100); test="Test" Then "test" occupies only 4+2=6 bytes. first four bytes for value and other two bytes for variable length information.

3

4

4.Difference between Sql Server 2005 and Sql Server 2008 S.No 1 2 3 4 5 6 7 Sql Server 2005 XML datatype is introduced. Cannot encrypt the entire database. Datetime is used for both date and time. No table datatype is included. SSIS is started using. CMS is not available. PBM is not available Sql Server 2008 XML datatype is used. Can encrypt the entire database introduced in 2008. Date and time are seperately used for date and time Table datatype introduced. SSIS avails in this version. Central Management Server(CMS) is Introduced. Policy based management(PBM) server is Introduced.

1.Difference between Database Mail and SQL Mail S.No 1 2 3 4 Database Mail Based on SMTP (Simple Mail Transfer Protocol). Introduced in Sql Server 2005. No need to install Outlook. More secure than Sql mail. SQL Mail Based on MAPI (Messaging Application Programming Interface). Used prior versions of Sql Server 2005. Require Outlook to be installed. Less secure than Database mail.

2.Difference between Azure Table storage and SQL Azure S.No 1 Azure Table storage It is built on top of the Azure Storage platform. SQL Azure It is an SQL Server that has been configured to be hosted on top of the Windows Azure in a high availability mode. It comprises standard SQL Tables with indexes and referential integrity.

2

It comprises flexible or schemaless entities. No referential integrity between the tables, and no custom indexes. It can scale massive amounts of data due to the partition key. Can be thought as single spreadsheet.

3 4

It may not scale as far as Azure Table storage. Look familiar to any .Net developer who has used Sql server 2008 prior.

3.Difference between DBMS and RDBMS S.No 1 2 DBMS Stands for DataBase Management System In dbms no relationship concept RDBMS Stands for Relational DataBase Management System It is used to establish the relationship concept between two database objects, i.e, tables It supports multiple users It treats data as Tables internally It supports minimum 6 rules of E.F.CODD It requires High software and

3 4 5 6

It supports Single User only It treats Data as Files internally It supports 3 rules of E.F.CODD out off 12 rules It requires low Software and

Hardware Requirements. 7 8 DBMS is used for simpler business applications DBMS does not impose any constraints or security with regard to data manipulation In DBMS Normalization process will not be present There is no enforcement to use foreign key concept compulsorily in DBMS FoxPro, IMS are Examples

hardware requirements. RDBMS is used for more complex applications. RDBMS defines the integrity constraint for the purpose of holding ACID PROPERTY In RDBMS, normalization process will be present to check the database table consistency Although the foreign key concept is supported by both DBMS and RDBMS but its only RDBMS that enforces the rules SQL Server, Oracle are examples

9

10

11

4.Difference between SQL Server 2000 and SQL Server 2005 S.No 1 2 3 4 5 6 7 8 9 SQL Server 2000 Query Analyser and Enterprise manager are separate. No XML datatype is used. We can create maximum of 65,535 databases. Exception Handling mechanism is not available There is no Varchar(Max) data type is not available DDL Triggers is not available DataBase Mirroring facility is not available RowNumber function for paging is not available Table fragmentation facility is not available Full Text Search facility is not available SQL Server 2005 Both are combined as SSMS(Sql Server management Studio). .XML datatype is introduced. We can create 2(pow(20))-1 databases. Exception Handling mechanism is available Varchar(Max) data type is introduced. DDL Triggers is introduced DataBase Mirroring facility is introduced RowNumber function for paging is introduced Table fragmentation facility is introduced Full Text Search facility is introduced

10

11 12 13 14 15

Bulk Copy Update facility is not available Data Encryption concept is not introduced Cannot compress the tables and indexes. No varchar(max) or varbinary(max) is available.

Bulk Copy Update facility is introduced .Cannot encrypt the entire database Can Compress tables and indexes. (Introduced in 2005 SP2) Varchar(max) and varbinary(max) is used.

Data Transformation SQL Server Integration Services(SSIS) Services(DTS) is used as ETL tool is started using from this SQL Server version and which is used as ETL tool

WCF Difference FAQs-1.pdf WCF Difference FAQs-2.pdf

Difference between basicHttpBinding and wsHttpBinding Criteria BasicHttpBinding WsHttpBinding This exposes web services using WS-* specifications. As its built using WS-* specifications, it does not support wider ranges of client and it cannot be consumed by older .NET version less than 3 version.

Security This supports the old ASMX style, i.e. WS-BasicProfile 1.1. support Compatibility This is aimed for clients who do not have .NET 3.0 installed and it supports wider ranges of clients. Many of the clients like Windows 2000 still do not run .NET 3.0. So older version of .NET can consume this service. Soap version SOAP 1.1 Reliable messaging Not supported. In other words, if a client fires two or three calls you really do not know if they will return back in the same order. By default, there is no security provided for messages when the client calls happen. In other words, data is sent as plain text. None Windows – default authentication Basic Certificate

SOAP 1.2 and WS-Addressing specification. Supported as it supports WS-* specifications.

Default security options Security options

As WsHttBinding supports WS-*, it has WS-Security enabled by default. So the data is not sent in plain text. None Transport Message Transport with message credentials

Difference between Message and Transport level security in WCF Criteria Scenarios when we should be using one of them Transport Security When there are no intermediate systems in between this is the best methodology. Message Security

When there are intermediate systems like one more WCF service through which message is routed then message security is If it’s an intranet type of solution the way to go. this is most recommended methodology. Does not need any extra coding as protocol inherent security is used. Performance is better as we can use hardware accelerators to enhance performance. There is lot of interoperability support and communicating Provides end to end security as it’s not dependent on protocol. Any intermediate hop in network does not affect the application. Supports wide set of security options as it is not dependent on protocol. We can also implement custom security.

Advantages

clients do not need to understand WS security as it’s built in the protocol itself. Disadvantages As it’s a protocol implemented Needs application refactoring to security so it works only point to implement security. point. As every message is encrypted As security is dependent on and signed there are performance protocol it has limited security issues. support and is bounded to the protocol security limitations. Does not support interoperability with old ASMX webservices

Difference between Buffered transfer and Streamed transfer in WCF S.No 1 2 3 Buffered Transfer Target can process the message once it is completely received. Performance will be good when message size is small Native channel shape is IDuplexSessionChannel Streamed Transfer Target can start processing the data when it is partially received. Performance will be good when message size is larger(more than 64K) Native channels are IRequestChannel and IReplyChannel

Difference between WCF and Web Services S.No 1 Features Hosting WebService It can be hosted in IIS WCF t can be hosted in IIS, windows activation service, Self-hosting, Windows service [ServiceContract] attribute has to be added to the class [OperationContract] attribute represents the method exposed to client One-Way, RequestResponse, Duplex are different type of operations supported in WCF System.Runtime.Seriali zation namespace is used for serialization XML 1.0, MTOM, Binary, Custom

2 3

Programming Model

[WebService] attribute has to be added to the class [WebMethod] attribute represents the method exposed to client One-way, RequestResponse are the different operations supported in web service System.Xml.serialization name space is used for serialization XML 1.0, MTOM(Message Transmission Optimization Mechanism), DIME, Custom

4

Operation

5 6

XML Encoding

7

Transports

Can be accessed through HTTP, TCP, Custom Security Web Services are stateless

8 9

Protocols State Management

Can be accessed through HTTP, TCP, Named pipes, MSMQ,P2P, Custom Security, Reliable messaging, Transactions WCF Services can manage states

Difference between Self Hosting and IIS Hosting Feature Coding Effort Deployment Recycling Service Lifetime Host Process Self Hosting IIS Hosting extra code

We need to add some extra code No need to add to host the process Automatic hosting Easy to deploy

More difficult to deploy than SelfHosting process recycling be is

Automatic process recycling is Automatic not possible possible

Can control the service lifetime Lifetime cannot using Open and Close methods manually.

controlled

Host process should be running IIS host runs automatically when a before client makes a call to the client makes a call to the service. service.

Difference between Behaviour and Contract (OR) Difference between Service Behaviour and Service Contract

Feature Behaviour Applicability Impact on WSDL

ServiceContract

ServiceBehavior

Affects the behavior of both Only affects the behavior of the client and server server Can apply to both interface and Only applicable class implementation Affects the WSDL emitted to a class

Does not affect the WSDL

Difference between proxy and channel factory Proxy Only requires URL where the service resides Very simpler Easy to understand There is Visual Studio gives us add the reference Channel Factory We must have direct access to the assembly that contains that service contract T for Not easier Channels are complex, network-related When we share a common service contract dll between the client and the server, we will be using the ChannelFactory class If we know that our entities will not change much and the client code is less, then a DLL would work better than a proxy

Proxies have several restrictions like: 1. Properties need to have gets and sets 2. Contructors cannot be exposed 3. Methods other than the service contract cannot be exposed By using SVCutil.exe we will create Proxy

When we are using DLL that refers Service contract interface then use the channel factory class

Difference between DataContractSerializer and XMLSerializer DataContractSerializer A practical benefit of the design of the DataContractSerializer is better performance over Xmlserializer. This is because DataContratSerializer explicitly shows the which fields or properties are serialized into XML. XMLSerializer XMLSerializer does not provide better performance when compare with DataContratSerializer because XMLSerializer does not indicate which fields or properties of the type are serialized into XML

The DataContractSerializer can translate the XMLSerializer cannot translate the HashTable into HashTable into XML. XML. DataContractSerializer is basically for very XMLSerializer is used for complex schemas. small, simple subset of the XML infoset. DataContractSerializer members. serializes private XmlSerializer cannot serialize private members

DataContractSerializer uses the opts-in XmlSerializer uses opts-out approach i.e., marking approach i.e, selecting the members that the members do not need to be serialized. This is needs to be serialized .This is called as opts- called as opts-out approach. in approach. DataContractSerializer can serialize both XmlSerializer can serialize only public types. If private and public types. we are trying to serialize a class that is marked private by InvalidOperation Exception will be thrown by the serializer. DataContractSerializer does not need any For any types that needs to be serialized by default constructor before serializing any XmlSerializer must have a default constructor. type.

DataContractSerializer does not give more XmlSerializer gives more control over the control over the generated xml structure generated xml structure compared to the compared to the XmlSerializer. DataContractSerializer. For ex, if a field should come as an attribute or element. DataContractSerializer can able to serialize XmlSerializer cannot able to serialize types that types that implements Idictionary. implements IDictionary, for ex. Dictionary type cannot be serialized. We can serialize a type that marked with [Serializable] attribute with DataContractSerializer. It serializes all the members (private, public) even they are marked with [XmlIgnore]. WCF uses DataContractSerializer attribute Only the public members are serialized not the private members. Suppose we do not need any of the member to be serialized we can use [XmlIgnore] attribute Webservice uses XMLSerializer attribute

1) What are the differences between DataReader and DataAdapter? S.No 1 2 3 4 DataReader Works in Connected Mode Can have only one record at a time Is ForwardOnly and Readonly Faster DataAdapter Works in Disconnected Mode Can have more than 1 records Can navigate front and back and editable Slower

2) What are the differences between DataSet and DataReader? S.No 1 2 3 4 5 DataSet Works in Disconnected Mode Can navigate back and forth Data is editable Can contain more than one table and relationships Slower as having more overhead DataReader Works in Connected Mode Can navigate forward only Data is Readonly Can contain only one row at a time Faster when compared with DataSet

3) What is the difference between DataSet.Copy() and DataSet.Clone()? S.No 1 DataSet.Copy() DataSet.Copy() copies both the structure and data DataSet.Clone() DataSet.Clone() copies the structure of the DataSet, including all DataTable schemas, relations, and constraints and it does not copy any data

4) What are the differences between RecordSet and DataSet? S.No 1 2 3 4 RecordSet RecordSet provides data of one row at an instant RecordSet always needs an Open connection to read the data from data sources RecordSet is able to load the structure and data of only one table at a time RecordSet does not support constraints of Databases DataSet DataSet is a data structure which represents the complete table data at the same time DataSet needs connection only for retrieving the data. After retrieve the data connection is not necessary DataSet has the capability to store the structure and data of multiple tables at a time DataSet enforces data integrity by using Constraints

5) What are the differences between ADO and ADO.Net? S.No ADO ADO.Net

1 2 3

It supports connected model It uses record set XML support is less

It supports disconnected model It uses data set XML support is more

New features of ASP.Net 2.0, ASP.Net 3.0 and ASP.Net 3.5- A Comparative Chart

SNo 1

ASP.Net 2.0 ASP.Net 3.0 ASP.Net 3.5 a) Generics a) Windows a) Linq for SQL, XML, Dataset, b) Anonymous Communication Object methods Foundation (WCF), b) Addin system c) Partial class formerly called c) p2p base class d) Nullable type Indigo; a serviced) Active directory e) The new API gives oriented messaging e) ASP.NET Ajax a fine grain control system which allows f) Anonymous types with on the behavior of programs to static type inference the runtime with interoperate locally g) Paging support for regards to or remotely similar to ADO.NET multithreading, web services. h) ADO.NET synchronization memory b) Windows API to synchronize local allocation, Presentation caches and server side assembly loading Foundation (WPF), datastores. and more formerly called i) Asynchronous network I/O f) Full 64-bit support Avalon; a new user API for both the x64 interface subsystem j) Support for HTTP and the IA64 and API based on pipelining and syndication hardware XML and vector feeds. platforms graphics, which uses k) New System.CodeDom g) New 3D computer namespace. personalization graphics hardware features for and Direct3D ASP.NET, such as technologies. support for c) Windows Workflow themes, skins and Foundation (WF) webparts. allows for building of h) .NET Micro task automation and Framework integrated transactions using workflows. d) Windows CardSpace, formerly called InfoCard; a software component which securely stores a person's digital identities and

provides a unified interface for choosing the identity for a particular transaction, such as logging in to a website

Difference between ASP.Net 2.0 and ASP.Net 3.5 SN o 1 Feature New Features ASP.Net 2.0 ASP.Net 2.0 includes the following as new features, a) Master Pages b) Profiles c) GridView Control ASP.Net 2.0 does not support Multi-Targeting environment. ASP.Net 3.5 ASP.Net 3.5 includes the following as new features, a) ListView Control b) DataPager Control c) Nested Master Pages
d) LinqDataSource Control

2

Multitargeting

3

AJAX Support

There is no in-built support for AJAX in ASP.Net 2.0. Instead, it has to be downloaded and installed. It does not support Siverlight. It does not provide Javascript debugging. It does not support LINQ.

4 5 6

Siverlight Support Javascript Debugging LINQ Support

ASP.Net 3.5 supports multitargeting. It means that we choose from a drop-down list whether to have Visual Studio 2008 build applications against the ASP.NET 2.0, 3.0, or 3.5 frameworks. In ASP.Net 3.5, AJAX is integrated into the .NET Framework, thereby making the process of building intuitive cool user interfaces easier. It supports Siverlight. It provides Javascript debugging. It Supports Language Integrated Query (LINQ).

For further updates,please visit my below provided blog
http://onlydifferencefaqs.blogspot.in/

Master your semester with Scribd & The New York Times

Special offer for students: Only $4.99/month.

Master your semester with Scribd & The New York Times

Cancel anytime.