Dotnet difference questions & answers Compiled-1(updated)
Upcoming SlideShare
Loading in...5
×
 

Dotnet difference questions & answers Compiled-1(updated)

on

  • 3,352 views

This provides huge collection (150+) of DOTNET Technology FAQs which are of "Difference Between" type.

This provides huge collection (150+) of DOTNET Technology FAQs which are of "Difference Between" type.

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

Statistics

Views

Total Views
3,352
Views on SlideShare
3,348
Embed Views
4

Actions

Likes
2
Downloads
76
Comments
0

3 Embeds 4

http://pinterest.com 2
http://ragupathyp.wordpress.com 1
http://www.pinterest.com 1

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Dotnet difference questions & answers Compiled-1(updated) Document Transcript

  • 1. 1) What are the differences between DataReader and DataAdapter? S.No DataReader DataAdapter 1 Works in Connected Mode Works in Disconnected Mode 2 Can have only one record at a time Can have more than 1 records 3 Is ForwardOnly and Readonly Can navigate front and back and editable 4 Faster Slower2) What are the differences between DataSet and DataReader? S.No DataSet DataReader 1 Works in Disconnected Mode Works in Connected Mode 2 Can navigate back and forth Can navigate forward only 3 Data is editable Data is Readonly 4 Can contain more than one table Can contain only one row at a time and relationships 5 Slower as having more overhead Faster when compared with DataSet3) What is the difference between DataSet.Copy() and DataSet.Clone()? S.No DataSet.Copy() DataSet.Clone() 1 DataSet.Copy() copies both the DataSet.Clone() copies the structure of structure and data the DataSet, including all DataTable schemas, relations, and constraints and it does not copy any data4) What are the differences between RecordSet and DataSet? S.No RecordSet DataSet 1 RecordSet provides data of one row DataSet is a data structure which at an instant represents the complete table data at the same time 2 RecordSet always needs an Open DataSet needs connection only for connection to read the data from retrieving the data. After retrieve the data sources data connection is not necessary 3 RecordSet is able to load the DataSet has the capability to store the structure and data of only one table structure and data of multiple tables at a at a time time 4 RecordSet does not support DataSet enforces data integrity by using constraints of Databases Constraints5) What are the differences between ADO and ADO.Net? S.No ADO ADO.Net
  • 2. 1 It supports connected model It supports disconnected model2 It uses record set It uses data set3 XML support is less XML support is more
  • 3. 1.Difference between Typed DataSet and Untyped DataSet S.No Typed DataSet Untyped DataSet 1 It provides additional methods, It is not as easy to use as strongly properties and events and thus it typed dataset. makes it easier to use. 2 They have .xsd file (Xml Schema They do not do error checking at the definition) file associated with design time as they are filled at run them and do error checking time when the code executes. regarding their schema at design time using the .xsd definitions. 3 We will get advantage of We cannot get an advantage of intelliSense in VS. NET. intelliSense. 4 Performance is slower in case of Performance is faster in case of strongly typed dataset. Untyped dataset. 5 In complex environment, strongly Untyped datasets are easy to typed datasets are difficult to administer. administer. 6 Typed DataSets use explicit UnTyped DataSets use table and names and DataTypes for their column collections for their members members. ex: ex: ds.Tables["emp"].Columns["eno"].Rea northwindDataSet.Products.Produ dOnly=true; ctNameColumn.Caption = "pnames";2.Difference between DataView and DataTable S.No DataView DataTable 1 Read-only i.e., DataView can be Read/Write i.e., Datatable can be used used to select the data. to edit or select or delete or insert a data. 2 Is a reference to an existing Can be created empty and then DataTable. Cannot be populated populated from scratch; must be instantiated with a reference to an existing DataTable. 3 Data is a reference to an existing Data takes storage space. DataTable, and does not consume space.
  • 4. 4 Can sort or filter rows without Can add/edit/delete rows, columns, modifying the underlying data. and data, and all changes are Rows and columns can be hidden persistent. and revealed repeatedly. 5 Can return a DataTable version Can be cloned of the view 6 A live reference to a Is source data; does not contain DataTable; any changes in the references DataTable data is immediately reflected in the view. 7 Supports calculated columns, Does not support calculated columns which are columns with a value calculated on the fly by combining or manipulating other columns. 8 Can hide or show selected No row or column hiding columns3.Difference between Connected and Disconnected Environment S.No Connected Environment Disconnected Environment 1 Connected Environment needs a Disconnected Environment does not constantly connection of user to need any connection. data source while performing any operation. 2 Only one operation can be Multiple operations can be performed. performed at a time in connection Environment. 3 DataReader is used in Connection DataSet is used in it. Environment. 4 It is slower in speed. Disconnected Environment has a good speed. 5 We get updated data in it. There is a problem of dirty read.Please visit my blog @ http://onlydifferencefaqs.blogspot.in/
  • 5. 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 file2) 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 made3) 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 client- server-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 No4) 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 required5) 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
  • 6. 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  Page Output Caching like Cache object  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 users6) 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 garden7) 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 application8) 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 drive9) 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 appropriate10) 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
  • 7. 2 This is built in structure for This is not an inbuilt structure maintaining state of a page 3 Security is more as data is hashed, Security is less when compared to compressed and encoded ViewState11) 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 changed12) 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 time13) 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() method14) 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 page15) 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 tag16) 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
  • 8. 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 controls18) 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 file19) 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 file20) 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 server21) 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 window22) 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 application23) 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
  • 9. 3 We can have more than one Only one machine.config file exists web.config file on a server4 This file inherits setting from the This file is at the highest level in the machine.config configuration hierarchy
  • 10. Difference between Web site and Web application S.No Web site Web application 1 Can mix vb and c# page in single We cant include c# and vb page in single website. web application. 2 Can not establish dependencies. We can set up dependencies between multiple projects. 3 Edit individual files after Can not edit individual files after deployment. deployment without recompiling. 4 Right choice when one developer Right choice for enterprise environments will responsible for creating and where multiple developers work unitedly for managing entire website. creating,testing and deployment. i.e.,In web site development, i.e.,In Web application, different different decoupling is not possible. groups work on various components independently like one group work on domain layer, other work on UI layer. 5 Web site is easier to create than Web Web application is more difficult to create application than a Web siteDifference between Local storage and cookies S.No Local storage Cookies 1 Good to store large amount of data, Good for small amount of data, up to 4KB up to 4MB 2 Easy to work with the JavaScript Difficult to work with JavaScript 3 Local storage data is not sent to the All data is transferred to and from server, so server on every request (HTTP bandwidth is consumed on every request header) as it is purely at the client side 4 No way to specify the time out Can specify timeout period so that cookies period as the Cookies have data are removed from browserDifference between Session and Cache S.No Session Cache 1 Ssession retains state per user Cache is used for retaining state for application scoped items. 2 Items put into a session will stay Items in the cache can expire (will be there, until the session ends 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).
  • 11. Difference between Datalist and Repeater S.No Datalist Repeater 1 Datalist supports multiple columns Repeater doesnt support multiple columns displaying and using repeat columns display,no repeat columns property property 2 Datalist supports styles for formating Repeater does not provide styles templates data[headerstyle,...] 3 Datalist rendering output[html Repeater performanace is better than Datalist content]will be slow compare with repeater.Summary:If the requirement can achieve using repeater and datalist,choose repeater for better performance
  • 12. 1.Difference between ASP.NET and PHP S.No ASP.NET PHP 1 Technology Availability: Technology Availability: ASP.NET was launched by PHP was launched by Rasmus Lerdorf Microsoft in the year 2002. in the year 1995. 2 Database: Database: ASP.Net uses MS-SQL for For point of database connectivity PHP connecting database but MS-SQL uses MySQL for the purpose of can not be availed free from database connectivitybecasue its Microsoft. highly flexiblilty nature. Another important fact is that it will incurextra expenditure because MySQL can be accessed for free. 3 Cost: Cost: We need to install Internet Linux can be used for running PHP Information Server (IIS)on a programs and Linux is free operating Windows server platformif you system. Therefore,the cost of want to run ASP.Net program. As developing a website in PHP language Windows server platform is not a is remarkably low free product,the cost of production is bounded to be increased. 4 Run Time : Run Time: It has been observed that ASP.Net Whereas inbuilt memory space is used code runs slower than PHP code. by PHP while running. This is becauseASP.Net utilizes server space while running 5 Coding Simplicity: Coding Simplicity: ASP.Net codes are somewhat PHP codes are very simple and a complicated and a web developer programmer does not haveto make a needs to work hard to get the hang diligent effort because it is of it comparatively easier than other types of programming languages. 6 Platform Connectivity Issue : Platform Connectivity Issue: ASP.NET codes are usually run on PHP has a unique advantagein this Windows platforms but if you issue. Its codes can be linked with install ASP-Apache inthe server different types of platforms such than it can run on Linux platform asWindows, Linux and UNIX. as well. 7 Cost of Tools : Cost of Tools :
  • 13. There is no such free tools are PHP codes are available for free in available for ASP.Net. various forums and blogs as it is a open source software. Furthermore, some useful tools that can be used in PHP are also availablefor free 8 Language Support : Language Support : The syntax of ASP.Net is more or The codes that are used in PHP are less similar to that of Visual basic very much similar to that of C++ syntax and this is all but simple. language and its syntax resembles the syntax used in C and C++. Therefore, if you have a fair knowledge in C++ or C, you will not face any difficulty while coding PHP language. 9 Security : Security : ASP. Net is reputedfor creating Though PHP can offer enough sophisticated techniques to ensure measures for ensuring data security the safety of confidential data.This is the reason why government organizations opt for ASP.Net.2.Difference between ASP and ASP.NET S.No ASP ASP.NET 1 ASP is a request response model. ASP.NET is a programming model that is event driven. 2 ASP code is an interpreted ASP.NET is a compiled CLR code that language that is interpreted by the will be executed on the Server. script engine. 3 HTML and the coding logic are The code and design logic is separated mixed in ASP. in ASP.NET. 4 To develop and debug ASP ASP.NET application can be application, there are very limited developed and debugged using various tools. tools including the leading Visual Studio .NET tool. 5 ASP has limited support to Object ASP.NET is a complete Object Oriented Programming principles. Oriented Programming language. 6 Session management and ASP.NET extends complete support application state management is for session management and
  • 14. very limited in ASP. application state management. 7 Error handling system is poor in ASP.NET offers complete error ASP. handling and exception handling services. 8 ASP does not offer any in-built In ASP.NET, data exchange is easily support for the XML. performed using XML support. 9 Data source support is not fully Data source support is fully distributed distributed in ASP. in ASP.NET.3.Difference between ASP.NET and VB.NET S.No ASP.NET VB.NET 1 ASP.NET is web technology that VB.NET is a language that is used in is used in building web writing programs that are utilizing the applications and websites. ASP.NET framework. 2 ASP.NET is a server side VB.NET is a .NET programming technology that is language language. VB.NET is used to create independent. Any .NET languages ASP.NET web applications or such as C#, VB.NET can be used windows applications using Visual to develop web applications Studio Windows Forms Designer or through ASP.NET. mobile applications or console applications or applications for variety of other purposes. 3 ASP.NET is included within VB.NET is not part of .NET the .NET framework. framework. For example, ASP.NET contains For example, VB.NET is the code that the text boxes and the controls is written on various events of text that can be dragged and dropped boxes and controls to make them into a web form. function as per the requirement. 4 ASP.NET contains server VB.NET does not include server controls. controls. 5 ASP.NET can support all .NET VB.NET can support only scripting languages. languages.
  • 15. 4.Difference between Java and .NET S.No Java .NET 1 JAVA is developed by ‘Sun .NET is developed by ‘Microsoft’. Microsystem‘ 2 JAVA is a programming .NET is a framework that supports language many programming languages like C#,ASP,VB. 3 In JAVA, JVM(Java Virtual In .NET CLR(common language Machine) execute the code and Runtime) execute the code with two convert source code to byte code. phase compilation. 4 JAVA can run on any operating .NET can run only on windows/IIS. system 5 But in JAVA it depends upon the Although .NET support both explicit programmer to destroy the and implicit garbage garbage memory. collection,especially,in .NET the garbage collector destroy the garbage value in an efficient manner as compared to JAVA. 6 JDBC is used for database ADO .NET is use for database connection in JAVA connection in .NET. 7 For java many third party IDEs .net has a standard development IDE are available. i.e. Microsoft Visual Studio 8 But web application in java run on Both windows and web applications any operating system. can developed by .net but it will be more better to go for windows application with .NET . you can also go for web application with .NET but it will only hosted on windows server. 9 Exception Handling in Java is Exception Handling in .NET is harder than .NET simpler than JAVA. 10 JAVA uses bootclasspath for .NET uses GAC(Global Assembly completely trusted codes. Cache) and keep trusted assemblies. 11 Java is less secure than .NET JAVA and .NET both have similar while providing security security goals. But .NET is more secure because of its simple and clean designs. 12 Java JDBC which requires .Net due to disconnected data access multiple round trips to data base. through ADO.Net has high level of Hence, performance is lesser performance against Java JDBC than .NET
  • 16. 13 Development is comparatively Due to Microsoft Visual Studio, slower. development is faster. 14 Java applications development Microsoft Visual Studio installation can be done on even less requires higher configuration system. configuration computer system. 15 Java can only communicate with .Net is the platform itself for a java programs multitude of languages. One can use C, C++ and VB to program upon .net. These programs interact with each other using common methods. these common methods are defined by .Net, and are used by the programs to communicate with each other without worry about that language the program was written in. the machine running the program/s will need the .Net platform to be installed.Please visit my blog @ http://onlydifferencefaqs.blogspot.in/
  • 17. 1.Difference between HTTP and HTTPS S.No HTTP HTTPS 1 URL begins with “http://" in case URL begins with “https://” in case of of HTTP HTTPS. 2 HTTP is unsecured HTTPS is secured. 3 HTTP uses port 80 for HTTPS uses port 443 for communication communication. 4 HTTP operates at Application HTTPS operates at Transport Layer. Layer 5 No encryption is there in HTTP HTTPS uses encryption. 6 No certificates required in HTTP certificates required in HTTPS. 7 Most internet forums will HTTPS should be used in Banking probably fall into this category. Websites, Payment Gateway, Shopping Because these are open discussion Websites, Login Pages, Emails (Gmail forums, secured access is offers HTTPS by default in Chrome generally not required browser) and Corporate Sector Websites. For example: PayPal: https://www.paypal.com Google AdSense: https://www.google.com/adsense/2.Difference between GET and POST methods S.No GET POST 1 Post Mechanism: Post Mechanism: GET request is sent via URL. Post request is sent via HTTP request body or we can say internally. 2 Form Default Method: Form Default Method: GET request is the default We have to specify POST method method. within form tag like <Form method="POST"....... 3 Security: Security: Since GET request is sent via Since Post request encapsulated name URL, so that we can not use this pair values in HTTP request body, so method for sensitive data. that we can submit sensitive data through POST method.
  • 18. 4 Length: Length: GET request has a limitation on POST request has no major limitation. its length. The good practice is never allow more than 255 characters. 5 Caching or Bookmarking: Caching or Bookmarking: GET request will be better for POST request is not better for caching caching and bookmarking. and bookmarking. 6 SEO: SEO: GET request is SEO friendly. POST request is not SEO friendly. 7 Data Type: Data Type: GET request always submits data POST request has no restriction. as TEXT. 8 Best Example: Best Example: SEARCH is the best example for LOGIN is the best example for POST GET request. request. 9 HTTP Request Message HTTP Request Message Format: Format: 1 POST /path/script.cgi HTTP/1.0 1 GET /path/file.html? 2 From: umarali1981@gmail.com SearchText=Interview_Question 3 User-Agent: HTTPTool/1.0 HTTP/1.0 4 Content-Type: application/x-www- 2 From: umarali1981@gmail.com form-urlencoded 3 User-Agent: HTTPTool/1.0 5 Content-Length: 8 4 [blank line here] 6 7 Code=132Some comments on the limit on QueryString / GET / URL parameters Length:1. 255 bytes length is fine, because some older browser may not support more than that.2. Opera supports ~4050 characters.3. IE 4.0+ supports exactly 2083 characters.4. Netscape 3 -> 4.78 support up to 8192 characters.5. There is no limit on the number of parameters on a URL, but only on the length.6. The number of characters will be significantly reduced if we have special characters like spacesthat need to be URLEncoded (e.g. converted to the %20).7. If we are closer to the length limit better use POST method instead of GET method.
  • 19. 3.Difference between User Controls and Master Pages S.No User Controls Master Pages 1 Its extension is .ascx. Its extension is .Master. 2 Code file: .ascx.cs or .ascx.vb code file: .master.cs or .master.vb extension 3 A page can have more than one Only one master page can be assigned User Controls. to a web page 4 It does not contain It contains ContentPlaceHolder. Contentplaceholder and this makes it somewhat difficult in providing proper layout and alignment for large designs. 5 Suitable for small designs(Ex: More suitable for large designs(ex: logout button on every .aspx defining the complete layout of .aspx page.) page) 6 Register Tag is added when we MasterPageFile attribute is added in drag and drop a user control onto the Page directive of the .aspx page the .aspx page. when a Master Page is referenced in .aspx page. 7 Can be attached dynamically Can be referenced using Web.Config using LoadControl method.PreInit file also or dynamically by writing event is not mandatory in their code in PreInit event. case for dynamic attachment.4.Difference between Build and Rebuild S.No Build Rebuild 1 A build compiles only the files A rebuild rebuilds all projects and files and projects that have changed. in the solution irrelevant of whether they have changed or not. 2 Build does not updates the xml- Rebuild updates the xml- documentation files documentation filesNote: Sometimes,rebuild is necessary to make the build successful. Because, Rebuild cleansSolution to delete any intermediate and output files, leaving only the project and component files,from which new instances of the intermediate and output files can then be built.
  • 20. 5.Difference between generic handler and http handler S.No Generic Handler Http Handler 1 Generic handler has a handler http handler is required to be which can be accessed by url with configured in web.config against .ashx extension extension in web.config.It does not have any extension 2 Typical example of generic For http handler, page handler which handler are creating thumbnails of serves .aspx extension request and give images response.Please visit my blog @ http://onlydifferencefaqs.blogspot.in/
  • 21. 1.Difference between ViewState and SessionState S.No ViewState SessionState 1 View state is maintained in page Session state is maintained in session level only. level. 2 View state of one page is not Session state value is available in all visible in another page.i.e., when pages within a user session.i.e., The user requests another page data will be no longer available if user previous page data will be no close the browser or session timeout longer available. occurs. 3 View state information stored in Session state information stored in client only. server. 4 View state persist the values of Session state persist the data of particular page in the client particular user in the server. This data (browser) when post back available till user close the browser or operation done. session time completes. 5 View state used to persist page- Session state used to persist the user- instance-specific data. specific data on the server side.2.Difference between ViewState and ControlState S.No ViewState ControlState 1 ViewState can be disabled Control State cannot be disabled. 2 ViewState is implemented by Control State works even when using EnableViewState property EnableViewState is off. of a control to true. To use Control State (for example in a custom control) we have to override OnInit method,call RegisterRequiresControlState method in OnInit method and then override the SaveControlState and LoadControlState methods. 3 ViewState is used to maintain Control State is used for small data page-level state for large data only. eg: maintain clicked page number in a GridView even when EnableViewState is off
  • 22. 3.Difference between SessionState and Cookies S.No SessionState Cookies 1 Session can store any type of data Cookies can store only "string" because the value is of datatype of datatype "object" 2 These are stored at Server side They are stored at Client side 3 Session are secured because it is Cookie is non-secure since stored in stored in binary format/encrypted text format at client side form and it gets decrypted at server 4 Session is independent for every Cookies may or may not be individual client i.e individual for every for every client client 5 There is no limitation on size or Due to cookies network traffic will number of sessions to be used in increase.Size of cookie is limited to 40 an application and number of cookies to be used is restricted to 20. 6 For all conditions/situations we Only in few situations we can use can use sessions cookies because of no security 7 We cannot disable the We can disable cookies sessions.Sessions can be used without cookies also(by disabling cookies) 8 The disadvantage of session is Since the value is string there is no that it is a burden/overhead on security server 9 Sessions are called as Non- We have persistent and non-persistent Persistent cookies because its life cookies time can be set manuallyPlease visit my blog @ http://onlydifferencefaqs.blogspot.in/
  • 23. New features of ASP.Net 2.0, ASP.Net 3.0 and ASP.Net 3.5- AComparative ChartSNo ASP.Net 2.0 ASP.Net 3.0 ASP.Net 3.51 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 service- d) 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 persons digital identities and
  • 24. provides a unifiedinterface forchoosing the identityfor a particulartransaction, such aslogging in to awebsite
  • 25. 1.Difference between C# 3.5 and C# 4.0 S.No C# 3.5 C# 4.0 1 C# 3.5 does not support dynamic C# 4.0 supports dynamic programming programming. through dynamic objects. 2 The dynamic keyword is not In C# 4.0, dynamic keyword is recognized in C# 3.5. associated with objects to represent them as dynamic objects. 3 Dynamic variables cannot be C# 4.0 allows creation of dynamic created in C# 3.5. variables. 4 In C# 3.5, method parameters In C# 4.0, the method parameters can cannot be specified with default be specified with default values using values. C# 3.5 does not support optional parameters. optional parameters. 5 In C# 3.5, method parameters C# 4.0 provides named parameters to have to be specified in the same represent the values of method order as in method declaration in parameters without following the order the method call. C# 3.5 does not of declaration. provide named parameters. 6 In C# 3.5, usage of ref keyword is In C# 4.0, usage of ref keyword is mandatory while executing optional while executing methods methods which are supplied by which are supplied by the COM the COM interfaces. interfaces. 7 The COM object’s indexed The COM object’s indexed properties properties are not recognized in are recognized in C# 4.0. C# 3.5. 8 Co-variance and contra-variance C# 4.0 enhances Generics by are not supported in Generics of introducing co-variance and contra- C# 3.5. variance.2.Difference between C# and VB.NET S.No C# VB.NET 1 In C#, variables are declared using In VB.NET, the variables are declared declarators. using keywords such as private, protected, friend, public, static, shared and Dim. 2 In C#, an object can only be In VB.NET, an object can be created created using new. using new and CreateObject(). 3 In C#, void is specified as the In VB.NET, Sub is used in method return type when a method does declaration to indicate that the method
  • 26. not return a value. does not return any value.4 In C#, no keyword is required to In VB.NET, Overloads keyword is indicate an overloaded method. used to indicate an overloaded method.5 The current object is referred The current object is referred as me in using this pointer in C#. VB.NET.6 Non virtual call cannot be made in To make a non-virtual call to the C#. current object’s virtual method, MyClass is used in VB.NET.7 Compound data type is declared Compound data type is declared in in C# using class, struct and VB.NET using Structure. interface.8 In C#, constructors are used to In VB.NET, Sub New() is used to initialize an object. initialize the newly created object.9 Object cleanup can be explicitly Object cleanup can be done by using done by destructor in C#. Finalize method in VB.NET.10 In C#, an object is subject to In VB.NET, an object cannot be asynchronous modification using modified in an asynchronous way. volatile keyword.11 In C#, all the variables have to be In VB.NET, variables can be forced for declared before being used. explicit declaration using Option Explicit.12 In C#, default property is defined In VB.NET, default property is defined by using indexers. using Default.13 In C#, base class can be referred In VB.NET, base class can be referred using the keyword ‘base’. using the keyword ‘MyBase’.14 Abstract class of C# can only be MustInherit keyword of VB.NET is inherited and not instantiated. used to denote that a class can only be inherited and not instantiated.15 Sealed keyword of C# is used to NotInheritable keyword of VB.NET denote that a class cannot be denotes that the class cannot involve in inherited. inheritance.16 Division can be performed in C# Division can be performed in VB.NET using / operator. using operator.17 Remainder of division can be Remainder of division can be retrieved retrieved using mod operator of using %. C#.18 C# does not have exponentiation In VB.NET, exponentiation can be operator. performed using ^ operator.
  • 27. 19 C# has Bitwise operators namely Bitwise operators in VB.NET are And, &,| and ^. Or, Xor. 20 Object reference variables can be Object reference variables can be compared using == operator in compared using Is operator in C#. VB.NET. 21 The short ciruit operators in C# The short circuit operators in VB.NET are && (Boolean AND) and || are AndAlso (Boolean AND) and (Boolean OR). OrElse (Boolean OR).3.Difference between C# and C++ S.No C# C++ 1 C# is a high level language that is C++ is a low level and indeed platform component oriented. neutral programming language. 2 When compiled, C# code is When compiled, C++ code is converted into Intermediate converted into assembly language language code. This intermediate code. language code is converted into executable code through the process called Just-In-Time compilation. 3 In C#, memory management is In C++, the memory that is allocated in automatically handled by garbage the heap dynamically has to be collector. explicitly deleted. 4 In C# Switch Statement, the test In C++ Switch Statement, the test variable can be a string. variable cannot be a string. 5 In C# switch statement, when In C++ switch statement, when break break statement is not given, the statement is not given, the fall through fall through will not happen to the will happen to the next case statement next case statement if the current even if the current case statement has case statement has any code. any code. 6 In addition to for, while and C++ does not contain for each do..while, C# has another flow statement. control statement called for each. 7 C# struts can contain only value C++ struts behave like classes except types. The struts is sealed and it that the default access is public instead cannot have a default no-argument of private. constructor. 8 In C#, delegates, events and In C++, only variables, constructors, properties can also be specified as functions, operator overloads and class members. destructors can be class members.
  • 28. Delegates, events and properties cannot be specified as class members. 9 In C#, the end of the class In C++, the end of the class definition definition has a closing brace has a closing brace followed by a alone. semicolon. 10 The access modifiers in C# are The access modifiers in C++ are public, private, protected, internal public, private, protected. C++ does and protected internal. not have internal and protected internal access modifiers. 11 C# has finally block in exception C++ does not have finally block in handling mechanism. The code exception handling mechanism. statements in the finally block will be executed once irrespective of exception occurrence. 12 The exception in C# can only The exception in C++ can throw any throw a class that is derived from class. the System.Exception class. 13 C# does not have the concept of C++ has the concept of function function pointers. C# has a similar pointers. concept called Delegates.Please visit my blog @ http://onlydifferencefaqs.blogspot.in/
  • 29. 1. Difference between Factory Pattern and Abstract Factory Pattern S.No Factory Pattern Abstract Factory Pattern 1 Create object through inheritance Create object through composition 2 Produce only one product Produce families of products 3 Implements code in the abstract creator Concrete factories implements factory that make use of the concrete type that method to create product sub class produces2.Difference between Abstract Factory Pattern And Builder Pattern S.No Builder Pattern Abstract Factory Pattern 1 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. 2 It will have reference to the created It does not keep the track of its created object. object.3.Difference between Builder Pattern And Composite Pattern S.No Builder Pattern Composite Pattern 1 It is used to create group of objects of It creates Parent - Child relations between predefined types. our objects.4.Difference between MVC and MVP S.No MVP MVC 1 MVP is a bit more complex to MVC is easier to implement than MVP. implement than MVC .Also, it has additional layer for view interfaces. 2 The request is always received by the The request is received by the controller View and delegated to the presenter which in turn gets the required data and which in turn gets the data does the loads up the appropriate view processing 3 The presentation and view logic an be The controller logic can be unit tested. unit tested as the view is loosely Note: We can unit test view if we are using coupled. Razor view engine. ASPX viewengine are not that easily unit testable 4 MVP is best suitable for Windows MVC is best suitable for Web Programming. Programming as the flow naturally tend towards this pattern.
  • 30. 5.Difference between Proxy Pattern and Observer Pattern S.No Proxy Pattern Observer Pattern 1 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. 2 Either because we dont always have the The publisher object does not know the wrapped object or because it needs to be subscribing objects - except that the managed in a certain way that can be conform to a certain subscriber interface. simplified via the proxy object(s). This is This is a very flexible pattern for kind of a way to exchange the API of an distributing events, since those that wants to existing class with a proxy class. We are listen on certain object has the power to do not just talking events here, but whatever so without changing the code of the kind of functionality to define via the publishing object. proxy object instead of the real object.6. Difference between Singleton Pattern and a static class S.No Singleton Pattern static class 1 Singleton pattern maintains single We cannot create instance for static class. instance. 2 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. 3 A singleton can be initialized lazily or A static class is generally initialized when it asynchronously. is first loaded, leading to potential class loader issues. 4 Singletons can be handled static class cannot be handled polymorphically without forcing their polymorphically. users to assume that there is only one instance. 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. 6 We can pass singleton object as We cannot pass parameter in static class parameter 7 Singleton provides flexibility and also Static classes once defined could not provides sort of a mechanism to control accomodate any future design changes as by object creation based on various design static classes are rigid and cannot be requirements. They can be extended as extended. well if need arises. In other words we are not always tied to a particular implementation. With Singleton we
  • 31. have the flexibility to make changes as when situation demands.7.Difference between Strategy and Inversion of Control (IOC) S.No Strategy Pattern Inversion of Control (IOC) Pattern 1 The strategy pattern is useful when we Inversion of Control/Dependency Injection want classes to depend on the interface (IoC/DI) comes into play when we want the rather than the implementation.And we concrete strategy implementation injected can easily swap out behavior depending into a class. For example, we could use the on which concrete implementation we DI Framework Ninject and configure it so provide. 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 implemented8.DIfference between IDictionary and Dictionary S.No IDictionary Dictionary 1 IDictionary is just a contract, abstraction Dictionary is concrete implementation. 2 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 Factory Pattern Dependency Injection(DI) 1 Factory is used to create objects DI is used to move the responsibility of creating an object outside the main code. 2 Some of the well known framework available for DI are 1. Unity Application Block (Microsoft) 2. Ninject 3. StructureMap 4. Castle Windsor 5. Munq/Funq 6. Autofac
  • 32. 10.Difference between String.Clone() and String.Copy() method S.No String.Clone() String.Copy() 1 Returns a reference to this instance of Creates a new instance of String with the String. same value as a specified String. i.e., it gives pointer value(ie Current i.e., it creates an instance in Heap Memory memory Reference) and gives pointer value(ie New Memory Reference)11.Difference between Strategy Pattern and Factory Pattern S.No Strategy Pattern Factory Pattern 1 Strategys sole intent to is to provide a Factorys sole purpose is to create objects . mechanism to select different algorithm. 2 We cannot use "strategy" to create We can use "factory" to create objects of objects of "factory". "strategy".12.Difference between Proxy and Adaptor S.No Proxy Pattern Adaptor Pattern 1 Proxy on the other hand represents a Adapter is used to adapt to incompatible standin object for the real object. This is interfaces. Its more directed from the client required when the real object is complex (those who consume the object) perspective. to create, is not available, or for A client expects an interface to be of authentication purpose. For e.g. web particular type and adapter plays a role in service proxy, proxy authentication filling that gap. server etc. Its more from making it easier for the client Proxy can be categorized into to adapt to other third party libraries within there own by adapting to it. Virtual Proxy Remote Proxy Protection Proxy13.Difference between Decorator and Visitor S.No Decorator Pattern Visitor Pattern 1 Decorator may have just a single object Visitor has a tree of objects to be worked to customize. upon. 2 Decorator does not require a traverser Visitor requires a traverser for successful for successful implementation. implementation. 3 Decorator pattern is a structural pattern Visitor pattern is Behavioral pattern that that help us to add new function to an seperate the data structure from the object in the run time , note that in the operation (functionality ) that work on it , run time not design time . this mean we can add different operation on the same data structure
  • 33. Difference between ASP.Net 2.0 and ASP.Net 3.5SN Feature ASP.Net 2.0 ASP.Net 3.5o1 New ASP.Net 2.0 includes the ASP.Net 3.5 includes the Features following as new features, following as new features, a) Master Pages a) ListView Control b) Profiles b) DataPager Control c) GridView Control c) Nested Master Pages d) LinqDataSource Control2 Multi- ASP.Net 2.0 does not ASP.Net 3.5 supports multi- targeting support Multi-Targeting targeting. It means that we environment. 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.3 AJAX There is no in-built support In ASP.Net 3.5, AJAX is Support for AJAX in ASP.Net 2.0. integrated into the .NET Instead, it has to be Framework, thereby making the downloaded and installed. process of building intuitive cool user interfaces easier.4 Siverlight It does not support It supports Siverlight. Support Siverlight.5 Javascript It does not provide It provides Javascript debugging. Debugging Javascript debugging.6 LINQ It does not support LINQ. It Supports Language Integrated Support Query (LINQ).
  • 34. 1) What is the difference between CCW and RCW? S.No CCW RCW 1 COM to .NET communication .NET to COM Communication happens happens through COM Callable through Runtime Callable Wrapper Wrapper2) What are the differences between Dll and Exe? S.No Dll Exe 1 Objects of Dlls can be created Objects of Exe cannot be created 2 Dll is In-Process Exe is Out-Process 3 It cannot be started as a standalone It can be started as a standalone3) What are the differences between Managed Code and Unmanaged Code? S.No Managed Code Unmanaged Code 1 It is executed under CLR It is not executed under CLR 2 It compiles to intermediate language It compiles directly to machine code 3 It provides services like security, It does not provide security, exception exception handling, garbage handling, garbage collection etc collection etc 4 It can access both managed and It can access only unmanaged code unmanaged code
  • 35. Difference between hash table and arraylist S.No Arraylist Hash table 1 Array List is a List Hash Table is a map 2 Here, we can only add items to the list Here, we can add data with the key 3 Retrieving data using Arraylist is slower Retrieving by key in Hashtable is faster than than Hashtable because If we want to retrieving in Arraylist because If we want to find something in a arraylist we have to find something in a hashtable we dont have go through each value in arraylist. to go through each value in hashtable, instead search for key values and is faster.Difference between Hash Table and Arrays Hash Table Array Hash table stores data as name,value pair. Array stores only value To access value from hash table, we need to In array, to access value , we need to pass pass name. index number. We can store different type of data in hash In array ,we can store only similar table, say int,string etc. type of data.Difference between Dictionary and Hashtable Dictionary Hashtable Dictionary is a generic type Hashtable is not generic type. 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 Hashtable is thread safe for use by multiple safe but any instance members are not type reader threads and a single writing thread. safe. 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 It is slower than dictionary because to retrieve boxing is not required. a value we must cast it as its actual type, because it will be returned via object reference.
  • 36. Difference between array and stack Array Stack An array can be multi-dimensional Stack is strictly one-dimensional An array allows direct access to any of its With a stack, only the top element is directly elements accessible; to access other elements of a stack, we must go through them in order, until we get to the one we wantDifference between Stack and Heap Stack Heap Memory will be allocated at the compile time. Memory will be allocated at the run time. Here the memory is allocated by the compiler. Here the memory is allocated by the user. Memory will be allocated only in sequential Memory will be allocated in sequential locations. locations and non- sequential locations. The memory will also be deleted by the The memory must be deleted explicitly by the compiler. user. There is lot of chance of memory wastage. There is no chance of memory wastage if the memory is handled perfectly.Difference between Array and ArrayList Array ArrayList They are fixed length. They are resizable and variable length They are compiled strong type collection. They are flexible and can accommodate any data types. Because arrays are of fixed size and strong In arraylist lots of boxing and unboxing are type collection performance is faster. done there for its performance is slower. Array is in the System namespace ArrayList is in the System.Collections namespace. Ex:Char[] vowel=new Char[]; Ex:ArrayList a_list=new ArrayList();
  • 37. 1.Difference between for and foreach loop S.No For loop Foreach loop 1 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. 2 The For loop executes the statement or The Foreach statement repeats a group of block of statements repeatedly until embedded statements for each element in an specified expression evaluates to false. array or an object collection. 3 There is need to specify the loop We do not need to specify the loop bounds bounds(Minimum, Maximum). minimum or maximum. 4 example: example: using sytem; using sytem; class class1 class class1 { { static void Main() static void Main() { { int j=0; int j=0; for(int i=0; i<=10;i++) int[] arr=new int[] { {0,3,5,2,55,34,643,42,23}; j=j+1; foreach(int i in arr) } { Console.ReadLine(); j=j+1; } } } Console.ReadLine(); } }2. Difference between Covariance and Contravariance S.No Covariance Contravariance 1 Converting from a broader type to a Converting from a more specific type to a specific type is called co-variance.If B broader type is called contra-variance. If B is is derived from A and B relates to A, derived from A and B relates to A, then we then we can assign A to B. Like A=B. can assign B to A. Like B= A. This is This is Covariance. 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 co- present in animal. variance. 3 Example:
  • 38. 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.
  • 39. 3.Difference between IList and IEnumerable S.No IList IEnumerable 1 IList is used to access an element in a IEnumerable is a forward only collection, it specific position/index in a list. can not move backward and between the items. 2 IList is useful when we want to Add or IEnumerable does not support add or remove remove items from the list. items from the list. 3 IList can find out the no of elements in Using IEnumerable we can find out the no of the collection without iterating the elements in the collection after iterating the collection. collection. 4 IList does not support filtering. IEnumerable supports filtering.4.Difference between IEnumerable and IQueryable S.No IEnumerable IQueryable 1 IEnumerable exists in IQueryable exists in System.Linq System.Collections Namespace. Namespace. 2 IEnumerable is best to query data from IQueryable is best to query data from out- in-memory collections like List, Array memory (like remote database, service) etc. collections. 3 While query data from database, While query data from database, IEnumerable execute select query on IEnumerable execute select query on server server side, load data in-memory on side with all filters. client side and then filter data. 4 IEnumerable is suitable for LINQ to IQueryable is suitable for LINQ to SQL Object and LINQ to XML queries. queries. 5 IEnumerable does not supports custom IQueryable supports custom query using query. CreateQuery and Execute methods. 6 IEnumerable does not support lazy IQueryable support lazy loading. Hence it is loading. Hence not suitable for paging suitable for paging like scenarios. like scenarios. 7 Extension methods supports by Extension methods supports by IEnumerable IEnumerable takes functional objects. takes expression objects means expression tree. 8 IEnumerable 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 [t0].[EmpID], [t0].[EmpName], [t0].[Salary] FROM [Employee] AS [t0] WHERE [t0].[EmpName] LIKE @p0
  • 40. 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 IEnumerable IEnumerator 1 The IEnumerable interface is a generic IEnumerator provides two abstract methods interface that provides an abstraction and a property to pull a particular element in for looping over elements. a collection. And they are Reset(), In addition to providing foreach MoveNext() and Current The signature of support, it allows us to tap into the IEnumerator members is as follows: useful extension methods in the void Reset() : Sets the enumerator to its System.Linq namespace, opening up a initial position, which is before the first lot of advanced functionality element in the collection. The IEnumerable interface contains an bool MoveNext() : Advances the enumerator abstract member function called to the next element of the collection. GetEnumerator() and return an interface object Current : Gets the current element in IEnumerator on any success call. the collection 2 IEnumerable does not remember the IEnumerator does remember the cursor state cursor state i.e currently row which is iterating through 3 IEnumerable is useful when we have IEnumerator is useful when we have to pass only iterate the value the iterator as parameter and has to remember the value
  • 41. 1) What are differences between XML and HTML? S.No XML HTML 1 XML provides user definable tags HTML provides defined set of tags designed for web display 2 XML is content driven HTML is format driven 3 End tags are essential in a well End tags are not always formed XML document. In a well required.<HTML> tag needs an formed document, elements can be equivalent </HTML> tag but <br> tag defined as single tag or a pair of tags does not require </br> tag like <student/> or the <student>… </student> pair 4 Quotes required around attribute Quotes are not required for the values values of attributes 5 Slash required in empty tags Slash not required 6 XML is used for describing data HTML is used for designing pages
  • 42. 1.Difference between LINQ and SQL S.No LINQ SQL 1 LINQ Stands for language SQL stands for Structured integrated query. Query Language. 2 LINQ Statements are verified SQL statements can be used in a during compile time. application gets verified for their syntaxes only in the run time. 3 To use LINQ we can depend upon To use SQL we need to be familiar our .Net Language syntaxes and with SQL syntaxes and also the pre- also we can consume base class defined functions of SQL like library functionalities. MAX,MIN,LEN and SUBSTRING etc... 4 LINQ Statements can be As SQL statements execute on debugged as they execute under Database server debugging of the code framework environment. is not possible. SQL .2.Difference between LINQ to SQL and Entity Framework S.No LINQ to SQL Entity Framework 1 It only works with Sql server. It works with variety of db products. 2 Used for rapid application Cannot used for rapid application development. development. 3 It does not support for complex It provides support for complex type. type. 4 It cannot generate db from model. It can generate db from model. 5 Mapping type ( class to single Mapping type ( class to multiple table) tables) 6 We can query data using We can query data using esql,object DataContext. 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
  • 43. 3.Difference between LINQ and Stored Procedures S.No LINQ Stored Procedures 1 As LINQ is part of .NET, we can It is really very hard to debug the use visual studio’s debugger to Stored Procedure debug the queries 2 With LINQ everything gets With Stored Procedures, we need to complied into single DLL hence provide an additional script for deployment becomes easy. deployment 3 LINQ is type safe, so queries Stored Procedures are not type safe errors are type checked at compile i.e., error can be caught only during time.It is really good to encounter runtime. an error when compiling rather than runtime exception! 4 LINQ supports multiple databases With Stored Procedures which need to be re-written for different databases. 5 LINQ supports abstraction which As Stored Procedures does not support allows framework to add abstaction , so it is difficult to add additional improvements like additional impovements like multi multi threading. It is much threading simpler and easier to add this support through LINQ than Stored Procedures. 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 LINQ to SQL LINQ to Objects 1 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. 2 LINQ to SQL returns data of type LINQ to Objects returns data of type IQueryable<T> IEnumerable<T>.
  • 44. 3 LINQ to SQL is translated to SQL LINQ to Objects does not need to be by way of Expression Trees, translated. which allow them to be evaluated as a single unit and translated to the appropriate and optimal SQL statements. 4 LINQ to SQL is translated to SQL LINQ to Objects is executed in the calls and executed on the local machine memory. specified database5.Difference between LINQ to SQL and LINQ to Entities S.No LINQ to SQL LINQ to Entities 1 Does not support Conceptual Data Supports Conceptual Data Model Model 2 Does not support Storage Schema Supports Storage Schema 3 Does not support Mapping Schema Supports Mapping Schema 4 Does not support New Data Access Supports New Data Access Provider Provider 5 Does not support Non-SQL Server Supports Non-SQL Server Database Database Support Support 6 Supports Direct Database Does not support Direct Database Connection Connection 7 Does not support Multiple-table Supports Multiple-table Inheritance Inheritance 8 Does not support Single Entity from Supports Single Entity from Multiple Multiple Tables Tables
  • 45. 1.Difference between LINQ to SQL and ADO.NET S.No LINQ to SQL ADO.NET 1 Used for data handling with SQL Used for data handling with any Server databases only. database: SQL Server/Access/Oracle/Excel etc. 2 Uses the extension methods of Does not use the extension methods of System.Linq.Queryable class. System.Linq.Queryable class. 3 Introduced in .net Framework 3.0 It is there since the .net Framework 1.0 4 DataContext is used for Database SqlConnection/OleDbConnection are connectivity. used for database connectivity 5 Syntax and coding is somewhat Easier syntax and coding. complex.Note: Both LINQ TO SQL and ADO.NET have connected / disconnected modes of datahandling2.Difference between LINQ and nHibernate S.No LINQ nHibernate 1 LINQ is not an open-source nHibernate is an open source. 2 LINQ is an incomplete ORM tool nHibernate is an ORM tool as it needs additional extensions. 3 LINQ is primarily a querying nHibernate has a limited querying language language. 4 LINQ is much more useful in nHibernate is much more useful in small applications where there is largel applications where there is no massive dependence on massive dependence on databases. databases. 5 With LINQ, database already With nHibernate, database does not exists and the relationships and already exist and it needs to be defined some programming will be . dependent on how the database is defined.
  • 46. 3.Difference between LINQ and Entity Framework S.No LINQ Entity Framework 1 Used for Rapid Application Used for Enterprise Development Development 2 Works with objects in database Works with Conceptual model of database 3 Mainly woks with SQL Server Works with all data sources 4 ".dbml" is created while using ".EDMX" is created while using Entity LINQ to SQL Framework
  • 47. 1) What are the differences between TypeOf() and GetType()? S.No TypeOf() GetType() 1 Its an operator Its a method 2 Cant be overloaded Has lot of overloads2) 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 allowed3) 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 possible4) 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 structures5) 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 indexer6) 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
  • 48. Polymorphism7) 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.
  • 49. Difference between Events and Delegates S.No Events Delegates 1 Event can be used in an Delegate cannot be used in an interface definition interface definition 2 Event can only be invoked from Delegates can be invoked from child the class that declares it classes and clients. 3 Event comes with its pair of There is no pair of accessors concept accessors i.e Add and Remove. in delegates. An event is always assigned and unassigned with a += and -= operator. 4 Event has a restrictive signature Delegates do not have restrictive and must always be of the form signature as like events Event (object source, EventArgs args)Difference between Class and Object S.No Class Object 1 It is a datatype that contains the It is a chunk of memory that programming logic. implements the class logic. 2 Class is visible in the source code Object is in the RAM and not and resides in hard disk. visible in source code. 3 Class is like a template or blueprint It is the real world implementation of the object. It implements of the class. Each object has its reusability,encapsulation, own copy of data. inheritance 4 Example:Button is a class with Example: Button1, Button2 are the properties like Text,BackColor, objects of Button class. events like click, methods like Focus 5 We can create subclasses We cannot create sub-objectsDifference between Private and Static Constructor S.No Static constructor Private constructor 1 A static constructor is called Private constructor is called after the before the first instance is instance of the class is created. created. i.e. global initializer. 2 Static constructor will be called Static members will not be initialized first time when the class is either by private or public referenced.Static constructor is constructor. used to initialize static members of the class. 3 The static constructor will only be The private constructor will be executed once. executed each time it is called.
  • 50. Difference between properties and methods S.No Properties Methods 1 Properties are used to represent Methods are used to performs actions data 2 Properties are created by using Methods create like public void getter and setter i.e., get{} and method1(parameter list here) set{}Difference between Singleton Pattern and a static classS.No Singleton Pattern static class Singleton pattern maintains single We cannot create instance for static instance. class.2 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.3 A singleton can be initialized lazily A static class is generally initialized or asynchronously. when it is first loaded, leading to potential class loader issues.4 Singletons can be handled static class cannot be handled polymorphically without forcing polymorphically. their users to assume that there is only one instance.5 Singleton Class can have value Static are always just shared and have when Class object instantiated no instance but multiple references. 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.6 We can pass singleton object as We cannot pass parameter in static parameter class7 Singleton provides flexibility and Static classes once defined could not also provides sort of a mechanism accomodate any future design to control object creation based on changes as by design static classes various requirements. They can be are rigid and cannot be extended. 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.
  • 51. Difference between Abstraction and Encapsulation Abstraction Encapsulation Abstraction solves the problem in the Encapsulation solves the problem in the design level. 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 Encapsulation means hiding the internal the object does instead of how it does it details or mechanism of how an object does something. Abstraction- Outer layout, used in Encapsulation- Inner layout, used in terms of design. terms of implementation. For Example:- For Example:- Inner Implementation Outer Look of a Mobile Phone, like it detail of a Mobile Phone, how keypad has a display screen and keypad buttons button and Display Screen are to dial a number. connected with each other using circuitsDifference between Composition and Aggregation Composition Aggregation Defines a strong-coupled relationship Defines a weak-coupled relationship between two entities, where the one between two entities, where one entity entity is part of another, and both need could be part of another, but either can each other for their existence. exist without the other, independantly. e.g. Human body and the Heart. e.g.School and teacher. Composition implies real ownership of Aggregation does not necessarily own its components any of its aggregates. Composition has a stronger bond of its Aggregation has weaker or looser bonds components. with its aggregates. Composition has components that exist Aggregation has aggregates that live at at the inner level. the outer level.
  • 52. 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 In Sealed class we can not create a constructor and therefore we can create constructor of that class, so no instance an instance of that class. of that class is possible. public class A public sealed class A { { private class B } { public class B : A //ERROR } { B b = new B(); } } public class C { A.B b = new A.B(); // 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 Sealed Class We can neither create their instances, We can create their instances, but cannot nor inherit them inherit them They can have static members only. They can contain static as well as nonstatic members. ex: ex: static class Program
  • 53. { 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 Virtual method Abstract method Overriding Virtual method may or may An abstract method should be not override by inherited class. overriden by inherited class. i.e.,Virtual method provide i.e.,Abstract method forces the derived class with the the derived class to option of overriding it. override it. Virtual = = Overridable abstract == MustOverride Implementation Virtual method has an Abstract method does not implementation. provide an implementation. Necessity to Virtual methods allow Abstract methods in a Implement subclasses to provide their class contain no method own implementation of that body, and are implicitly method using the override virtual keyword Scope Virtual methods scope to Abstract methods scope to members only. members and classes Instancing Virtual methods - Not Abstract method - direcly applicable, as we cant NO, but other way, Yes. create instance for We can create an instance members, it is possible only of a class that derives from with classes. an abstract class. And we can declare a type Abstract class and instantiate that as a derived class.
  • 54. 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 Static Class Class has Instance Members Static class does not have Instance Members In Class, Constructor has Access In Static Class, Constructor does not Specifier. have Access Specifier. In Class Constructor, initiation is done In Static Class ,Constructor will be every time when an object is created called only one time . for the class In Class, Class members can be In Static Class, members can be accessed through class object. accessed through its Class name only
  • 55. Difference between Method Overloading and Method overriding in C# Method Overloading Method overriding Method Overloading is passing same Method Overriding is redifining parent message for different functionality class function to the child class Method Overloading is between the Method Overriding is between the same same function name with the different method. signature Method Overloading does not check for Method Overriding checks the return the return type. type. Method Overloading takes place in the Method Overriding takes place between same class. parent and child classes Method Overloading is static binding Method Overriding is a dynamic binding.
  • 56. 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 back2) 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 value3) What are the Differences between Clustered Indexes and Non-Clustered Indexes? S.No Clustered Indexes Non-Clustered Indexes 1 It reorders the physical storage of It sorts and maintain a separate records in the table storage 2 There can be only one Clustered More than one index per table 3 The leaf nodes contain data The leaf node contains pointer to data4) 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
  • 57. not allowed in UDFs 10 Non-deterministic functions can Non-deterministic functions cannot be be used in Stored Procedures. 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 functions7) 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
  • 58. 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
  • 59. 1.Difference between Identity and Sequence in SQL Server 2012 S.No Identity Sequence 1 Dependant on table. Independent from table. 2 Identity is a property in a table. Sequence is an object. Example : Example : CREATE TABLE Table CREATE SEQUENCE [dbo]. test_Identity [Sequence_ID] ( AS [int] [ID] int Identity (1,1), START WITH 1 [Product Name] varchar(50) INCREMENT BY 1 ) MINVALUE 1 MAXVALUE 1000 NO CYCLE NO CACHE 3 If we need a new ID from an In the sequence, we do not need to identity column we need to insert new ID, we can view the new ID insert and then get new ID. directly. Example : Example : Insert into [test_Identity] Values SELECT NEXT VALUE (‘SQL Server’) FOR dbo.[Sequence_ID] GO SELECT @@IDENTITY AS ‘Identity’ –OR Select SCOPE_IDENTITY() AS ‘Identity’ 4 We cannot perform a cycle in In the sequence, we can simply add identity column. Meaning, we one property to make it a cycle. cannot restart the counter after a particular interval. Example : ALTER SEQUENCE [dbo]. [Sequence_ID]
  • 60. CYCLE;5 We cannot cache Identity column Sequence can be easily cached by just property. setting cache property of sequence. It also improves the performance. Example : ALTER SEQUENCE [dbo]. [Sequence_ID] CACHE 3;6 We cannot remove the identity The sequence is not table dependent so column from the table directly. 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 Here we can set up its maximum value in identity column it is value. based on the data type limit. Example :
  • 61. ALTER SEQUENCE [dbo]. [Sequence_ID] MAXVALUE 2000; 8 We can reseed it but cannot We can reseed as well as change the change the step size. step size. Example : Example : DBCC CHECKIDENT ALTER SEQUENCE [dbo]. (test_Identity, RESEED, 4) [Sequence_ID] RESTART WITH 7 INCREMENT BY 2; 9 We cannot generate range from We can generate a range of sequence identity. values from a sequence object with the help of sp_sequence_get_range.2.Difference between Temp table and Table variable S.No Temp table Table variable 1 A Temp table is easy to create and But the table variable involves the back up data. effort when we usually create the normal tables. 2 Temp table result can be used by But the table variable can be used by multiple users. the current user only. 3 Temp table will be stored in the But a table variable will store in the tempdb. It will make network physical memory for some of the data, traffic. When we have large data then later when the size increases it in the temp table then it has to will be moved to the tempdb. work across the database. A Performance issue will exist. 4 Temp table can do all the DDL Whereas table variable wont allow operations. It allows creating the doing the DDL operations. But the indexes, dropping, altering, etc.., 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. 6 Temp variable cannot use the But we cannot do it for table variable.
  • 62. 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 But the function allows us to use the variable. More over we cannot do table variable. But using the table the DML operation in the variable we can do that. functions . 8 The stored procedure will do the Whereas the table variable wont do recompilation (cant use same like that. execution plan) when we use the temp variable for every sub sequent calls.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 RAISERROR Statement THROW Statement 1 If a msg_id is passed to The error_number parameter does not RAISERROR, the ID must be have to be defined in sys.messages. defined in sys.messages. 2 The msg_str parameter can The message parameter does not contain printf formatting styles. accept printf style formatting. 3 The severity parameter specifies There is no severity parameter. The the severity of the exception. exception severity is always set to 16.4.Difference between Local temporary table and Global temporary table S.No Local temporary table Global temporary table 1 Denoted by # symbol. Denoted by ## symbol. 2 Valid for the current connection Available to all the connections once only. They are cleared as soon as created. They are deleted when all the current connection closes. users referencing the table disconnect from SQL Server . 3 Cannot be shared between Can be shared between multiple users. multiple users.
  • 63. 1.Difference between Correlated subquery and Nested subquery S.No Correlated subquery Nested subquery 1 Correlated subquery runs once for Nested subquery runs only once for the each row selected by the outer entire nesting (outer) query. It does not query. It contains a reference to a contain any reference to the outer value from the row selected by the query row. outer query. 2 Correlated subquery follows down Nested subquery follows top-down to top approach i.e., main query approach i.e., child query is executed is executed first(even though first and then parent . parenthesis are present) and then child query. We can also say:In a subquery Outer query condition is used in the We can also say: in a Correlated the inner query. subquery,Inner query condition is used in the outer query 4 Example: Example: select e1.empname, e1.basicsal, select empname, basicsal, deptno from e1.deptno from emp e1 emp where e1.basicsal = (select where (deptno, basicsal) in (select max(basicsal) from emp e2 where deptno, max(basicsal) from emp group e2.deptno = e1.deptno) by deptno)2.Difference between Weak Entity Set and Strong Entity Set S.No Weak Entity Set Strong Entity Set 1 An entity set which does not An entity set which does have a possess sufficient attributes to primary key is called a strong entity form a primary key is known as a set. weak entity set. 2 Member of a weak entity set is a Member of a strong entity set is a subordinate entity. dominant entity. 3 Example: Example: Specific Set of all Person,Company,Event,Plant Persons,Companies,Trees,Holidays
  • 64. 3.Difference between char and varchar data types in Sql Server S.No Char Varchar 1 Fixed length memory storage Variable length memory storage(Changeable) 2 CHAR takes up 1 byte per VARCHAR takes up 1 byte per character character, + 2 bytes to hold length information 3 Use Char when the data entries in Use Varchar when the data entries in a a column are expected to be the column are expected to vary same size like phone number considerably in size like address 4 Ex: Ex: Declare test Char(100); Declare test VarChar(100); test="Test" - test="Test" - Then "test" occupies 100 bytes Then "test" occupies only 4+2=6 first four bytes with values and bytes. first four bytes for value and rest with blank data other two bytes for variable length information.4.Difference between Sql Server 2005 and Sql Server 2008 S.No Sql Server 2005 Sql Server 2008 1 XML datatype is introduced. XML datatype is used. 2 Cannot encrypt the entire Can encrypt the entire database database. introduced in 2008. 3 Datetime is used for both date and Date and time are seperately used for time. date and time 4 No table datatype is included. Table datatype introduced. 5 SSIS is started using. SSIS avails in this version. 6 CMS is not available. Central Management Server(CMS) is Introduced. 7 PBM is not available Policy based management(PBM) server is Introduced.
  • 65. 1.Difference between Database Mail and SQL Mail S.No Database Mail SQL Mail 1 Based on SMTP (Simple Mail Based on MAPI (Messaging Transfer Protocol). Application Programming Interface). 2 Introduced in Sql Server 2005. Used prior versions of Sql Server 2005. 3 No need to install Outlook. Require Outlook to be installed. 4 More secure than Sql mail. Less secure than Database mail.2.Difference between Azure Table storage and SQL Azure S.No Azure Table storage SQL Azure 1 It is built on top of the Azure It is an SQL Server that has been Storage platform. configured to be hosted on top of the Windows Azure in a high availability mode. 2 It comprises flexible or schema- It comprises standard SQL Tables with less entities. No referential indexes and referential integrity. integrity between the tables, and no custom indexes. 3 It can scale massive amounts of It may not scale as far as Azure Table data due to the partition key. storage. 4 Can be thought as single Look familiar to any .Net developer spreadsheet. who has used Sql server 2008 prior.3.Difference between DBMS and RDBMS S.No DBMS RDBMS 1 Stands for DataBase Management Stands for Relational DataBase System Management System 2 In dbms no relationship concept It is used to establish the relationship concept between two database objects, i.e, tables 3 It supports Single User only It supports multiple users 4 It treats Data as Files internally It treats data as Tables internally 5 It supports 3 rules of E.F.CODD It supports minimum 6 rules of out off 12 rules E.F.CODD 6 It requires low Software and It requires High software and
  • 66. Hardware Requirements. hardware requirements. 7 DBMS is used for simpler RDBMS is used for more complex business applications applications. 8 DBMS does not impose any RDBMS defines the integrity constraints or security with regard constraint for the purpose of holding to data manipulation ACID PROPERTY 9 In DBMS Normalization process In RDBMS, normalization process will not be present will be present to check the database table consistency 10 There is no enforcement to use Although the foreign key concept is foreign key concept compulsorily supported by both DBMS and RDBMS in DBMS but its only RDBMS that enforces the rules 11 FoxPro, IMS are Examples SQL Server, Oracle are examples4.Difference between SQL Server 2000 and SQL Server 2005 S.No SQL Server 2000 SQL Server 2005 1 Query Analyser and Enterprise Both are combined as SSMS(Sql manager are separate. Server management Studio). 2 No XML datatype is used. .XML datatype is introduced. 3 We can create maximum of We can create 2(pow(20))-1 databases. 65,535 databases. 4 Exception Handling mechanism is Exception Handling mechanism is not available available 5 There is no Varchar(Max) data Varchar(Max) data type is introduced. type is not available 6 DDL Triggers is not available DDL Triggers is introduced 7 DataBase Mirroring facility is not DataBase Mirroring facility is available introduced 8 RowNumber function for paging RowNumber function for paging is is not available introduced 9 Table fragmentation facility is not Table fragmentation facility is available introduced 10 Full Text Search facility is not Full Text Search facility is introduced available
  • 67. 11 Bulk Copy Update facility is not Bulk Copy Update facility is available introduced12 Data Encryption concept is not .Cannot encrypt the entire database introduced13 Cannot compress the tables and Can Compress tables and indexes. indexes. (Introduced in 2005 SP2)14 No varchar(max) or Varchar(max) and varbinary(max) is varbinary(max) is available. used.15 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
  • 68. 1.Difference between SQL Server and PostgreSQL S.No SQL Server PostgreSQL 1 INSERT t VALUES (…) This syntax is not allowed. Allows: INSERT INTO t VALUES (…) 2 BULK INSERT and BCP uses COPY instead (which has the functionality of both BCP and BULK INSERT) 3 Management Studio pgAdmin 4 Bit type Boolean type (accepts values true and false) 5 IDENITTY Has sequencers (like Oracle) 6 default schema is dbo default schema is PostgreSQL 7 Default Listening on 1433 Default listening on 5432 8 datatype: varchar(max) datatype: text 9 Key is clustered by default key is not clustered by default (and it is enforced by a constraint and not an an index!) 10 User Defined Data Types Domains 11 user: sa user: postgres 12 No such thing NATURAL and USING joins 13 SELECT TOP 10 * FROM t SELECT * FROM t LIMIT 10 14 Query plans read from right to left Query plan read from left to right 15 Estimate Query Plan: CTRL+L Estimate Query Plan: F72.Difference between Cross Join and Full Outer Join S.No Cross Join Full Outer Join 1 No join conditions are specified. A combination of both left and right outer joins. 2 Results in pairs of rows. Results in every row from both of the tables , at least once. 3 Results in Cartesian product of Assigns NULL for unmatched fields. two tables.
  • 69. 3.Difference between SQL Server and Oracle S.No SQL Server Oracle 1 SQL History: Oracle History: IBM introduced structured Query Oracle Corp is the leading supplier for Language (SQL) as the language S/w products, headquartered in to interface with its prototype Redwood shores, California, USA. It relational database management was founded by Larry Ellison, Bob system; System R. Oracle Miner and Ed Oates in 1977. Now they Corporation introduced the first have 43,000 Employees in 150 commercially available SQL countries. Oracle first commercial relational database management RDBMS was built in 1979, and it is system in 1979. Today, SQL has the first to support the SQL. Oracle is become an industry standard, and the first S/w company to develop and Oracle Corporation clearly leads deploy 100 % Internet-enabled the world in RDBMS technology. enterprise Software. SQL is used for all types of DB activities by all type of users. The basic SQL commands can be learned in a few hours and even the most advanced commands can be mastered in a few days. 2 SQL (Structure Query Oracle (RDBMS): Language): Oracle is fastest and easiest way to When a user wants to get some create applications in MS windows. It information from any DB file, he provides the ability to store and access can issue a query. Structured data. Whether you are experienced or query language (SQL), new to windows in programming, pronounced “Sequel”, is the set of Oracle provides you with the complete commands that all programs and set of tools to simplify rapid users must use to access data application development. The Oracle within the Oracle. SQL is a high refers to the method used to create the performance fault tolerant data graphical user inter face. There is no base management system. The need to write numerous lines of code database is mostly maintained by to describe the appearance and location SQL language, which is conceded of inter face elements. as the heart of the RDBMS. 3 SQL Technology: Oracle Technology: SQL is divided into four parts: Oracle DB structure is divided into two parts, one is called Physical DDL (Data Definition Language): structure (these files define the Create, Alter, Drop, Rename, operating system that make up the DB, Truncate. each Oracle DB is made by three types
  • 70. DML (Data Manipulate of files, data-files, redo logs file- Language): Select, Update and controls file) and the other is called Delete, Insert, Into. Logical structure (these files define the logical areas of storage like schema, DCL (Data Control Language): table spaces, segments and extents). Grant, Revoke TCL (Transaction Control Language): Commit, Rollback.4 Advantages: Advantages: • Provides easy access to all • Data consistency data. • Integration of data • Flexibility in data • Easy file generation molding. • Increased security • Reduced data storage and • Easy updating of records redundancy. • No wastage of time • Provides a high-level • Enforcement of standards manipulation language. • Controlled data redundancy • SQL can save data in • Reduce the total expenditures common PC file formats • Searching of particular data is that can be imported into easy other application (like Ms- • Dispose of heavy files and Excel). register work • SQL is not case sensitive. • The work of three persons is • It can enter one or more reduced to one lines. • Instant intimation of • Tabs and indents can be modification of information used to make code more readable. • Can be used by a range of users. • It is a nonprocedural language (English-like language).5 Differences: Differences: • SQL is a tool for all DB • Oracle Corp is the world’s like DBMS, RDBMS, T- leading supplier of S/w SQL, and SQL Plus. products. • SQL maintains different • Oracle is the platform, where RDBMS. we develop and implement • SQL is combination of different DB designs and different commands and software. functions that why, SQL is • Oracle is the combination of worked for Oracle DB as a different S/w products, where
  • 71. command prompt they work together for shell (SQL is the command designing DB. prompt shell, where we • Oracle works with different can communicate with any front and back end DB). products/tools (like SQL).4.Difference between View and Stored Procedure S.No View Stored Procedure 1 Does not accepts parameters Accept parameters 2 Can be used as a building block in Cannot be used as a building block in large query. large query. 3 Can contain only one single Select Can contain several statement like if, query. else, loop etc. 4 Cannot perform modification to Can perform modification to one or any table. several tables. 5 Can be used (sometimes) as the Cannot be used as the target for Insert, target for Insert, update, delete update, delete queries. queries.5.Difference between IN and EXISTS S.No IN EXISTS 1 Returns true if specified value Return true if sub query contain any matches any value in the sub rows. query or a list. 2 The sub query will run first and The Outer query will ran first and then then only outer query. only sub query. 3 IN is slower than EXISTS. The IN Exists is faster than IN.The Outer is used in the widely For Static query will run first and then only inner variables for eg: select name from query.So it will reduce the over head. table where ID in (Select ID from The Exists is useful mostly in IF table2). conditional statements. 4 Example: Example: SELECT id, SELECT id, [Name] [Name] FROM dbo.tablea FROM dbo.tablea AS a WHERE id IN (SELECT id WHERE EXISTS (SELECT id2
  • 72. FROM dbo.tableb) FROM dbo.tableb WHERE id2 = a.id)Please visit my blog @ http://onlydifferencefaqs.blogspot.in/
  • 73. 1.Difference between Checkpoint and Lazy Writer S.No CheckPoint Lazy Writer 1 Flush dirty pages to Disk Flush dirty pages to disk 2 Flush only Data pages to disk Check for available memory and removed Buffer pool (execution plan/compile plan/ Data pages /Memory objects) 3 Default, Occurs approximately Occurs depending upon memory every 1 minute pressure and resource availability 4 Can be managed with sp_confige It is lazy, Sql server manages by its -recovery interval option own. 5 Does not check the memory Monitor the memory pressure and try pressure maintain the available free memory. 6 Crash recovery process will be No role in recovery fast to read log as data file is updated. 7 Occurs for any DDL statement Occurs per requirement 8 Occurs before Backup/Detach Occurs per requirement command 9 Depends upon the configuration Works on Least recent used pages and setting, we can control. removed unused plans first, no user control. 10 For simple recovery it flush the No effect on recovery model. tlog file after 70% full. 11 Can manually /Forcefully run No command for Lazy Writer command “Checkpoint” 12 Very Less performance impact No performance impact2.Difference between Mirroring and Log Shipping S.No Mirroring Log Shipping 1 Principle can have single mirror Multiple stand by servers can be possible. 2 Generally good to have 10 DB’s No limit for one server 3 No data loss and can be used as May be some data loss as per schedule.
  • 74. high availability like Clustering And secondary server takes some manual work and time to be primary 4 Read log read and transfer the Transfer the log back up and restored committed transaction through at standby server. endpoints. 5 Only committed transaction Committed as well as uncommitted and whole log backup restores. 6 PAGE repair is possible if N/A principle database page gets corrupt 7 Mirrored DB can only be accessed Secondary server can be reporting using snapshot DB server (read-only) 8 Principle and Mirror server should Primary and secondary server should have same edition be compatible server for restore. 9 Require FULL recovery model Require FULL or Bulk-Logged recovery model 10 Requires Sql Server 2005 SP1 or Enterprise edition for Sql Server 2000 higher – Enterprise or Developer and even Standard edition for 2005 can Editions works 11 Immediate data moved depending Can control the flow of data by on SEND and WAIT queue scheduling jobs 12 As Immediate data moves, user As delay in data transfer can avoided error reflects at mirrored DB user error.3.Difference between Change Track and Change Data Capture – CDC in SQL Server 2008 S.No Change Track Change Data Capture 1 It is about fact: It is about the Data: It captures only the fact as the Change data capture provides tracking table has changed. It does historical change information for a NOT capture the data. user table by capturing both the fact Therefore, change tracking is that DML changes were made and the more limited in the historical actual data that was changed. questions it can answer compared to change data capture. However, for those applications that do not require the historical information, there is far less storage overhead because of the changed data not being captured
  • 75. 2 Storage: Storage: Internal tables are placed on the When change data capture is enabled same filegroup as the parent for a database, a few things are added entity. You could use the to the database, including a new sys.internal_tables catalog view schema (called cdc), some metadata to show all the internal tables and tables, and a trigger to capture Data parent entities. For example: Definition Language (DDL) events. select name, object_name(parent_id) as The two function names are, parent_object from respectively, sys.internal_tables fn_cdc_get_all_changes_ and fn_cdc_get_net_changes_, with the capture instance name appended. Note that (like the change tracking feature) this functionality requires the table to have a primary key or other unique index.3 Supported on “Simple” recovery Prevents Log truncation. model also. Forces full logging of some bulk It is recommended that you use operations. snapshot isolation when change tracking is enabled. Snapshot One major point to note here is that isolation itself can add significant once change data capture is enabled, workload overhead and requires the transaction log behaves just as it much more careful management does with transactional replication— of tempdb. the log cannot be truncated until the log reader has processed it. This means a checkpoint operation, even in SIMPLE recovery mode, will not truncate the log unless it has already been processed by the log reader.4 It uses synchronous tracking Change Data Capture (CDC) uses the mechanism. asynchronous process that reads the once a database is enabled for transaction log. change tracking, a version number is instituted, which allows ordering of operations5 Change Tracking has minimal It has almost nil impact as it impact on the system. asynchronous mechanism reads from the transaction log.6 It uses TempDB heavily It uses transaction log.7 DDL Restriction: No such DDL restriction There are restrictions on the DDL that can be performed on a table being tracked. The most notable restriction is that the primary key cannot be altered in any way. The
  • 76. other restriction worth calling out here is that an ALTER TABLE SWITCH will fail if either table involved has change tracking enabled. 8 SQL Agent not needed t requires SQL Agent to be running. SQL Agent Job & Transaction Replication: Two SQL Agent jobs may be created: the capture job and the cleanup job. I say "may be created" because the capture job is the same as the one used for harvesting transactions in transactional replication. If transactional replication is already configured, then only the cleanup job will be created and the existing log reader job will also be used as the capture job 9 Permission required to enable: Permission required to enable: SYSADMIN DBOwner4.Difference between Index Rebuild and Index Reorganize in SQL Server 2005 S.No Index Rebuild Index Reorganize 1 Index Rebuild drops the existing Index Reorganize physically Index and Recreates the index reorganizes the leaf nodes of the index. from scratch. 2 Rebuild the Index when an index Reorganize the Index when an index is is over 30% fragmented. between 10% and 30% fragmented. 3 Rebuilding takes more server Always prefer to do Reorganize the resources and uses locks unless Index. you use the ONLINE option available in 2005 Enterprise and Development editions. 4 T-SQL for Rebuilding all T-SQL for Reorganize all Indexes of Indexes of a particular table. a particular table. USE AdventureWorks; USE AdventureWorks; GO GO ALTER INDEX ALL ON ALTER INDEX ALL ON HumanResources.Employee HumanResources.Employee REBUILD REORGANIZE GO GO
  • 77. Note: If fragmentation is below 10%, no action required.5.Difference between User -defined SP and System-defined SP S.No User-defined SP System-defined SP 1 Once we create User defined SP System defined sp are available in in one database i.e available to master DB.These sp’s can be directly only that database directly.i.e called from any DB we cannot call it from some other DB’s directly 2 UDSP will be used to fulfill the SDSP will be used for managing sql user requirements serverPlease visit my blog @ http://onlydifferencefaqs.blogspot.in/
  • 78. 1.Difference between Constraints and Triggers S.No Constraints Triggers 1 Once we define some constraint in It will be stored as separate object a table they will be stored along with table definition 2 Constraints will do memory Triggers will do table to table location to table comparison. comparison.For this triggers will use magic tables(inserted,deleted). 3 In the order of precedence first In the order of precedence only after Constraints will be fired Constraints is fired,then only Triggers will be fired 4 Performance wise Constraints will Performance wise triggers will give not give best performance because best performance because table to table memeory location to table comparison is faster than memeory comparison is slower than table to location to table comparison. table comparison. 5 Constraints cannot start a chain Triggers are used to carry out tasks reaction as like triggers - for which cant be done using constraints. instance each delete, update action For eg:-A change in the "sal" column etc. can trigger off another of a table should change the "tax" function column in another table.This cant be done using constraints.It has to be done using triggers.Thats where the importance of triggers lie. 6 Constraint is used for column Trigger is used for table 7 Constraints are predefined Trigger is a user defined business rule business rules in which all the for which user is responasible for logic organisations follow this for business rule constraints without any modification. 8 Constraints are used to maintain Triggers are bascically stored the integrity and atomicity of procedures which automaticallly fired database .In other words it can be when any insert,update or delete is said they are used to prevent issued on table invalid data entry . the main 5 constraints are NOT NULL,PRIMARY KEY,FOREIGN KEY,UNIQUE KEY and CHECK
  • 79. 2.Difference between Cast and Convert in SQL Server S.No Cast Convert 1 Cast is ANSII Standard Convert is Specific to SQL SERVER 2 Cast cannot be used for Convert can be used for Formatting Formatting Purposes. Purposes.For example Select convert (varchar, datetime, 101) 3 Cast cannot convert a datetime to Convert can be used to convert a specific format datetime to specific format 4 Usage of CAST: Usage of CONVERT: USE Sample USE Sample GO GO SELECT SUBSTRING(Name, 1, SELECT SUBSTRING(Name, 1, 30) 30) AS ProductName, ListPrice AS ProductName, ListPrice FROM Production.Product FROM Production.Product WHERE CAST(ListPrice AS int) WHERE CAST(int, ListPrice) LIKE LIKE 3%; 3%; GO GO3.Difference between CUBE and ROLLUP S.No CUBE ROLLUP 1 It is an additional switch to It is an extension to GROUP BY GROUP BY clause. It can be clause. It’s used to extract statistical applied to all aggregation and summarized information from functions to return cross tabular result sets. It creates groupings and result sets. then applies aggregation functions on them. 2 Produces all possible Produces only some possible subtotal combinations of subtotals combinations specified in GROUP BY clause and a Grand Total.Please visit my blog @ http://onlydifferencefaqs.blogspot.in/
  • 80. Difference between basicHttpBinding and wsHttpBindingCriteria BasicHttpBinding WsHttpBindingSecurity This supports the old ASMX This exposes web services using WS-*support style, i.e. WS-BasicProfile 1.1. specifications.Compatibility This is aimed for clients who do As its built using WS-* specifications, not have .NET 3.0 installed and it it supports wider ranges of clients. does not support wider ranges of client Many of the clients like Windows and it cannot be consumed by older 2000 still do not run .NET 3.0. So .NET version less than 3 version. older version of .NET can consume this service.Soap version SOAP 1.1 SOAP 1.2 and WS-Addressing specification.Reliable Not supported. In other words, if Supported as it supports WS-*messaging a client fires two or three calls specifications. you really do not know if they will return back in the same order.Default By default, there is no security As WsHttBinding supports WS-*, itsecurity provided for messages when the hasoptions client calls happen. In other WS-Security enabled by default. So the words, data is sent as plain text. data is not sent in plain text.Security None Noneoptions Windows – default authentication Transport Basic Message Certificate Transport with message credentialsDifference between Message and Transport level security in WCF Criteria Transport Security Message Security Scenarios when we When there are no intermediate When there are intermediate should be using one of systems in between this is the systems like one more WCF them best methodology. 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. Advantages Does not need any extra coding Provides end to end security as as protocol inherent security is it’s not dependent on protocol. used. Any intermediate hop in network does not affect the application. Performance is better as we can use hardware accelerators to Supports wide set of security enhance performance. options as it is not dependent on protocol. We can also implement There is lot of interoperability custom security. support and communicating
  • 81. 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 webservicesDifference between Buffered transfer and Streamed transfer in WCF S.No Buffered Transfer Streamed Transfer 1 Target can process the message once Target can start processing the data when it it is completely received. is partially received. 2 Performance will be good when Performance will be good when message message size is small size is larger(more than 64K) 3 Native channel shape is Native channels are IRequestChannel and IDuplexSessionChannel IReplyChannelDifference between WCF and Web Services S.No Features WebService WCF 1 Hosting It can be hosted in IIS t can be hosted in IIS, windows activation service, Self-hosting, Windows service 2 Programming [WebService] attribute has [ServiceContract] to be added to the class attribute has to be added to the class 3 Model [WebMethod] attribute [OperationContract] represents the method attribute represents the exposed to client method exposed to client 4 Operation One-way, Request- One-Way, Request- Response are the different Response, Duplex are operations supported in different type of web service operations supported in WCF 5 XML System.Xml.serialization System.Runtime.Seriali name space is used for zation namespace is serialization used for serialization 6 Encoding XML 1.0, XML 1.0, MTOM, MTOM(Message Binary, Custom Transmission Optimization Mechanism), DIME, Custom
  • 82. 7 Transports Can be accessed through Can be accessed HTTP, TCP, Custom through HTTP, TCP, Named pipes, MSMQ,P2P, Custom8 Protocols Security Security, Reliable messaging, Transactions9 State Web Services are stateless WCF Services can Management manage states
  • 83. Difference between Self Hosting and IIS Hosting Feature Self Hosting IIS Hosting Coding Effort We need to add some extra code No need to add extra code to host the process Automatic hosting Deployment Easy to deploy More difficult to deploy than Self- Hosting Recycling Automatic process recycling is Automatic process recycling is not possible possible Service Lifetime Can control the service lifetime Lifetime cannot be controlled using Open and Close methods manually. Host Process 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 ServiceContract ServiceBehavior Behaviour Affects the behavior of both Only affects the behavior of the client and server server Applicability Can apply to both interface and Only applicable to a class class implementation Impact on WSDL Affects the WSDL emitted Does not affect the WSDLDifference between proxy and channel factory Proxy Channel Factory Only requires URL where the service resides We must have direct access to the assembly that contains that service contract T for Very simpler Not easier Easy to understand Channels are complex, network-related There is Visual Studio gives us add the reference When we share a common service contract dll between the client and the server, we will be using the ChannelFactory class Proxies have several restrictions like: If we know that our entities will not change 1. Properties need to have gets and sets much and the client code is less, then a DLL 2. Contructors cannot be exposed would work better than a proxy 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
  • 84. Difference between DataContractSerializer and XMLSerializer DataContractSerializer XMLSerializer A practical benefit of the design of the XMLSerializer does not provide better DataContractSerializer is better performance performance when compare with over Xmlserializer. This is because DataContratSerializer because XMLSerializer DataContratSerializer explicitly shows the does not indicate which fields or properties of the which fields or properties are serialized into type are serialized into XML 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 serializes private XmlSerializer cannot serialize private members 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 Only the public members are serialized not the [Serializable] attribute with private members. Suppose we do not need any of DataContractSerializer. It serializes all the the member to be serialized we can use members (private, public) even they are [XmlIgnore] attribute marked with [XmlIgnore]. WCF uses DataContractSerializer attribute Webservice uses XMLSerializer attribute
  • 85. 1.Difference between ASP.NET and Silverlight S.No ASP.NET Silverlight 1 ASP.NET is Microsofts Silverlight is Microsoft technology for technology for developing developing Rich Internet Applications. dynamic web application using It is a browser plug-in that allows code .NET languages like VB.NET or from .NET languages to be run in the C#. The code is executed on the user’s browsers making it easier to web server and the results are sent develop graphically rich applications to the user’s browser. This is without having to constantly go back comparable to the way a web site and forth between the browser and the would be done with the PHP server. This is comparable to Adobes language. Flash technology. 2 ASP.NET uses AJAX to improve Unlike ASP.NET, the bulk of performance in the browser by Silverlight processing occurs on the making post backs and calls client machine thus decreasing server between the browser and server resource utilization and improving the asynchronously. ASP.NET AJAX Web experience on the client. uses new built-in types and controls and JavaScript. There is no concept of “Post back” in Silverlight. 3 Asp.net is not platform Silverlight is delivered as a cross- independent. platform and cross-browser plug-in that exposes a programming framework and features that are a subset of the .NET Framework and Windows Presentation Foundation (WPF). 4 ASP.NET is a server framework Silverlight is a client-side framework for building dynamic web geared at providing a rich user applications. In Asp.net most experience and/or other capabilities processing happens from the such as video streaming. In Silverlight server side. most processing happens from the client side. 5 Both ASP.NET and ASP.NET Silverlight is a free plug-in that AJAX are heavily dependent upon encompasses a subset of functionality the ASP.NET page event life from the .NET Framework and cycle, are tightly coupled to the WPF.Silverlight runs in the browser as server. a "sandbox" - a secure zone installed into the browser that accommodates Silverlight functionality while completely protecting the host platform from any possibly adverse actions performed by Silverlight 6 Asp.net can be hosted in IIS. Silverlight can be hosted in IIS & Apache.
  • 86. 7 ASP.NET is Microsofts Silverlight is Microsofts competitor to competitor to JSP/JSF and the Adobe Flash and Flex. Basically, a successor to classic ASP standalone runtime running inside a browser allowing animation, real-time 2D and vector rendering, etc2.Difference between WPF and Silverlight S.No WPF Silverlight 1 WPF is mainly used for creating Silverlight is prominent for creating desktop applications. web based applications. 2 WPF extends support for The advanced features of Windows OS advanced features of Windows namely 3D, complete documentation OS. Few among those features support and hardware acceleration are are: 3D, complete documentation not supported in Silverlight. support and hardware acceleration. 3 WPF includes extensive collection Silverlight does not support many data of data binding properties. binding properties that are supported by WPF. Few properties that are not supported by Silverlight are ElementName, RelativeSource, UpdateSourceTrigger 4 In WPF, the custom markup The x:type is not available in extensions are supported through Silverlight. the markup extension support x:type. 5 In WPF, the items that are added In Silverlight, the items that are added to the control named TabControl to the control named TabControl will will be wrapped automatically not be wrapped automatically within within the TabItem. the TabItem. 6 WPF provides routed commands Silverlight does not provide routed and all its controls are linked to commands or Command property. commands using the property Silverlight provides only an interface called Command. called ICommand. The developers have to create classes that implement this interface and the custom behavior has to be defined within the class. 7 WPF offers input binding support. Silverlight does not offer input binding support.
  • 87. 3.Difference between HTML 5 and Silverlight S.No HTML 5 Silverlight 1 HTML5 needs to integrate CSS3 On the other hand, Silverlight can be and JavaScript to add its effects to programmed without getting error web pages. prone due to usage of a statically typed .Net language. It is easier to program in Silver light. 2 While HTML5 is more resource Silverlight has a disadvantage in that it friendly. This is the primary consumes a lot of hardware resources reason which Apple has given for of our device not including support for technologies other than HTML5. 3 When HTML5 will be fully On the other hand, newer browsers standardized it is likely to get would have to be compatible with better support from all the newer older versions of Silverlight in order to versions of different browsers. get the proper functioning. 4 HTML5 uses multiple codecs to Silver light always needs a plug-in for run videos on the browsers that any case and would not even run on are not considered in the Apple’s iPhone and iPad. bloc. 5 HTML5 video quality is not that Silverlight offers good video quality crisp as other competitors and its and also provide video content of lack of ability to provide video various quality levels on various content of various quality levels bandwidths to the user. on various bandwidths to the user is also a hindrance in getting the message across to low data rate users. 6 HTML5 pages, when designed, Silver light works just like a plug-in. should be compatible with all the We can simply add the functionality to browsers. for any browser. 7 While HTML5 being more tilted Silverlight application is not easy to towards open source is a relatively decode easy target of stealing code. The divisions of JavaScript and HTML are clearly marked so it is easy to view and understand the code. 8 At present HTML5 doesn’t Silverlight supports microphone and provide direct support for these web cam and thus renders a number of devices. However there are some rich interactive applications. difficult ways to get around this in HTML5.
  • 88. 9 HTML5, like its predecessors Silverlight is not popular in the SEO facilitates search engines to crawl community. At present the content of through its content and get Silverlight is not indexed by search maximum exposure for the engines.Therefore,Silverlight is not website.Therefore,HTML5 is suitable for online business websites or suitable for online business those sites which require traffic websites or those sites which through search engines. require traffic through search engines.4.Difference between Flash and Silverlight S.No Flash Silverlight 1 The animation model is frame Animation - Silverlight supports the based. WPF animation model, which is not only time based instead of frame based, but lets you define the start and end conditions and it will figure out how to get there for you. No need to deal with matrixes like in flash. Also no need to calculate positions on various frames. It just works. 2 Flash stores its shapes using Silverlight uses XAML. XAML is text binary shape records.In order to based and can be output using a simple write shape definitions, you will XML object. need to either license a 3rd party Flash file format SDK, or build your own. It is not too difficult, but it does require a bit of a learning curve. 3 The debugging with flash is The debugging with Silverlight is harder than Silverlight. simpler than with flash. 4 Dealing with fonts is fairly Silverlight lets you embed true type complex with flash. font information directly into your projects, and download that information with the downloader object. 5 Only Action Script can be used as Rich set of development languages are programming tool in Flash. available for Silverlight. Developer can use JavaScript as well as managed code VB.Net, C# for Silverlight development 6 ActionScript is an imperative XAML is declarative while language, which brings itself the ActionScript is imperative.
  • 89. pitfalls of imperative languages Using imperative languages to build when compared with declarative UIs goes back to the early days of languages. DOS and Windows, when developers had to manage all of the API nuances when interacting with graphical panes.7 There is not any such service Web Services support for Silverlight provided by Flash Streaming8 Flash is not spread as across the Additional Support for mobile devices vast majority of both desktops and with desktop and desktop mobiles platforms, as compared to browsers:Silverlight is supported by Silverlight. Flash requires Flash Windows mobile device as part of a Lite preinstalled on mobile new service that the NBL have built. devices. Silverlight applications and media streaming can be run on a mobile phone – so Silverlight even at this stage is about more than just the desktop browser and desktop market. Silverlight may be seen soon on the Symbian OS too.9 Flash requires video codec to Silverlight does not require video run .WMV videos. codec to run industry standard videos like .WMV10 Flash does not support scalable Silverlight supports scalable video video formats from HD to mobile formats from HD to mobile.11 Flash does not support Hardware- Silverlight supports Hardware-assisted assisted editing and encoding editing and encoding solutions. solutions.12 Flash does not have XAML based Silverlight has XAML based presentation layer for SEO. presentation layer for SEO.13 Flash does not provide End-to-end Silverlight provides End-to-end server server and application platform. and application platform.14 Media server licensing is costlier Media server licensing is cheaper than than Silverlight. flash.15 Flash does not support Scalable Silverlight supports Scalable full full screen video. screen video.16 This limitation doesn’t exist with Silverlight is missing Linux support, Flash. so people using Linux machine cannot run it on their machines and will have to stick to Windows and MAC OS17 Flash Video turned Flash into a Silverlight will add to the use of the mechanism for delivering media WMV file format.Using the WMV with far more potential than any video format essentially makes
  • 90. other solution that is .flv, no doubt Silverlight useless for the vast majority Flash has also limitation to play of video websites such as YouTube. It other video file. For that Flash cannot play .avi and .mov file. required codex for that player installed on Client machine.18 Even flash is also lacking this Silverlight has no support for binding area. Flash can read data source in to models,binding to data, or even terms of XML or text from some connecting to network resources to URL and can use it. Same thing obtain data. silverlight also can read.19 Flash has rich set of control Silverlight doesnt even have support library. for things that should be considered a stock part of any library such as buttons, checkboxes, list boxes, list views, grids,etc. Probably in future release may Microsoft support it.20 Flash test tools are already in Once the accessibility features are place. provided with Silverlight versions, any existing test tools that support driving UI through Accessibility will be fully enabled to automate Silverlight applications21 With some media file sound Cannot do sound processing. processing can possible.22 Flash allows creating XML Socket programming is not possible. Socket object.23 Can do that. Per pixel bitmap editing, bitmap filters (convolution, color matrix, etc),bitmap effects (drop shadow, blur,glow) cannot be done.24 Flash supports it. Webcam and Microphone support are not provided by Silverlight25 Inbuilt Upload/download support Built in file upload/download support is there. is not available.26 Flash has a long history that spans Silverlight is new in market and more than ten years, and already required time to get acceptance in got acceptance in market and market. being the most successful browser plug- in ,it is installed on over 90 percent of the world’s web browsers27 Size of flash component is Size of Silverlight component is larger. smaller.
  • 91. 28 Flash ships in single component It has found in practical that is .swf.Images/video/sounds implementation of image animation, at also incorporated in single some extent flickering occurs on .swf package. image.