Your SlideShare is downloading. ×
Dotnet differences compiled -1
Upcoming SlideShare
Loading in...5

Thanks for flagging this SlideShare!

Oops! An error has occurred.


Introducing the official SlideShare app

Stunning, full-screen experience for iPhone and Android

Text the download link to your phone

Standard text messaging rates apply

Dotnet differences compiled -1


Published on

365 Dotnet Difference Between Questions & Answers from the blog:

365 Dotnet Difference Between Questions & Answers from the blog:

Published in: Technology

1 Comment
  • Hi Umar, All your articles are quite good, and I try to read sll of them. All the best & Thanks
    Are you sure you want to  Yes  No
    Your message goes here
No Downloads
Total Views
On Slideshare
From Embeds
Number of Embeds
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

No notes for slide


  • 1. ADO.NET Difference FAQs-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 Can have more than 1 records time 3 Is ForwardOnly and Readonly Can navigate front and back and editable 4 Faster Slower 2. What are the differences between DataSet and DataReader? S.No DataSet DataReader 1 The data store whose records You can read data from datareader have to be manipulated can be only if the connection to data store disconnected. exists. 2 You have the provision to cache Caching of data is not possible. data fetched from data store when using dataset. 3 Dataset objects have XML XML Support is not provided by Support. datareader. 4 A single dataset object can Datareader can read records contain collection of datatable fetched by a command object objects wherein each datatable containing a single query. If you object refers to a table in the have to fetch data from multiple datastore. Hence you can tables, then datareader is not manipulate on multiple tables advantageous when compared to using a dataset. dataset. 5 Using dataset, you can read the While reading records, you can records fetched in any order. iterate only in forward direction. 6 Performance wise, dataset is Datareader gives high performance slow because it has multiple and records can be fetched faster tables which in turn include when compared to dataset. multiple rows, columns and constraints. 3. 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 and data structure of the DataSet, including all DataTable schemas, relations,
  • 2. 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 DataSet is a data structure which row at an instant represents the complete table data at the same time 2 RecordSet always needs an DataSet needs connection only for Open connection to read the retrieving the data. After retrieve the data from data sources data connection is not necessary 3 RecordSet is able to load the DataSet has the capability to store structure and data of only one the structure and data of multiple table at a time tables at a time 4 RecordSet does not support DataSet enforces data integrity by constraints of Databases using Constraints5. What are the differences between ADO and ADO.Net? S.No ADO ADO.Net 1 It is a COM based library. It is a CLR based library. 2 Classic ADO requires active ADO.NET architecture works while the connection with the data store. data store is disconnected. 3 Locking feature is available. Locking feature is not available. 4 Data is stored in binary format. Data is stored in XML. 5 XML integration is not possible. XML integration is possible. 6 It uses the object named It uses Dataset Object for data access Recordset to reference data from and representation. the data store. 7 Using Classic ADO, you can Dataset object of ADO.NET includes obtain information from one table collection of DataTables wherein each or set of tables through join. You DataTable will contain records fetched cannot fetch records from multiple from a particular table. Hence multiple tables independently. table records are maintained independently. 8 Firewall might prevent execution ADO.NET has firewall proof and its of Classic ADO. execution will never be interrupted. 9 Classic ADO architecture includes ADO.NET architecture doesnt include client side cursor and server side such cursors. cursor.
  • 3. 10 You cannot send multiple You can send multiple transactions transactions using a single using a single connection instance. connection instance.Reference: Difference FAQs-21.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 typed dataset. it makes it easier to use. 2 They have .xsd file (Xml They do not do error checking at Schema definition) file the design time as they are filled at associated with them and do run time when the code executes. error checking 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 Performance is faster in case of of strongly typed dataset. Untyped dataset. 5 In complex environment, Untyped datasets are easy to strongly typed datasets are administer. difficult to administer.Typed DataSets use explicit names and DataTypes for their members.ex:northwindDataSet.Products.ProductNameColumn.Caption = "pnames";UnTyped DataSets use table and column collections for their membersex:ds.Tables["emp"].Columns["eno"].ReadOnly=true;2.Difference between DataView and DataTable S.No DataView DataTable 1 Read-only i.e., DataView can Read/Write i.e., Datatable can be be used to select the data. used to edit or select or delete or insert a data.
  • 4. 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 Data takes storage space. existing DataTable, and does not consume space. 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 persistent. hidden 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 which are columns with a value columns 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 Disconnected Environment does a constantly connection of user not need any connection. to data source while performing any operation. 2 Only one operation can be Multiple operations can be performed at a time in performed. connection Environment. 3 DataReader is used in DataSet is used in it. Connection Environment. 4 It is slower in speed. Disconnected Environment has a good speed.
  • 5. 5 We get updated data in it. There is a problem of dirty read.Reference: Difference FAQs-31.Difference between ExecuteNonQuery() and ExecuteScalar() methods in ADO.NET S.No ExecuteNonQuery() ExecuteScalar() 1 It will work with Action Queries It will work with Non-Action Queries only that contain aggregate functions. (Create,Alter,Drop,Insert,Updat e,Delete). 2 It returns the count of rows It returns the first row and first effected by the Query. column value of the query result. 3 Return type is int Return type is object. 4 Return value is optional and Return value is compulsory and can be assigned to an integer should be assigned to a variable of variable. required type.Example-1 for ExecuteNonQuery Method -Insert:SqlCommand cmd = new SqlCommand("Insert Into SampleTable Values(1,2)",con);//con is the connection objectcon.Open();cmd.ExecuteNonQuery(); //The SQL Insert Statement gets executedExample-2 for ExecuteNonQuery Method - Update:public void UpdateEmployeeEmail(){SqlConnection conn = new SqlConnection(connString))String sqlQuery = "UPDATE Employee SET WHEREempid=5;SqlCommand cmd = new SqlCommand(sqlQuery, conn);try{conn.Open();cmd.ExecuteNonQuery();}catch (Exception ex){Console.WriteLine(ex.Message);}finally{
  • 6. conn.Close();}return count;}Example-1 for ExecuteScalar Method:This returns only one value that is first column value of the first row in the executed querypublic int getSomeProdId(){int count=0;SqlConnection conn = new SqlConnection(connString))String sqlQuery = "SELECT COUNT(*) FROM dbo.region";SqlCommand cmd = new SqlCommand(sqlQuery, conn);try{conn.Open();//Since return type is System.Object, a typecast is mustcount = (Int32)cmd.ExecuteScalar();}catch (Exception ex){Console.WriteLine(ex.Message);}finally{conn.Close();}return count;}Example-2 for ExecuteScalar Method:This returns one value only, no recordsets.cmd.CommandText = "Select Name, DOB, from Emp where ID=1";Dim strName As string = cmd.ExecuteScalar.ToString2.Difference between ExecuteNonQuery() and ExecuteReader() methods inADO.NET S.No ExecuteNonQuery() ExecuteReader() 1 It will work with Action Queries It will work with Action and Non- only Action Queries (Select) (Create,Alter,Drop,Insert,Updat e,Delete).
  • 7. 2 It returns the count of rows It returns the collection of rows effected by the Query. selected by the Query. 3 Return type is int Return type is DataReader. 4 Return value is optional and Return value is compulsory and can be assigned to an integer should be assigned to an another variable. object DataReader.Example-1 for ExecuteNonQuery Method -Insert:SqlCommand cmd = new SqlCommand("Insert Into SampleTable Values(1,2)",con);//con is the connection objectcon.Open();cmd.ExecuteNonQuery(); //The SQL Insert Statement gets executedExample-2 for ExecuteNonQuery Method - Update:public void UpdateEmployeeEmail(){SqlConnection conn = new SqlConnection(connString))String sqlQuery = "UPDATE Employee SET WHEREempid=5;SqlCommand cmd = new SqlCommand(sqlQuery, conn);try{conn.Open();cmd.ExecuteNonQuery();}catch (Exception ex){Console.WriteLine(ex.Message);}finally{conn.Close();}return count;}Example for ExecuteReader Method:Here, ExecuteReader is used to get set of records by specified query, namely, "select *from emp"SqlConnection con = new SqlConnection(constr); //constructor can be connection of string.SqlCommand cmd = new SqlCommand ("select * from emp", con);con.Open();SqlDataReader dr = cmd. ExecuteReader (CommandBehavior. CloseConnection);//Implicitly closes the connection because CommandBehavior. CloseConnection wasspecified.
  • 8. while(dr.Read()){Console.WriteLine (dr.GetString(0));}dr.Close();Reference:
  • 9. AJAX Difference FAQs-11.Difference between AJAX and jQuery S.No AJAX jQuery 1 AJAX is a powerful tool which JQuery is a light weight language cannot use HTML since it is a that focuses the interaction in the simple tool and it can not HTML elements. reload the page after it is once loaded. 2 AJAX is a combination of JQuery cannot provide a new several technologies such as functionality by combining with CSS, HTML, DOM and many other technologies. more. In combination with these technologies, AJAX provides new functionalities. 3 AJAX should be accessed in a JQuery can be accessed through proper procedure to retrieve front-end therefore JQuery does data from the server. not require understanding of the complete procedure to setup a page. 4 Heavy usage of AJAX often There is no chance for overload of leads to the server overload server while using JQuery since due to more number of there is no such heavy usage in connections created. JQuery.2.Difference between AJAX and JavaScript S.No AJAX JavaScript 1 AJAX allows the coder send JavaScript is a client side scripting request data asynchronously in language that allows the creation of order load new data without dynamic web pages by providing a changing the web page. new level of interactivity. 2 AJAX supports the server side JavaScript provides support to the scripting Language. client side scripting language. 3 AJAX can load the web page JavaScript cannot load the pages after it is been loaded for the after it is once loaded. first time. 4 AJAX does not install Trojan in JavaScript can install Trojan in the the computer. computer.3.Difference between AJAX and PHP S.No AJAX PHP
  • 10. 1 AJAX is an Asynchronous PHP is a Hypertext processor that JavaScript XML that has a is a general scripting language group of web technologies which produces dynamic web which are interrelated. pages. 2 AJAX is not a stand alone PHP is a stand alone technology. technology. AJAX is a group of technology. 3 AJAX needs a specific platform PHP can run on any platform and and operating system to run. operating system. 4 AJAX is difficult to develop on PHP is easy to develop on static static pages. pages. 5 AJAX will only run if the PHP is highly vulnerable and does browser supports JavaScript or not require much support. XMLHttpRequest.4.Difference between AJAX and DHTML S.No AJAX DHTML 1 AJAX does not have the DHTML makes a Button glow or feature of making the button pressed when the cursor is moved glow when the cursor is moved over it. over it. 2 AJAX can load a single link DHTML loads a fresh new page to instead of loading the whole load a link. new page. 3 AJAX saves the loading time. DHTML consumes more time than AJAX takes in loading the page. 4 AJAX permits the browser to DHTML does change the element request certain elements which on the screen depending on the reduces the strain on the request from the user. internet.Reference:
  • 11. ASP.NET Difference FAQs 1. What are the differences between Inline code and Code Behind Code? S.No Inline code Code Behind Code 1 Its within .aspx file Its in a external class file 2 Dynamically compiled Compiled prior to deployment and linked with .aspx file 2. What are the differences between Global.asax and Web.Config? S.No global.asax web.config 1 It is a class file It is an XML file 2 There can be only one for an There can be many if under different application sub-folders 3 Can have Application and Cannot have Application and Session Session events events 4 Need to be recompiled when No need to compile when changes changes are made are made 3. What are the Differences between Server.Transfer and Response.Redirect? S.No Server.Transfer Response.Redirect 1 The navigation happens on the The navigation happens on the server-side ,so client history is client-side ,so client history is not updated updated 2 Data can be persist across the Context.Items loses the persistence pages using Context.Item collection 3 No Round-trips Makes a Round-trip 4 Has Good encapsulation No 4. What is the difference between a custom control and a user control? S.No User Control Custom Control 1 Is a file with the .ascx extension Is a file with the .dll extension 2 Can be only used with the Can be used in any number of application applications 3 Language dependent They are language independent, a control created in c# can be used in 4 Cannot be added to Visual studio Can be added to Visual studio Toolbox
  • 12. Toolbox 5 Inherits from Server controls and We have to develop from scratch , easy to create so comparatively difficult 6 Generally used for static content Used when dynamic content is required 5. What is the difference between Caching and Application? S.No Caching Application 1 Cache have expire policy Application does not have expire policy 2 Cache does not require explicit Application require explicit locking locking 3 Cache has the Property of Application variables exist as long as timeout, which allows us to control the application is alive the duration of the Objects so cached 4 Output can be cached in 4 ways, Application does not have options as like Cache object • Page Output Caching • Page Partial Caching • DataSource Caching • Data Caching 5 It is accessible to page level to all It is accessible to both page level the users and application level to all the users 6. What is the difference between web farm and web garden? S.No Web farm Web garden 1 A web application running on A web application running on a single multiple servers is called a web server that has multiple CPUs is farm. called a web garden.The benefit of using this is, if one server crashes then other will work instantly. 2 For Web Garden, we have to use Web Farm is implemented using techniques like Net Work Load in Machine.Config file. Balancing.Summary:Web garden and web farms are applications that serve the purpose when theuser base of a web site increases considerably.For Web garden/Web Farm configurations, we have to set sessionState mode to
  • 13. StateServer/SQLServer in the web.config file. 7. What is the difference between Application and Session Events? S.No Application Event Session Event 1 Application events are used to Session events are used to initialize objects and data that initialize data that we want to keep we do want to make available throughout individual sessions, but to all the current sessions of that we do not want to share our web application between sessions 8. What is the difference between Session Cookies and Persistent Cookies? S.No Session Cookies Persistent Cookies 1 Session Cookies do not have Persistent Cookies have an expiration expiration date date. The expiration date indicates to the browser that it should write the cookie to the client’s hard drive 9. What are the differences between Server Controls and HTML Controls? S.No Server Controls HTML Controls 1 Server Controls can trigger HTML Controls can trigger only control-specific events on the page-level events on server server (postback) 2 Data entered in a server control Data is not maintained in an HTML is maintained across requests. control. Data must be saved and Server controls retain state restored using page-level scripts 3 The Microsoft .NET Framework HTML controls have HTML provides a set of properties for attributes 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 write for least common denominator display as appropriate 10.What are the differences between ViewState and Hidden fields? S.No ViewState Hidden fields 1 This is used for pages that will This is used for pages that will postback to itself postback to itself or to another page 2 This is built in structure for This is not an inbuilt structure maintaining state of a page 3 Security is more as data is Security is less when compared to hashed, compressed and ViewState
  • 14. encoded11.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, we Using SQL Cache Invalidation, we can generate notifications when can make a cached item invalid that the data of a database on which a depends on the data stored in a SQL cached item depends changes server database, when the data in the SQL server database is changed 12.What is the difference between absolute time expiration and sliding time expiration? S.No Absolute time expiration Sliding time expiration 1 In absolute time expiration, a In sliding time expiration, the time for cached item expires after the which the item is cached is each time expiration time specifies for it, incremented by its expiration time if it irrespective of how often it is is accessed before completion of its accessed expiration 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 item in the cache we 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() the Cache.Add() method 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?
  • 15. 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 page17.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 HTML source code inside its source complete 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
  • 16. 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 supported for a specific language or be different for different locale languages and isolating that portion from the core of the web application 2 example: example: a)consider this tag in Web.Config we have 2 resource files: file. a) b)default.aspx.en-US.resx It would cause the dates to be displayed in French for the web Using appropriate coding in the page of the folder where this .aspx.cs files of a web page, the Web.Config file is located. strings written in these resource files can be used to change the text of the b) CultureInfo d=new strings dynamically. CultureInfo("de-DE"); Response.Write(DateTime.Now.T oString("D",d); It would display date in long format using German culture 23.What are the differences between web.config and machine.config? S.No web.config machine.config 1 This is automatically created This is automatically installed when when we create an ASP.Net web we install Visual Studio. Net application project 2 This is also called application This is also called machine level level configuration file configuration file 3 We can have more than one Only one machine.config file exists on web.config file a server 4 This file inherits setting from the This file is at the highest level in the machine.config configuration hierarchyReference: Difference FAQs-2Difference between Web site and Web application S.No Web site Web application 1 Can mix vb and c# page in We cant include c# and vb page single website. in single web application.
  • 17. 2 Can not establish We can set up dependencies dependencies. between multiple projects.3 Edit individual files after Can not edit individual files after deployment. deployment without recompiling.4 Right choice when one Right choice for enterprise developer will responsible environments where multiple for creating and managing developers work unitedly for entire website. creating,testing and deployment. i.e.,In web site i.e.,In Web application, different development, decoupling is different groups work on various not possible. components independently like one group work on domain layer, other work on UI layer.5 Web site is easier to create Web application is more difficult than Web application to create than a Web siteDifference between Local storage and cookiesS.No Local storage Cookies1 Good to store large amount Good for small amount of data, up of data, up to 4MB to 4KB2 Easy to work with the Difficult to work with JavaScript JavaScript3 Local storage data is not All data is transferred to and from sent to the server on every server, so bandwidth is consumed request (HTTP header) as it on every request is purely at the client side4 No way to specify the time Can specify timeout period so that out period as the Cookies cookies data are removed from have browserDifference between Session and CacheS.No Session Cache1 Ssession retains state Cache is used for retaining state for per user application scoped items.2 Items put into a session Items in the cache can expire (will will stay there, until the be removed from cache) after a session ends specified amount of time. And also there is no guaranty that objects will not be removed before their expiration times as ASP.NET remove
  • 18. items from cache when the amount of available memory gets small. This process is called as Scavenging.3 The session state can This is not the case with the cache. be kept external (state server, SQL server) and shared between several instances of our web app (for load balancing).Difference between Datalist and RepeaterS.No Datalist Repeater1 Datalist supports multiple Repeater doesnt support multiple columns displaying and columns display,no repeat columns using repeat columns property property2 Datalist supports styles Repeater does not provide styles for formating templates data[headerstyle,...]3 Datalist rendering Repeater performanace is better output[html content]will than Datalist be slow compare with repeater.Summary:If the requirement can achieve using repeater and datalist,choose repeater for betterperformanceReference: Difference FAQs-31.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 Microsoft in the year 2002. Lerdorf in the year 1995. 2 Database: Database: ASP.Net uses MS-SQL for For point of database connectivity
  • 19. connecting database but MS- PHP uses MySQL for the purpose SQL can not be availed free of database connectivitybecasue from Microsoft. its 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 Information Server (IIS)on a Linux can be used for running PHP Windows server platformif you programs and Linux is free want to run ASP.Net program. operating system. Therefore,the As Windows server platform is cost of developing a website in not a free product,the cost of PHP language is remarkably low production is bounded to be increased.4 Run Time : Run Time: Whereas inbuilt memory space is It has been observed that used by PHP while running. ASP.Net code runs slower than PHP code. This is because ASP.Net utilizes server space while running5 Coding Simplicity: Coding Simplicity: PHP codes are very simple and a ASP.Net codes are somewhat programmer does not have to complicated and a web make a diligent effort because it is developer needs to work hard comparatively easier than other to get the hang of it types of programming languages.6 Platform Connectivity Issue : Platform Connectivity Issue: PHP has a unique advantage in ASP.NET codes are usually this issue. Its codes can be linked run on Windows platforms but with different types of platforms if you install ASP-Apache in such as Windows, Linux and UNIX. the server than it can run on Linux platform as well.7 Cost of Tools : Cost of Tools : 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 available for free8 The syntax of ASP.Net is more Language Support : or less similar to that of Visual basic syntax and this is all but The codes that are used in PHP
  • 20. simple. are very much similar to that of C+ + 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 reputed for Though PHP can offer enough creating sophisticated measures for ensuring data techniques to ensure the security 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 ASP.NET is a programming model model. that is event driven. 2 ASP code is an interpreted ASP.NET is a compiled CLR code language that is interpreted by that will be executed on the Server. the script engine. 3 HTML and the coding logic are The code and design logic is mixed in ASP. separated in ASP.NET. 4 To develop and debug ASP ASP.NET application can be application, there are very developed and debugged using limited tools. various tools including the leading Visual Studio .NET tool. 5 ASP has limited support to ASP.NET is a complete Object Object Oriented Programming Oriented Programming language. principles. 6 Session management and ASP.NET extends complete application state management support for session management is very limited in ASP. and application state management. 7 Error handling system is poor ASP.NET offers complete error in ASP. handling and exception handling services. 8 ASP does not offer any in-built In ASP.NET, data exchange is support for the XML. easily performed using XML support.
  • 21. 9 Data source support is not fully Data source support is fully distributed in ASP. distributed in ASP.NET.3.Difference between ASP.NET and VB.NET S.No ASP.NET VB.NET 1 ASP.NET is web technology VB.NET is a language that is used that is used in building web in writing programs that are utilizing applications and websites. the 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 independent. Any .NET create ASP.NET web applications languages such as C#, or windows applications using VB.NET can be used to Visual Studio Windows Forms develop web applications Designer or mobile applications or through ASP.NET. console applications or applications for variety of other purposes. 3 ASP.NET is included within the VB.NET is not part of .NET .NET framework. framework. For example, ASP.NET For example, VB.NET is the code contains the text boxes and the that is written on various events of controls that can be dragged text boxes and controls to make and dropped into a web form. them 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.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 Runtime) execute the code with and convert source code to two phase compilation. byte code.
  • 22. 4 JAVA can run on any .NET can run only on windows/IIS. operating system5 But in JAVA it depends upon Although .NET support both explicit the 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 .net has a standard development IDEs are available. IDE i.e. Microsoft Visual Studio8 But web application in java run Both windows and web on any operating system. applications 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 multiple round trips to data access through ADO.Net has high base. Hence, performance is level of performance against Java lesser than .NET JDBC13 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 configuration computer system. system.15 Java can only communicate .Net is the platform itself for a with java programs multitude of languages. One can use C, C++ and VB to program upon .net. These programs interact
  • 23. 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.Reference: Difference FAQs-41.Difference between HTTP and HTTPS S.No HTTP HTTPS 1 URL begins with “http://" in URL begins with “https://” in case of case 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 certificates required in HTTPS. HTTP 7 Most internet forums will HTTPS should be used in Banking probably fall into this category. Websites, Payment Gateway, Because these are open Shopping Websites, Login Pages, discussion forums, secured Emails (Gmail offers HTTPS by access is generally not default in Chrome browser) and required Corporate Sector Websites. For example: PayPal: Google AdSense:
  • 24. 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 3 Security: Security: Since GET request is sent via Since Post request encapsulated URL, so that we can not use name pair values in HTTP request this method for sensitive data. body, so that we can submit sensitive data through POST method. 4 Length: Length: GET request has a limitation POST request has no major on its length. The good limitation. 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 and bookmarking. caching 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 POST request has no restriction. data as TEXT. 8 Best Example: Best Example: SEARCH is the best example LOGIN is the best example for for GET request. POST request.
  • 25. 9 HTTP Request Message HTTP Request Message Format: Format: 1 POST /path/script.cgi HTTP/1.0 1 GET /path/file.html? 2 From: SearchText=Interview_Questio 3 User-Agent: HTTPTool/1.0 n HTTP/1.0 4 Content-Type: application/x- 2 From: www-form-urlencoded 5 Content-Length: 8 3 User-Agent: HTTPTool/1.0 6 4 [blank line here] 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 likespaces that 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.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 Only one master page can be one User Controls. assigned 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 page.) .aspx page) 6 Register Tag is added when MasterPageFile attribute is added we drag and drop a user in the Page directive of the .aspx control onto the .aspx page. page when a Master Page is referenced in .aspx page. 7 Can be attached dynamically Can be referenced using using LoadControl Web.Config file also or dynamically method.PreInit event is not by writing code in PreInit event.
  • 26. mandatory in their 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 and projects that have files in the solution irrelevant of changed. whether they have changed or not. 2 Build does not updates the Rebuild updates the xml- xml-documentation files documentation filesNote: Sometimes,rebuild is necessary to make the build successful. Because, Rebuildcleans Solution to delete any intermediate and output files, leaving only the project andcomponent files, from which new instances of the intermediate and output files can then bebuilt.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 configured in web.config against with .ashx extension extension in web.config.It does not have any extension 2 Typical example of generic For http handler, page handler handler are creating which serves .aspx extension thumbnails of images request and give response.Reference: Difference FAQs-51.Difference between ViewState and SessionState S.No ViewState SessionState 1 View state is maintained in Session state is maintained in page level only. session level. 2 View state of one page is not Session state value is available in visible in another page.i.e., all pages within a user session.i.e.,
  • 27. when user requests another The data will be no longer available page previous page data will if user close the browser or be no longer available. session timeout occurs. 3 View state information stored Session state information stored in 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 (browser) when post back data available till user close the operation done. browser or session time completes. 5 View state used to persist Session state used to persist the page-instance-specific data. user-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 EnableViewState is off. property 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 off3.Difference between SessionState and Cookies S.No SessionState Cookies 1 Session can store any type of Cookies can store only "string" data because the value is of datatype datatype of "object" 2 These are stored at Server They are stored at Client side side 3 Session are secured because Cookie is non-secure since stored
  • 28. it is stored in binary in text format at client side format/encrypted form and it gets decrypted at server 4 Session is independent for Cookies may or may not be every client i.e individual for individual for every client every client 5 There is no limitation on size or Due to cookies network traffic will number of sessions to be used increase.Size of cookie is limited to in an application 40 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 cookies because its persistent cookies life time can be set manuallyReference: Difference FAQs-61.Difference between DataGrid and GridView S.No DataGrid GridView 1 Sorting: In DataGrid code Sorting: In case of GridView no requires to handle the additional code required. SortCommand event and rebind grid required. 2 Paging: In DataGrid requires Paging: In case of GridView no code to handle the additional code required. It also PageIndexChanged event and supports customized appearance. rebind grid required. 3 Data binding: Like GridView Data binding: GridView can bind DataGrid cannot bind with new with new datasource control datasource control in ASP.NET 2.0.
  • 29. 4 Updating data: DataGrid Updating data: GridView requires requires extensive code to little code. Code like exceptions update operation on data handling for database part. 5 Events: In DataGrid less Events: GridView supports events events supported as compared fired before and after database to GridView. updates.2.Difference between ListView and GridView S.No ListView GridView 1 Data Grouping: In-built Data Grouping: To provide this support for this functionality is functionality, we need to write provided. custom code. 2 Provide Flexible Layout: In- Provide Flexible Layout: To built support for this provide this functionality, we need functionality is provided. to write custom code 3 Insert: In-built support for this Insert: To provide this functionality, functionality is provided. we need to write custom code3.Difference between DataList and GridView S.No DataList GridView 1 Paging: To provide this Paging: In-built support for this functionality, we need to write functionality is provided. custom code. 2 Provide Flexible Layout: In- Provide Flexible Layout: To built support for this provide this functionality, we need functionality is provided. to write custom code 3 Update,Delete: To provide this Update,Delete: In-built support for functionality, we need to write this functionality is provided. custom code 4 Data Grouping: In-built Data Grouping: To provide this support for this functionality is functionality, we need to write provided. custom code. 5 Sorting:To provide this Sorting:In-built support for this functionality, we need to write functionality is provided.
  • 30. custom code.4.Difference between Repeater and ListView S.No Repeater ListView 1 Paging: To provide this Paging: In-built support for this functionality, we need to write functionality is provided. custom code. 2 Data Grouping: To provide Data Grouping: In-built support for this functionality, we need to this functionality is provided. write custom code. 3 Insert: To provide this Insert: In-built support for this functionality, we need to write functionality is provided. custom code 4 Update,Delete: To provide this Update,Delete: In-built support for functionality, we need to write this functionality is provided. custom code 5 Sorting:To provide this Sorting:In-built support for this functionality, we need to write functionality is provided. custom code.5.Difference between Repeater and DataList S.No Repeater DataList 1 Repeater is template driven DataList is rendered as Table. 2 Repeater cannot automatically DataList can automatically generates columns from the generates columns from the data data source source 3 Row selection is not supported Row selection is supported by by Repeater DataList 4 Editing of contents is not Editing of contents is supported by supported by Repeater DataList 5 Arranging data items We can arrange data items horizontally or vertically is not horizontally or vertically in DataList supported by RepeaterReference:
  • 31. ASP.NET Difference FAQs-71.Difference between trace and debug in .NET S.No Trace Debug 1 This class works only when This class works only when your your application build defines application build defines the the symbol TRACE. symbol DEBUG. 2 For tracing, you have to use For tracing, you have to use Trace.WriteLine statements. Debug.WriteLine statements. 3 Trace class is generally used You generally use debug classes at to trace the execution during the time of development of deployment of the application. application. 4 Trace class works in both Debug class works only in debug debug mode as well as release mode. mode. 5 Performance analysis can be Performance analysis cannot be done using Trace class. done using Debug class. 6 Trace runs in a thread that is Debug runs in the same thread in different from the Main Thread. which your code executes. 7 Trace is used during Testing Debug is used during Debugging Phase and Optimization Phase Phase of different releases.2.Difference between ASP and ASPX S.No ASP ASPX 1 The .asp is the file extension of The .aspx is the file extension of the classic ASP page. ASP.NET page. 2 ASP stands for Active Server ASPX is the acronym of Active Pages. Server Pages Extended. 3 The .asp file runs under the The .aspx file runs in a separate process space of inetinfo.exe, worker process called as which is an IIS process space. aspnet_wp.exe. 4 The .asp file can execute only The .aspx file can run on any in platforms of Microsoft platforms, be it Microsoft or not. technology. It cannot run in Hence .aspx file can be executed non-Microsoft platforms like in Apache Web Server as well. Apache Web Server. 5 The .asp file can be coded in The .aspx file can be coded using only two languages namely any .NET language including VBScript and Javascript. Both VB.NET, C#. Both VB.NET and C#
  • 32. these languages are client side are Server Side Languages. languages. 6 In .asp file, the executable In .aspx file, the executable code code can be included outside a cannot be included outside a function scope where in the function scope where in the function is located inside the function is located inside the script script block marked as block marked as runat=server. runat=server. 7 In .asp file, a function can be In .aspx file, a function cannot be defined inside server side defined inside server side script script tags. tags. 8 In .asp file, all the directives In .aspx, the language directive will be placed in the page’s first must be enclosed within page line using <%@Page directive as <%@Page Language= Language= “Jscript” %> tag. “VB” %>3.Difference between thread and process S.No Thread Process 1 Threads share the address Processes have their own address. space of the process that created it. 2 Threads have direct access to Processes have their own copy of the data segment of its the data segment of the parent process process. 3 Threads can directly Processes must use interprocess communicate with other communication to communicate threads of its process with sibling processes. 4 Threads have almost no Processes have considerable overhead overhead 5 New threads are easily created New processes require duplication of the parent process. 6 Threads can exercise Processes can only exercise considerable control over control over threads of the same process child processes 7 Changes to the main thread Changes to the parent process (cancellation, priority change, does not etc.) may affect the behavior of affect child processes. the other threads of the process
  • 33. Another good reference: between ASPX and ASCX S.No ASPX ASCX 1 ASP.NET Page uses the User Control uses the extension extension .aspx .ascx For eg: Default.aspx For eg: WebUserControl.ascx. 2 ASP.NET Page begin with a User Control begin with a Control Page Directive. Directive. For eg: For eg: <%@ Page Language="C#" <%@ Control Language="C#" AutoEventWireup="true" AutoEventWireup="true" CodeFile="Default.aspx.cs" CodeFile="WebUserControl.ascx.c Inherits="_Default" %> s" Inherits="WebUserControl" %> 3 Usercontrol code can be used We can not use webforms in in webforms usercontrol. 4 ASP.NET Page can be viewed User Control cannot be viewed directly in the Browser. directly in the browser. User Controls are added to WebPages and we view them by requesting a web page in our browser 5 ASP.NET page has HTML, User Control does not have a Body or Form element. HTML, Body or Form element.Reference: Difference FAQs-81.Difference between HTML Controls and ASP.NET Standard Controls S.No HTML Controls ASP.NET Standard Controls 1 All HTML Controls run at Client All ASP.NET Controls run at Server side side 2 Can be made to run at Server Can’t be made to run at Client side side by adding runat=”server” rather equivalent HTML code is attribute generated on Rendering 3 Rendering is NOT Required Rendering is Required 4 Execution is FAST Execution is SLOW
  • 34. 5 Don’t contain any class for the Contains Separate class for each Controls Controls 6 Don’t support Object Oriented Supports Object Oriented Programming features Programming Features 7 Don’t provide STATE Provides STATE MANAGEMENT MANAGEMENT2.Difference between Response.Redirect and Server.Transfer S.No Response.Redirect Server.Transfer 1 Used to redirect to any Used to redirect to any webpage in webpage in any website current website only 2 Can be used to pass the Can’t be used to pass the required required values from Source values from Source Page to Target Page to Target Page while Page while redirecting redirecting 3 Execution is Slow Execution is Fast 4 Target page address appears Target page address doesn’t within the address bar appears within the address bar 5 Refreshing of the page doesn’t Refreshing of the page causes cause any error error3.Difference between ASP.NET and ASP.NET MVC S.No ASP.NET ASP.NET MVC 1 You need .NET framework to You need .NET framework & install ASP.NET. ASP.NET to Install MVC. 2 Supports Code behind page Supports both Code behind page coding & Inline coding coding & Inline coding but, we should not use code behind as a practice because view should not perform any logic. 3 Pages are called Pages Pages are called Views 4 There is a Life cycle for every There is tailored lifecycle of the page. page. By default you wont see the events when you create the Views but, you can add the Page Load event by in a script server tag. Again its not a good practice 5 We use Viewstate concept There is no Viewstate for view. extensively There is no state of the controls. But state of the entire page can be maintained by a feature
  • 35. ModelBinders6 Every Page is inherited from Every Page is inherited from System.Web.UI.ViewPage System.Web.Mvc.ViewPage. View page is inherited from System.Web.UI.Page.7 You dont have the strongly You can create the Strongly typed typed pages Views using generics. It means, you can pass the object (Model) to the view page from the controller.8 Has lot of inbuilt Controls that We cannot use the ASP.NET support RAD. controls because they dont support the ViewState and Postback. We have inbuilt methods called HTML Helper methods. These methods just create the required HTML in the response stream. You can create the user controls.9 Has the limited control over the Since we have no controls and are HTML being generated by writing HTML we have control over various controls. the markup.10 Logic is not completely Logic is modularized in methods modularized in pages. called Action methods of the controller.11 Difficult to test the UI Logic MVC is designed to unit test using unit tests. every part of the application. It strongly supports the TDD approach.12 Doesnt support clean or Support clean or search engine search engine friendly friendly URLs URLs . ASP.NET 4 has the You can design to support the routing module or else REST based resources in we need to use URL rewrites. application13 Code behind supports only one Web request finally will reach aspect of separation of the controller. Requests never concerns. reach Views. Web user cannot identify a specific view on the server.14 Web requests are reached Web request finally will reach directly to the intended the controller. Requests never page. Web users can identify reach Views. Web user cannot the pages on the server. identify a specific view on the server.
  • 36. 15 If you rename the web pages You dont need to change the URL, the URL is changed even if you change the Controller and the View.16 URLS are determined by the You have to define the URL folder structure of the pages formats which are called Routes. Framework will try to match the URL with all the defined routes in an order. Framework will hand over the request to the corresponding route Handler.17 Query string are used as small URLS formats drive the inputs to inputs to the pages the requests. You can also have querystrings18 Related Pages are separated Related Views are written under by folder controller. And for each controller we need to create a folder for all its views.19 We have ASP.NET AJAX MVC has some AJAX features but Framework and AJAX server internally it uses the ASP.NET side controls to support AJAX AJAX script libraries. So we have page development to manually include the libraries in the project. No support of AJAX Server side controls.20 File extensions in IIS are There are no file extensions for mapped to ASP.NET isapi dll MVC. If deployed in IIS7 Internally and in web.config they are it will use the MVC mapped to corresponding file UrlRoutingModule to route the HTTPHandlers. request to the MVC framework.21 All the Page requests are Each Route has the option to use a handled by PageFactory default Route handler or custom Handler. handler. So all the page requests are handled by Route handles.22 Its difficult to modify the Its designed to modify or replace internal behavior of the core the internal components. It ASP.NET components. supports the Plug-in structure Example: - ASPX Pages are used to render the HTML. You can configure to not to use ASP.NET pages and use different view engines. There are many view engines available in market or you can
  • 37. create your own view engine.Reference: Between HttpHandler and HttpModuleDifference between HttpHandler and HttpModule S.No HttpHandler HttpModule 1 Meaning: Meaning: An ASP.NET HTTP handler is An HTTP module is an assembly the process (frequently that is called on every request that referred to as the "endpoint") is made to our application. HTTP that runs in response to a modules are called as part of the request made to an ASP.NET ASP.NET request pipeline and Web application. The most have access to life-cycle events common handler is an throughout the request. HTTP ASP.NET page handler that modules examine incoming and processes .aspx files. When outgoing requests and take action users request an .aspx file, the based on the request. request is processed by the page through the page handler. We can create our own HTTP handlers that render custom output to the browser.In order to create a Custom HTTP Handler,we need to Implement IHttpHandler interface(synchronous handler) or Implement IHttpAsyncHandler(asynchrono us handler). 2 RSS feeds: To create an RSS When to use HTTP modules: feed for a Web site, we can create a handler that emits Security: Because we can RSS-formatted XML. We can examine incoming requests, an then bind a file name extension HTTP module can perform custom such as .rss to the custom authentication or other security handler. When users send a checks before the requested page, request to your site that ends XML Web service, or handler is in .rss, ASP.NET calls our called. In Internet Information handler to process the request. Services (IIS) 7.0 running in Image server: If we want a Integrated mode, we can extend Web application to serve forms authentication to all content images in a variety of sizes, we types in an application. can write a custom handler to Statistics and logging: Because
  • 38. resize images and then send HTTP modules are called on every them to the user as the request, we can gather request handler’s response. statistics and log information in a centralized module, instead of in individual pages. Custom headers or footers: Because we can modify the outgoing response, we can insert content such as custom header information into every page or XML Web service response.3 How to develop an ASP.NET How to develop a Http Module: handler: All we need is implementing All we need is implementing System.Web.IHttpModule interface. IHttpHandler interface public class MyHttpModule : public class MyHandler IHttpModule :IHttpHandler { { public void Dispose() public bool IsReusable { { get { return false; } } } public void Init(HttpApplication public void context) ProcessRequest(HttpContext { context) //here we have to define handler for { events such as BeginRequest ,PreRequestHandlerExecute } ,EndRequest,AuthorizeRequest } and .... } // you need to define event handlers here }4 Number of HTTP handler Number of HTTP module called: called: Whereas more than one HTTP During the processing of an modules may be called. http request, only one HTTP handler will be called.5 Processing Sequence: Processing Sequence: In the request pipe line In the request pipe line, ,http handler comes after http http Module comes first.
  • 39. Module and it is the end point objects in ASP.NET pipeline. 6 What it does actually? What it does actually? HTTP Handler actually HTTP module can work on request processes the request and before and on the response after produces the response HTTP Handler 7 HTTP Handler implement Http Module implements following Methods and following Methods and Properties: Properties: Process Request: This InIt: This method is used for method is called when implementing events of HTTP processing requests. Modules in HTTPApplication Here you can perform all the object. things related to processing Dispose: This method is used request. perform cleanup before Garbage IsReusable: This property is to Collector destroy everything. determine whether same instance of HTTP Handler can be used to fulfill another request of same type. 8 Summary: Summary: If we need to create a request If we want to modify a certain handler, for example we may request, like we may want to want our own code to handle perform some custom logic behind all .jpg image file requests like: the scenes whenever user, requests pages like then we need to use, we need HttpHandlers for this purpose. to use HttpModules. We can create multiple HttpModules to filter any request.Reference: Difference FAQs-91.Difference between .NET Application Development and Traditional ApplicationDevelopment S.No .NET Application Traditional Application Development Development 1 Using .NET Framework, your Your program will be compiled into program will be compiled into an assembly language code that is an intermediate language very specific to the platform in representation called MSIL which you are running your
  • 40. (Microsoft Intermediate application. Language). 2 MSIL code will not contain any Assembly language code will API calls specific to any contain API calls specific to the platform. current application platform. 3 This MSIL code is then This assembly language code is converted into machine code then converted into machine code. at runtime using CLR (Common Language Runtime). 4 Optimization is done at runtime Optimization is done by the by CLR. compiler itself at compile time. 5 The compiler used in this The compiler is not static. It process is static meaning that performs both compilation as well it checks only for syntax and as optimization. the necessary semantics. 6 Libraries used by your program Libraries used by your program are are linked even before linked only after generating the generating MSIL, but it is machine code. linked in an un-compiled form. This will be compiled by the compiler and it will be used by the CLR while executing the program. 7 The program will not directly Now the program is ready for call APIs of the operating execution by the operating system. system. Instead CLR will act The program will directly call APIs as a mediator. CLR will call of the operating system. APIs of operating system and the result of execution will be returned to program. 8 Automatic memory No automatic memory management and garbage management or garbage collection. collection is done by CLR. 9 .NET Framework Class Library No object oriented principles are provides object oriented incorporated. libraries.2.Difference between CSS and Themes S.No CSS Themes 1 Applies to all HTML Controls Applies to all the server controls 2 Is applied on the Client Side in Is applied on the server rather than the Browser in the browser
  • 41. 3 We can apply multiple style But we cannot apply multiple sheets to a single page themes to a single page. Only one theme we can apply for a single page. 4 The CSS supports cascading But themes does not support cascading 5 The CSS cannot override the But any property values defined in property values defined for a a theme, the theme property control. overrides the property values declaratively set on a control, unless we explicitly apply by using the StyleSheetTheme property. 6 Cannot be Applied through the Can be Applied through configuration files Configuration Files. 7 Can be used directly via a All theme and Skin files should be reference to the css file placed in a special folder location called the “App_Themes” in order for the themes to work and behave normally. 8 Do not require any other Each theme should be associated resource like Skin files with at least one Skin file. 9 In case of CSS you can define But a theme can define multiple only style properties properties of a control not just style properties such as we can specify the graphics property for a control, template layout of a GridView control etc.3.Difference between Postback and Callback S.No Postback Callback 1 A Postback occurs when the A callback is also a special kind of data (the whole page) on the postback, but it is just a quick page is posted from the client round-trip to the server to get a to the the data is small set of data(normally), and posted-back to the server, and thus the page is not refreshed, thus the unlike with the postback. page is refreshed. 2 With Asp.Net, the ViewState is With Asp.Net, the ViewState is not refreshed when a postback is refreshed when a callback is invoked. invoked.
  • 42. 3 A postback occurs when a A callback, generally used with request is sent from the client AJAX, to the server for the same occurs when a request is sent from page as the one the user is the currently viewing. When a client to the server for which the postback occurs, the entire page is not refreshed, only a part of page is refreshed and you can it is updated without any flickering see the typical progression on occurring on the browser. the progress bar at the bottom of the browser.4.Difference between Session.Clear() and Session.Abandon() S.No Session.Clear() Session.Abandon() 1 Session.Clear() just removes Session.Abandon() destroys the all values (content) from the session and the Session_End Object. The session with the event is triggered and in the next same key is still alive.It is just request, Session_Start will be fired. like giving value null to this session. 2 Use Session.Clear(), if we So, if we use Session.Abandon(), want user to remain in the we wil lose that specific session same session and we don not and we will get a new session key. want user to relogin or reset all We could use it for example when his session specific data. the user logs out.Reference: between ASP.Net 2.0 and ASP.Net 3.5Difference between ASP.Net 2.0 and ASP.Net 3.5 SNo Feature ASP.Net 2.0 ASP.Net 3.5 1 New Features ASP.Net 2.0 includes the ASP.Net 3.5 includes the following as new features, following as new features, 1. Master Pages 1. ListView Control 2. Profiles 2. DataPager Control 3. GridView Control 3. Nested Master Pages 4. LinqDataSource Control 2 Multi-targeting ASP.Net 2.0 does not ASP.Net 3.5 supports multi- 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
  • 43. frameworks. 3 AJAX Support There is no in-built support In ASP.Net 3.5, AJAX is 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 Support It does not support LINQ. It Supports Language Integrated Query (LINQ).Reference: Difference FAQs-101.Difference between Invoke() and BeginInvoke() S.No Invoke() BeginInvoke() 1 Delegate.Invoke: Delegate.BeginInvoke: Executes synchronously, on Executes asynchronously, on a the same thread. threadpool thread. 2 Control.Invoke: Control.BeginInvoke: Executes on the UI thread, but Executes on the UI thread, and calling thread waits for calling thread doesn’t wait for completion before continuing. completion.2.Difference between Build and Release S.No Build Release 1 BUILD is still running in testing RELEASE is no longer with testing that is released to testers for and release to Customers/Clients. testing 2 BUILD occur more frequently RELEASE occur less frequently. 3 BUILD is process of converting RELEASE is a process of source code in to executable delivering the project to client code (.exe)
  • 44. 3.Difference between Windows forms and Web forms S.No Windows forms Web forms 1 They do not need a web They need a web browser as well browser or web server to as a web server(on the server execute. machine only). 2 They execute through their They execute through the dll of the respective exe files web application which is then processed by IIS and the .net framework. 3 They run on the same machine They run on a remote server and they are displayed on. are displayed remotely on the clients 4 Their single instance exists Every time they are submitted, their until we close them or dispose new instance is created. them through coding 5 Used for developing games, Used in web site development. inventory management, system utiltites etc. 6 They run under Code Access They use role based security Security.4.Difference between Master Page and Content Page in ASP.NET S.No Master Page Content Page 1 Files with .Master extension. Files with .aspx extension. Introduced in ASP.NET 2.0. Example: Example: Code file: .aspx.cs or .aspx.vb code file: .master.cs or .master.cs extension 2 These have a control known as These do not have any Content the Content Placeholder which Placeholder control which makes it reserves a storage location in somewhat difficult in providing which we can place the proper layout and alignment for contents of a .aspx page. large designs. The common part for the .aspx pages will be outside the Content Placeholder two Content Placeholders are by default, but we can increase or decrease the Content Placeholders as per our needs.
  • 45. 3 MasterPageFile attribute is Register Tag is added when we added in the Page directive of drag and drop a user control onto the .aspx page when a Master the .aspx page. Page is referenced in .aspx page. The .aspx page that uses the Master page i known as Content Page. 4 Can be referenced using Can be attached dynamically using Web.Config file also or Load Control method. PreInit event dynamically by writing code in is not mandatory in their case for PreInit event. dynamic attachment. 5 More suitable for large Suitable for small designs(Ex:1) designs(ex: defining the logout button on every .aspx page. complete layout of .aspx page)Sample Code For Master Page<%@ Master Language="C#" AutoEventWireup="true" CodeFile="MasterPage.master.cs"Inherits="MasterPage" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"""><html xmlns=""><head runat="server"> <title>Untitled Page</title> <asp:ContentPlaceHolder id="head" runat="server"> </asp:ContentPlaceHolder></head><body> <form id="form1" runat="server"> <div> <asp:ContentPlaceHolder id="ContentPlaceHolder1" runat="server"> </asp:ContentPlaceHolder> </div> </form></body></html>Sample Code For Content Page<%@ Page Language="C#" MasterPageFile="~/MasterPage.master"AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" Title="UntitledPage" %><asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server"></asp:Content><asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1"Runat="Server">
  • 46. </asp:Content>Reference: Difference FAQs-111.Difference between XML Serialization and Binary Serialization S.No XML Serialization Binary Serialization (SOAP) 1 No need of Serializable Need Serializable attribute attribute on the class 2 Only public members are All members are serialized unless serialized specified as NonSerializable 3 Class should have default No need of default constructor or public constructor and class public access itself should have public access. 4 Namespace: Namespace: System.XML.Serialization System.Runtime.Serialization.Form atteres.Binary (.Soap) 5 Outputfile is XML Outputfile is Binary or XML for SOAP formatter 6 XMLSerializer need type of No need to specify type of object to object to be serialized or be serialized or deserialized. deserialized 7 Support only Binaryformatter support binary IDesrializationCallback events. Soap formatter supports interface. No support for binary only IDeserializationCallback events. interface2.Difference between CurrentCulture and CurrentUICulture S.No CurrentCulture CurrentUICulture 1 CurrentCulture property affects CurrentUICulture property how the .NET Framework determines which satellite handles regional options assembly is used when loading (dates, currencies, sorting, resources and reflects the UI formatting, etc.) for the current language for the current user.i.e., it user.i.e., it provides cultural provides the cultural context for context for formatting and localization, i.e. translation of parsing (for ex. to parse dates resources. or numbers) A date is often written like 10/30/2000 by Americans, but 30/10/2000 by Irish people, and 30.10.2000
  • 47. by Germans etc. 2 CurrentCulture does not CurrentUICulture supports neutral support neutral cultures (i.e. cultures (i.e. "en", "fr" ...) "en", "fr" ...). It is always a specific culture (i.e. "en-GB", "de-AT", "pt-BR")Example for CurrentCulture - To parse the date in System.Threading;using System.Globalization;DateTime dt;// this is a British English date formatstring dateStr = "31/10/2001";// parse it with British English cultureThread.CurrentThread.CurrentCulture = new CultureInfo("en-GB");bool parseOk = DateTime.TryParse(dateStr, out dt);// parseOk: true -- dt: {31/10/2001 00:00:00}Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");parseOk = DateTime.TryParse(dateStr, out dt);// parseOk: false-- dt: {1/1/0001 12:00:00 AM}...Example for CurrentUICulture - To get the resources in System.Threading;using System.Globalization;string culture = "en";Thread.CurrentThread.CurrentUICulture = new CultureInfo(culture);string hello = (string)HttpContext.GetGlobalResourceObject("myClassKey","myResourceKey");// and now Frenchstring culture = "fr";Thread.CurrentThread.CurrentUICulture = new CultureInfo(culture);string hello = (string)HttpContext.GetGlobalResourceObject("myClassKey","myResourceKey");...3.Difference between Forms Authentication and Windows Authentication S.No Forms Authentication Windows Authentication 1 Forms authentication enables Windows authentication enables us us to identify users with a to identify users without creating a custom database, such as an custom page. Credentials are ASP.NET membership stored in the Web servers local database. Alternatively, we can user database or an Active implement our own custom Directory domain. Once identified, database. Once authenticated, we can use the users credentials to
  • 48. we can reference the roles the gain access to resources that are user is in to restrict access to protected by Windows portions of our Web site. authorization. 2 Form authentication is Windows authentication is best preferable for the applications suited for the application which is which have diversified users meant for a corporate users from several places. 3 In case of form authentication, User lists for windows lists are there in credential authentication are found in element of web.config file. authorization element 4 There is no such classification There are four different kinds of available in Forms Windows authentication options authentication. available that can be configured in IIS 1)Integrated Windows authentication 2) Basic and basic with SSL authentication 3) Digest authentication 4) Client Certificate authenticationReference: Between CTS and CLSDifference between CTS and CLS S.No CTS CLS 1 Abbreviation: Abbreviation: CTS stands for Common Type CLS stands for Common Language System Specification 2 It describes how types are Meaning: declared, used and managed in the runtime and facilitates It is a specification that defines the cross-language integration, rules to support language type safety, and high integration in such a way that performance code execution. programs written in any language, yet can interoperate with one The types defined by the CTS another, taking full advantage of are broadly classified into inheritance, polymorphism, value types and reference exceptions, and other features. types. Value types are those These rules and the specification which themselves contain are documented in the ECMA data/methods/resources proposed standard document. represented by the type - like
  • 49. an integer variable is a value type. Reference types are those which refer to value types and a pointer or a reference is an example of such a type. All types derive from System.Object base type. 3 Power of CTS: Power of CLS: CTS is a superset of the CLS is a subset of the CTS which CLS,i.e.,all .NET languages all .NET languages are expected to will not support all the types in support. the CTS. 4 Example: Example: “Integer” datatype in VB and A class written in C# can inherit “int” datatype in C++ are not from a class written in VB. compatible, so the interfacing between them is very So we can say that using this complicated. In order that two specification (CLSCompliant different languages can attribute) in our programs (written communicate, “Integer” in VB6 in any language), the type is forced and “int” in C++ will convert to to conform to the rules of CLS and System.int32 which is datatype programs can interoperate with one of CTS. another, taking full advantage of polymorphism, inheritance and (or) other features. In c#, we will declare int i; In vb, we will declare dim i as integer Basically Microsoft will convert all this data types to the generic data types. So, if we write code in different languages that will convert into language independent code. This is called Common type system(CTS).Reference:
  • 50. Difference between OLEDB Provider and SqlClient S.No OLEDB Provider SqlClient 1 OLEDB Provider is slower than The SqlClient data provider is SqlClient data provider faster than the Oracle provider, and even more faster than accessing database through the OLEDB layer. Reason for being faster is, it access the native library which generally gives us a better performance and it has also got a lot of support from SQL Server team online.Reference: between Two Tier and Three tier Architecture S.No Two-tier Architecture Three -tier Architecture 1 Client -Server Architecture Web -based application 2 Client will hit request directly to Here in between client and server server and client will get middle ware will be there, if client response directly from server hits a request it will go to the middle ware and middle ware will send to server and vice versa. 3 2-tier means 1) Design layer 2) 3-tier means 1) Design layer 2) Data layer Business layer or Logic layer 3) Data layerReference: between Pre-Render and Render events in ASP.NET page execution S.No Pre-Render Render 1 This event is used for This event is used to put the HTML modifying server controls just output to the response stream before sending them to client.Reference:
  • 51. Difference between Response.TransmitFile and Response.WriteFile S.No Response.TransmitFile Response.WriteFile 1 It sends the file to the client It loads the file being download to without loading it to the the server’s memory before Application memory on the sending it to the client. If the file server. It is the ideal for if the size is large, the ASPNET worker file size being download is process might be get restarted. large.Reference: between Layer and TierDifference between Layer and Tier S.No Layer Tier 1 It refers to the separation of It refers to the physical location of the logic (i.e the code and the Layer files. design) that is developed for an application in different files.Example:In an ASP.NET web site, we create GUI web forms, business logic , data accesslogic, database all in one computer. In this case, we have 4 layers and 1 Tier.if the GUI Web Forms,business logic, data access logic and database are all indifferent computers, we have 4 layers and 4 Tiers.Reference: between Response.Write and Response.Output.WriteDifference between Response.Write and Response.Output.Write S.No Response.Write Response.Output.Write 1 Response.Write does not allow Response.Output.Write allows us us to write a more formatted to write a more formatted output. output. 2 As per ASP.NET 3.5, Response.Output.Write has 17 Response.Write has 4 overloads. overloadsExample-1:To write integer,double, boolean values using Response.Write, we are provided with oneoverloaded version:-> Response.Write(object obj);
  • 52. To do the same thing using Response.Output.Write, we are provided with separateoverloaded versions :ex:1) Response.Output.Write(int s);2) Response.Output.Write(double s);3) Response.Output.Write(bool b);Example-2:Response.Output.Write("hello {0}", ""); //It is OkBut, Response.Write("hello {0}",""); //It is wrongReference: between Response.Write() and Response.WriteFile()Difference between Response.Write() and Response.WriteFile() S.No Response.Write() Response.WriteFile() 1 It writes information to the Http It writes the specified file directly to Response and can be used to an HTTP response output stream. display strings in the output. 2 Example: Example: Response.Write("welcome"); Response.WriteFile("demo.txt");Response: Difference FAQs-121.Difference between .NET 1.1 and 2.0 S.No .NET 1.1 .NET 2.0 1 Support for 64 bit Support for 64 bit application: application: Yes No 2 Generics: Generics: No Yes 3 SQL cache dependency: SQL cache dependency: No Yes 4 Master pages: Master pages: No Yes 5 Membership and roles: Membership and roles: No Yes
  • 53. 2.Difference between .NET 2.0 and 3.0 S.No .NET 2.0 .NET 3.0 1 WCF: WCF: No Yes 2 WPF: WPF: No Yes 3 WWF: WWF: No Yes 4 WCS ( card space) : WCS ( card space) : No Yes3.Difference between .NET 3.0 and 3.5 S.No .NET 3.0 .NET 3.5 1 LINQ : LINQ : No Yes 2 Ajax inbuilt: Ajax inbuilt: No Yes 3 ADO Entity framework: ADO Entity framework: No Yes 4 ADO data services: ADO data services: No Yes 5 Multi targeting: Multi targeting: No Yes4.Difference between .NET 3.5 and 4.0 S.No .NET 3.5 .NET 4.0 1 MEF : MEF : No Yes 2 Parallel computing: Parallel computing: No Yes 3 DLR dynamic: DLR dynamic: No Yes 4 Code contract : Code contract : No Yes 5 Language runtime: Language runtime: No Yes 6 Lazy initialization: Lazy initialization: No Yes
  • 54. Reference: between lock and Monitor.Enter()Difference between lock and Monitor.Enter() S.No lock Monitor.Enter() 1 lock keyword basically Monitor is used to provide thread provides a shortcut to Enter synchronization.It means till the method of Monitor class. Thread in which the method is being used finishes its task, no other thread can access the object.Example:lock (object){}It is compiled intoMonitor.Enter(object);try{//code}finally{Monitor.Exit(object);}Reference: between Encoding and EncryptionDifference between Encoding and Encryption S.No Encoding Encryption 1 Purpose: Purpose: The purpose of encoding is to The purpose of encryption is to transform data so that it can be transform data in order to keep it properly (and safely) secret from others. consumed by a different type of system. 2 For maintaining data usability Used for: i.e.,to ensure that it is able to For maintaining data confidentiality
  • 55. be properly consumed. i.e., to ensure the data cannot be consumed by anyone other than the intended recipient(s). 3 Data Retrieval Mechanism: Data Retrieval Mechanism: No key and can be easily Original data can be obtained if we reversed provided we know know the key and encryption what algorithm was used in algorithm used. encoding. 4 Algorithms Used: Algorithms Used: ASCII, Unicode, URL AES, Blowfish, RSA Encoding, Base64 5 Example: Example: Binary data being sent over Sending someone a secret letter email, or viewing special that only they should be able to characters on a web page. read, or securely sending a password over the Internet.Reference: vs DataSet vs DataAdapterDifference between DataReader,DataSet and DataAdapter S.No DataReader DataSet / DataAdapter 1 Database Connecting Mode: Database Connecting Mode: Connected mode Disconnected mode 2 Data Navigation: Data Navigation: Unidirectional i.e., Forward Bidirectional i.e., data can navigate Only back and forth 3 Read / Write: Read / Write: Only Read operation can be Both Read and Write operations carried out. are possible 4 Data Handling: Data Handling: Handles Database table Handles text file, XML file and Database table 5 Storage Capacity : Storage Capacity : No storage Temporary Storage Capacity i.e., in-memory cache of data 6 Accessibility : Accessibility : Can access one table at a time Can access multiple table at a time
  • 56. 7 Speed: Speed: Much faster than DataSet Less faster than data readerReference: vs DataSetDifference between DataTable and DataSet S.No DataTable DataSet 1 Meaning: Meaning: A DataTable is an in-memory A DataSet is an in-memory representation of a single representation of a database-like database table which has structure which has collection of collection of rows and DataTables. columns. 2 Number of rows retrieved at Number of rows retrieved at a a time: time: DataTable fetches only one DataSet can fetch multiple TableRow at a time TableRows at a time 3 Provision of DataRelation Provision of DataRelation Objects: Objects: As DataTable is a single In DataSet, DataTable objects can database table, so there is no be related to each other with DataRelation object in it. DataRelation objects. 4 Enforcing Data Integrity: Enforcing Data Integrity: In DataTable, there is no In DataSet, data integrity is UniqueConstraint and enforced by using the ForeignKeyConstraint objects UniqueConstraint and available. ForeignKeyConstraint objects. 5 DataSource can be DataSource can be Serialized or Serialized or Not: Not: In DataTable, DataSource DataSet is serialized cannot be serialized. DataSource .That is why web services can always returns DataSet as the result but not the DataTables.Example for DataTable:sqldataadapter da = new SqlDataAdater("select * from Employee", con);DataTable dt = new DataTable();
  • 57. da.Fill(dt);datagridview1.DataSource = dt;Example for DataTable:sqldataadapter da= new SqlDataAdater("select * from Employee", con);DataSet ds = new DataSet();da.Fill(ds);datagridview1.DataSource = ds.table[0];Reference: between div and tableDifference between div and table S.No Div Table 1 Purpose: Purpose: To display block of HTML and To display Text and in fewer cases data images as well. 2 Layout / Type: Layout / Type: DIV is floating type and can Table is Fixed type and consists of divide our webpage into table rows(tr), table data(td),table multiple divisions..So,Divs are header(th). .So,tables are strict for more flexible--as they do not those layouts which are more strict to tabular layouts. tabular. 3 Search Engine Friendly: Search Engine Friendly: Div is better for SEO Table is not Search engine friendly 4 Loading Time: Loading Time: The loading time of DIV based The loading time of table based website is faster than Table website is not faster than DIV based website. based website. 5 Website Alignment: Website Alignment: In DIV,we can control the Table does not make use of CSS, website alignment by CSS hence website alignment is which is comparatively easier comparatively difficult than table 6 Website Changes: Website Changes: In Div, designers can make a In table, designers cannot make a single change to the CSS and single change as like DIV it will modify the entire website. 7 Does CSS Knowledge Does CSS Knowledge required ? required ?For Div based Table based website does not layout, we should have require CSS Knowledge in oder to knowledge about CSS. control the website errors Otherwise, we cannot control
  • 58. the Div based website errors.Reference: vs RegisterStartupScriptDifference between Page.RegisterClientScriptBlock and Page.RegisterStartupScript S.No Page.RegisterClientScriptBlock Page.RegisterStartupScript 1 RegisterClientScriptBlock places RegisterStartupScript places the the script at the top of the page script at bottom of page right right after the starting form tag . before the ending form tag. 2 The code cannot access any of The code can access any of the the forms elements because, at forms elements because, at that that time, the elements have not time, the elements have been been instantiated yet. instantiated. 3 RegisterClientScriptBlock is RegisterStartupScript is meant for meant for functions that should be commands that should execute on "available" to the page. For this page load (at the client), so that they are rendered at the start of page needs to be available for the the HTML file. In this case the script. This script is rendered at the page content will be blocked. end of the HTML file. In this case the content of the page will be diplayed first and then script will run.Example for RegisterStartupScript:if (!Page.IsStartupScriptRegistered("CH"))Page.RegisterStartupScript("CH", "script goes here");Example for RegisterClientScriptBlock:if (!Page.IsClientScriptBlockRegistered("CH"))Page.RegisterClientScriptBlock("CH", "script goes here");Note:The choice of which method to use really depends on the "order" in which we want ourscript to be run by the browser when rendering the page.Take an example of a javascript function that populates a Textbox using a javascriptfunction when a page is loaded. If we use the RegisterClientScriptBlock method, the
  • 59. javascript function will give an error. This is because our script is placed at the top of thepage when it was loaded (when the textbox was not even created). So how can it find thetextbox and populate the values. So in this case RegisterStartupscript should be used.Reference: vs ClientIDDifference between UniqueID and ClientID S.No UniqueID ClientID 1 Meaning: Meaning: UniqueID is also a uniquely ClientID is a unique ID string that is identifiable ID for a control but rendered to the client to identify the only used by ASP.Net page control in the output HTML. framework to identify the control. i.e., ClientID = HTMLs id attribute i.e., UniqueID = HTMLs name attribute 2 Delimiter used: Delimiter used: It uses $ to include parent It uses _ to include parent controls controls (container) ID to make (container) ID to make it unique. it unique. For example, For example, ct100_ContentPlaceHolder1_txtLo ct100$ContentPlaceHolder1$tx gin. tLogin 3 UniqueID Generation: ClientID Generation: Similar to ClientID, UniqueID is The client id for control will be also generated by appending generated by appending the parent the parent containers(parent containers(parent control) ID with control) ID with the original the original control id with "_" as control id but with $ delimiter delimeter. In our example, ContentPlaceHolder1 is the ContentPlaceHolder ID of the master page which is the parent container for txtLogin. 4 How to get UniqueID of a How to get CientID of a control ? control ? For example, use txtLogin.ClientID For example, use for txtLogin.UniqueID for ct100_ContentPlaceHolder1_txtLo ct100$ContentPlaceHolder1$tx gin. tLogin
  • 60. 5 Where to use ? Where to use ? The unique id is used by the The client id can be used to identify ASP.NET framework to identify the control in client side scripting the control when the page is like javascript. posted back to the server. i.e., ClientID is used for client-side i.e., UniqueID is used for server-sideNote:ClientID = HTMLs id attribute and so when doing getElementById, we should always givethe ClientId.Instead, if we give UniqueID i.e., getElementById(Elements name), FireFox will fail.Reference: vs ContentPlaceHolderDifference between PlaceHolder and ContentPlaceHolder S.No PlaceHolder ContentPlaceHolder 1 A PlaceHolder control is used A ContentPlaceHolder is used to as a container for any controls hold content from Content Pages we wish to add and can be and can only be used on a Master used on any page. Page.Reference: vs PlaceHolderDifference between Panel and PlaceHolder S.No Panel PlaceHolder 1 What tag rendered in What tag rendered in output ? output ? PlaceHolder will not render any Panel will render Div tags in tags the brower 2 Does it provide Styling Does it provide Styling Attributes ? Attributes ? Panel have the styling Placeholder does not have any capabilites, so we can set the style attributes associated. We can cssclass or style properties not set cssclass or forecolor etc... such as background-color, forecolor etc..
  • 61. 3 Automatic Width Automatic Width Adjustment: Adjustment: Panel cannot PlaceHolder can adjust width adjust width automatically if automatically if controls are added controls are added in it. in it. 4 Memory Size: Panel is heavy Memory Size:PlaceHolder is light in memory size as compare to in memory size as compare to PlaceHolder Panel. 5 When to use ? If we want to When to use ? If we just want a use it to separate controls container, without all the Display visually, then we have to use properties, then we have to use Panel control. PlaceHolder control.Reference: between URL and URIDifference between a URL and a URI S.No URL URI 1 URL stands for Uniform URI stands for Uniform Resource Resource Locator Identifier 2 URL is a subset of URI that A URI is a superset of URL that specifies where an identified identifies a resource either by resource is available and the location (URL), or a name(URN), or mechanism for retrieving both (URL and URN). it.Meachanism actually means one of the potocol schemes (e.g., http, ftp, file, mailto) provided by URI.Examples for URL:• http:/, http is the protocol, is the domain name, users is the folder name,login.aspx is the filename• http is the protocol, is the domain name, articles is the folder nameand default.aspx is the file nameExamples for URI:•• /some/page.html
  • 62. Summary: 1. A URI is either a URL or a URN. 2. Every URL is a URI. 3. Every URN is a URI. 4. A URN is never a URL. 5. A URL is never a URN. 6. Every URI is not a URL 7. If the URL describes both the location and name of a resource, the term to use is URI. Since this is generally the case most of us encounter everyday, URI is the correct term.Here,URI --> A Uniform Resource Identifier(URI) is used to identify something on the WorldWide Web.URN --> Uniform Resource Name (URN), a type of URI, basically states what somethingis, but do not have information on how to access it.URL --> Uniform Resource Locator (URL), a type of URI, contains the location ofsomething and tell the client program (usually a browser) how to access it.Simply put, a URN is the name of something and the URL is the name and address.Reference: Session vs ASP.NET SessionDifference between ASP Session and ASP.NET Session S.No ASP Session ASP.NET Session 1 Session type support: Session type support: As ASP only supports InProc ASP.NET supports both InProc and Session, so it cannot span OutProc (StateServer and across multiple servers. SQLServer) Sessions.Hence, it can span across multiple servers. 2 Process dependency: Process dependency: In ASP, the session is Process In Asp.Net, the session is Process dependent i.e., ASP session independent i.e., ASP.NET session state is dependent on IIS can be independent of the hosting process very heavily. So if IIS environment thus ASP.NET session restarts can maintained even if IIS reboots. ASP session variables are also recycled. 3 Cookie dependency: Cookie dependency: In ASP, the session is Cookie As ASP.NET supports Cookieless dependent i.e., ASP session session, so the session in ASP.NET
  • 63. only functions when browser is Cookie independent. supports cookies.Reference: vs AuthorizationDifference between Authentication and Authorization in ASP.NET S.No Authentication Authorization 1 Meaning: Meaning: Authentication is the process Authorization is process of of verifying the identity of a checking whether the user has user. access rights to the system. 2 Example: Example: Suppose, we have 2 types of Once we know the user is valid, users ( normal and admins ) to then we determine to which pages a website. When the user tries the user has access to. Normal to access the website, we ask users should not be able to access them to log in. This is admin pages. This is authorization authentication part. part. 3 Types of Authentication: Types of Authorization: Windows Authentication ACL authorization (also known as Forms Authentication file authorization) Passport Authentication URL authorization 4 Whent it takes place ? Whent it takes place ? Authentication always Authorization takes place after precedes to Authentication Authorization,event if our application lets anonymous users connect and use the application,it still authenticates them as anonymous.Reference: vs ViewStateModeDifference between EnableViewState and ViewStateMode properties S.No EnableViewState ViewStateMode 1 EnableViewState exists from a Property Introduction: long time ViewStateMode property is
  • 64. introduced in ASP.NET 4 2 Available Values: Available Values: EnableViewState property only ViewStateMode property can have accepts true or false values a value of - Enabled, Disabled and inherit. 3 Default Value: Default Value: True Inherit 4 What EnableViewState What ViewStateMode does ? does ? To enable ViewState at Control To enable ViewState at Page level level 5 How to use ? How to use ? Using EnableViewState Steps involved to disable view property we can have one of state for a page and to enable it for these 2 options. a specific control on the page, i. We can turn off view state i. Set the EnableViewState altogether by setting its value property of the page and the to false in web.config file,or control to true, ii.Enable viewstate for the ii. Set the ViewStateMode property entire page and then turn it off of the page to Disabled, and on a control-by-control basis. iii. Set the ViewStateMode property of the control to Enabled.Summary:1. If EnableViewState is to True, only then the ViewStateMode settings are applied.2. In other words, if EnableViewState is set to False, ViewStateMode setting is notrespected3. Therefore, we have to use ViewStateMode property in conjunction withEnableViewState.Reference: Layout vs Form LayoutDifference between Grid Layout and Form Layout S.No Grid Layout Flow Layout 1 In Grid layout, controls are In Flow layout, controls are displayed in the grid format. arranged in the order in which they are created. 2 Grid layout can be used for Flow layout can be used for Microsoft Windows–style document-style applications, in
  • 65. applications, in which controls which text and controls are are not mixed with large intermingled. amounts of text. 3 When we create controls with When we create controls with GridLayout, Visual Studio adds FlowLayout, Visual Studio omits style attributes to each control the style attribute. that set the position of the control 4 In Grid layout, if we look in to In Flow layout ,we can see more of the HTML code created by using HTML table to position absolute positioning we can elements which is compatible with notice only lots of DIV wide range of browsers. tags.So,pages using grid layout will not always display correctly in non-Microsoft browsers.Reference: between Synchronous and Asynchronous HTTP HandlersDifference between Synchronous and Asynchronous HTTP Handlers S.No Synchronous HTTP Handlers Asynchronous HTTP Handlers 1 Meaning: Meaning: A synchronous handler does An asynchronous handler runs a not return until it finishes process independently of sending a processing the HTTP request response to the user. for which it is called. 2 Which Interface to Which Interface to implement: implement? IHttpAsyncHandler interface has to IHttpHandler interface has to be implemented in order to create be implemented in oder to an asynchronous handler. create a synchronous handler. 3 Whent to use? When to use? Synchronous handlers are Asynchronous handlers are useful useful when we must start an when we must start an application application process that might process that might be lengthy and not be lengthy and the user the user does not have to wait until has to wait until it finishes it finishes before receiving a before receiving a response response from the server. from the server.Reference:
  • 66. Difference between Asynchronous and Synchronous PostbackDifference between Asynchronous and Synchronous Postback S.No Asynchronous Postback Synchronous Postback 1 Asynchronous postback Synchronous postback renders the renders only the required part entire page for any postback. of the page 2 Asynchronous postback Synchronous postback executes all executes only one postback at the actions at once. a time, that is, if we have two buttons doing asynchronous postback, the actions will be performed one by one. 3 Asynchronous postback only Synchronous postback modifies modifies the update panel that the entire page. raises the postback.Reference: vs Cross-page PostingDifference Between Server.Transfer and Cross-page Posting S.No Server.Transfer Cross-page Posting 1 URL changes or not: URL changes or not: In Server.Transfer, the URL In cross page posting, the form is does not change . submitted to a different page, thereby it changes the url. 2 Is it Client-based / Server- Is it Client-based / Server-based based operation ? operation ? Server.Transfer method is a Cross-page postback is a client- server-based operation. based transfer. 3 IsCrossPagePostBack IsCrossPagePostBack property property available or not: available or not: There is no such property It is easy to determine whether the available in Server.Transfer page was invoked from a cross- method. page posting or a Server.Transfer operation, by checking the property named IsCrossPagePostBack of the Page class.Reference:
  • 67. RDF vs OData vs GDataDifference between RDF, OData and GDataRDF OData GDataAbbreviation: Abbreviation: Abbreviation:RDF stands for Resource OData stands for Open GData stands for GoogleDescription Framework Data Protocol Data ProtocolMeaning: Meaning: Meaning:RDF is a framework The Open Data Protocol Gdata provides a simplewhich follows W3C (OData) is an open web protocol for reading andtechnology for protocol for querying writing data on therepresenting information and updating data. The Internet, designed byin the Web. protocol allows for a Google. GData combines consumer to query a common XML-basedThe design of RDF is datasource over the syndication formats (Atomintended to meet the HTTP protocol and get and RSS) with a feed-following goals: the result back in publishing system based formats like Atom, JSON on the Atom Publishingi.having a simple data or plain XML, including Protocol, plus somemodel pagination, ordering or extensions for handlingii.having formal filtering of the data. queries. It relies on XML orsemantics and provable JSON as a data format.inference Many of the buildingiii.using an extensible blocks that make up Google provides GDataURI-based vocabulary OData are standardized client libraries for Java,iv.using an XML-based via Atom and AtomPub. JavaScript, .NET, PHP,syntax The OData specification Python, and Objective-C.v.supporting use of XML is available under theschema datatypes Microsoft Openvi.allowing anyone to Specification Promisemake statements about (OSP). Microsoft hasany resource released an OData software developmentIt is used in Mozilla to kit (SDK) consisting ofintegrate and aggregate libraries for .NET, PHP,Internet resources. Java, JavaScript, webOS, and the iPhone.Mozilla RDF wasoriginally used to supportthe Aurora/Sidebar userinterface andSmartBrowsing metadataservices. Its main use inMozilla now is as acommon data model andAPI for use in XUL-basedapplications
  • 68. Logical Model: Logical Model: Logical Model:Graph/EAV.Technology Graph/EAV. AtomPub Unclear/Mixed – whatevergrounding (esp OWL ) in and EDM grounding in google logical Model isDescription Logic.[12, entity relationship behind services, but13]. “Open World modelling [11]. “Closed transcoded and exposedAssumption” [27] World Assumption”[28] as AtomPub/JSON. Data view (?) but with relations and graphs not “OpenTypes” and controllable by API – eg “Dynamic Properties”[29] cannot define a link between data elements that doesnt already exist. GData is primarily a client API.Physical model: Physical model: Physical model:Not mandated, but Not mandated, but Google applications andprobably backed by a probably backed by services publishing data intriple store and serialised existing RDBMS AtomPub/JSON format,over Http to RDF/XML, persistence [4 - with Google DataJson,TTL, N3 or other "Abstract Data Model"], Namespace[58] element.format. RDBMS backing or more precisely a non-or proxying possible. triple store. (I have no evidence to support this, but the gist of docs and examples suggests it as a typical use case) and serialised over Http with Atom/JSON according to Entity Data Model (EDM) [6] and Conceptual Schema Definition Language (CSDL)[11]Intent: Intent: Intent:Data syndication and Data publishing and Google cloud dataweb level linking : "The syndication : "There is a publishing [55] : "Thegoal of the W3C SWEO vast amount of data Google Data ProtocolLinking Open Data available today and data provides a secure meanscommunity project is to is now being collected for external developers toextend the Web with a and stored at a rate write new applications thatdata commons by never seen before. let end users access andpublishing various open Much, if not most, of this update the data stored bydata sets as RDF on the data however is locked many GoogleWeb and by setting RDF into specific applications products.Externallinks between data items or formats and difficult to developers can use thefrom different data access or to integrate Google Data Protocolsources" into new uses" directly, or they can use any of the supported programming languages provided by the client libraries"
  • 69. Protocol,operations: Protocol,operations: Protocol,operations:http, content negotiation, http, content negotiation, http,REST (PUT/POST?RDF, REST-GET. Sparql AtomPub/JSON, REST- GET/PATCH/DELETE)[56]1.1 for update GET/PUT/POST/DELET E [9]Openness/Extensibility: Openness/Extensibility Openness/Extensibility:Any and all,create your : Google applications andown Any and all (with a services only.ontology/namespace/URI “legacy” Microsoft base),s with while reuse MicrosoftRDFS/OWL/SKOS/…, classes andlarge opensource tooling types,namespaces& community, multiple (EDM)[6] withserialisation Atom/JSONRDF/XML,JSON, N3, serialisation. LargeTTL,… microsoft tooling and integration with others following.[7,8]URI URI URIminting,dereferencing : minting,dereferencing : minting,dereferencing :Create your own URIs Unclear whether Atom namespace. <linkand namespaces concept URI and rel=”self” …/> denotes URIfollowing guidelines Location URI are of item. ETags also used(“slash vs hash”) [15,16] distinguished in for versioned updates.Subject, predicate and specification -values can Google Data namespaceobject URIs must be certainly be Location for content “Kinds”.[59], nodereferencible, content URIs, and IDs can be dereferencing.negotiation expected. URIs, but attributeSeparation of concept properties aren’tURI and location URI dereferencible tocentral. Location URIs.Well specified URI conventions [21]Linking, matching, Linking,matching, Linking,matching,equivalence: equivalence: equivalence:External entities can Navigation properties URIS Not dereferencable,inherently be directly link entity elements linkage outside of googlelinked by reference, and within a single OData not possible.equivalence is possible materialisation -externalwith owl:sameAs, linkage not possible.owl:seeAlso (and other Dereferencable attributeequivalence assertions) properties not possible but proposed[10].Namespace handling, Namespace handling, Namespace handling,vocabularies: vocabularies: vocabularies:Declare namespaces as Namespaces supported AtomPub and Google Datarequired when importing in EDM but unclear if namespace only.public or “well known” possible to create and
  • 70. ontologies/vocabularies, use namespace,or if itcreating SPARQL can be backed with aqueries, short hand custom class/propertyURIs,create new as definition (ontology).required for your own $metadata seems tocustom classes, separate logically andinstances. physically type and service metadata from instance data – ie oData doesn’t “eat its own dog food”.Content negotiation: Content negotiation: Content negotiation:Client and server Client specifies or server Use alt query paramnegotiate content to best fails, or default to Atom (accept-header not used)determination.[17,18] representation.[19]. Only [57] XML serialisation for service metadata.[40]. New mime-types introduced.Query capability : Query capability : Query capability :Dereferencibility central Proposed dereferencible Query byprinciple to linked data, URIs with special author,category,fields.whether in document, $metadata path elementlocal endpoint or allow type metadata tofederated. SPARQL [14] be retrieved [10].query language allows Running a structuredsuitably equipped query against an ODataendpoints to service service with somethingstructured query requests like SPARQL isn’tand return serialised possible.RDF, json, csv, html, …Security, privacy, Security, privacy, Security, privacy,provenance: provenance: provenance:No additional No additional Http wire protocols, but inspecifications above that specifications above that addition authenticationsupplied in web/http mandated in (OpenID) andarchitecture. CORS http/atom/json.[23, 31] authorization arebecoming popular as CORS use possible for required(OAuth).access filter method for cross site syndication. “ClientLogin” and AuthSubcross-site syndication Dallas/Azure are deprecated. [60]. Nocapability at client level. Datamarket for “trusted provenance handling.Server side access commercial andcontrol. Standards for premium public domainProvenance and privacy data”.[26]planned and underdevelopment[24]. W3CXG provenancegroup[25]
  • 71. Reference: vs Non-static MembersDifference between Static Members and Non-static Members in Asp.Net S.No Static Members Non-static Members 1 How they are binded ? How they are binded ? These members are binded to These members are binded to the the class definition itself. object defined for the class. 2 When they are loaded ? When they are loaded ? These members will be loaded These members will be loaded into into memory when ever the memory every time a new object is class has been loaded . defined for the class. 3 Where they are referenced ? Where they are referenced ? These members are These members are referenced referenced with the class name with object definition only. only.Reference: vs FlexGrid vs DataTablesDifference between JQGrid,FlexGrid and DataTables(OR)Compare jQuery grid and table plugins JQGrid FlexGrid DataTables Data format : Data format : Data format : JSON, XML JSON, XML or existing Existing HTML data Sorting: Sorting: Sorting: Server-side (SQL Server-side Client-side. Multicolumn ORDER BY). sorting supported. Multicolumn sorting supported. Pagination: Pagination: Pagination: JSON/XML (server-side) Server-side Client-side User/Auto resizing of User/Auto resizing of User/Auto resizing of
  • 72. columns: columns: columns: Both Supported. Users User only. Users can Auto only can choose to hide choose to hide columns. columns. Internationalization: Internationalization: Internationalization: Supported. Not supported. Supported. JS file sizes (excluding JS file sizes (excluding JS file sizes (excluding jQuery) : jQuery) : jQuery) : 300kB (some of which 56kB 143kB can be discarded based on application) Advantages: Advantages: Advantages: Extensive API and Versatile, can wrap Uses existing HTML documentation around HTML or used structure to wrap around JSON/XML to populate grid Disadvantages: Disadvantages: Disadvantages: Requires processing on Relatively little Requires all the relevant data server-side documentation, most of to be marked up as HTML the functionality only works with JSON/XML optionSummary: As with all applications, each variant is suitable for a different solution. The factthat there are over 50 table plugins for jQuery is testament to how people see the need fordeveloping new alternatives. jQuery is a powerful tool, but its use must also be weighedtogether with how much data you use - while server-side sorting and searching is usuallyvery powerful and fast, its still a relatively expensive operation. Both jqGrid andDataTables have a lot of useful features (like grids withing grids, user-selectable rows andinline editing) with solid API documentation to support it. Flexgrid is good if you wantsomething to work without too much hassles.Reference: vs IEnumerableDifference between Var and IEnumerable S.No Var IEnumerable 1 When to use ? When to use ? Use Var type when we want to Use IEnumerable when we already make a "custom" type on the know the type of query result. fly.
  • 73. 2 Good for: Good for: Var is also good for remote IEnumerable is good for in-memory collection. collection.IEnumerable ExampleMyDataContext dc = new MyDataContext ();IEnumerable<Employee> list = dc.Employees.Where(p => p.Name.StartsWith("S"));list = list.Take<Employee>(10);Generated SQL statements of above query will be : SELECT[t0].[EmpID], [t0].[EmpName], [t0].[Salary] FROM [Employee] AS [t0]WHERE [t0].[EmpName] LIKE @p0Notice that in this query "top 10" is missing since IEnumerable filters records on client sideVar ExampleMyDataContext dc = new MyDataContext ();var list = dc.Employees.Where(p => p.Name.StartsWith("S"));list = list.Take<Employee>(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 @p0Notice that in this query "top 10" is exist since var is a IQueryable type that executes query in SQLserver with all filters.IEnumerable TypeIEnumerable is a forward only collection and is useful when we already know the type of queryresult. In below query the result will be a list of employee that can be mapped (type cast) toemployee table.IEnumerable<tblEmployee> lst =(from e in tblEmployeewhere e.City=="Delhi"select e);Reference: Rewriting vs ASP.NET RoutingDifferences between IIS URL Rewriting and ASP.NET Routing S.No URL Rewriting ASP.NET Routing 1 URL rewriting consists of Meaning: certain regular expression ASP.NET routing extracts specific patterns that match an values from the URL, based on a
  • 74. incoming request URL and pattern. These extracted values forward the request to a can be used to determine the mapped URL instead. For handler that will handle the example, one might create a request. We can also use these URL rewriting rule that patterns to generate a URL that will forwards an incoming request map to a specific handler. for cts/Beverages to another URL of cts/Show.aspx?id=52 Does it alter the request / Does it alter the request / incoming URL ? incoming URL ? URL rewriting alters the ASP.NET routing is different. It request URL and forwards it to does not alter the incoming URL. another URL.3 When URL Rewriting is right When ASP.NET Routing is right choice ? choice ? IIS URL rewriting is a generic ASP.NET routing is a solution that URL manipulation mechanism is optimized for ASP.NET, thus it that addresses a multitude of may be preferable for Web scenarios. In particular, it can developers who design their be used by Web developers as ASP.NET applications from the well as Web server/site ground up and want to have a administrators to enable clean clean URL structure. URLs for existing Web applications without modifying the application code.4 For what type of For what type of application(s) application(s) URL Rewriting ASP.NET Routing can be used ? can be used ? ASP.NET routing can be used only The IIS URL Rewrite module with .NET Framework-based Web can be used with any type of applications. Web application, which includes ASP.NET, PHP, ASP, and static files.5 Does it extensible and Does it extensible and customizable ? customizable ? The URL Rewrite module is not ASP.NET routing is fully extensible extensible in its current and customizable. version.6 What tasks it can perform ? What tasks it can perform ? In addition to rewriting, the ASP.NET routing does not perform URL Rewrite module can these tasks. perform HTTP redirection, issue custom status codes,
  • 75. and abort requests. 7 Application Area: Application Area: The IIS URL Rewrite module By default, ASP.NET routing works can make rewriting decisions only with URL paths and with the based on domain names, HTTP-Method header. HTTP headers, and server variables. 8 IIS pipeline mode or IIS pipeline mode or Integrated Integrated pipeline mode ? pipeline mode ? The IIS URL Rewrite module For ASP.NET routing, it is works the same way preferable to use integrated regardless of whether pipeline mode. ASP.NET routing integrated or classic IIS can work in classic mode, but in pipeline mode is used for the that case the application URLs application pool. must include file name extensions or the application must be configured to use "*" handler mapping in IIS.Summary:IIS Rewiting & ASP.NET Routing:"Either IIS URL rewriting or ASP.NET routing can be used to implement URL manipulationscenarios for your Web application. " - By Ruslan YakushevMain advantage of ASP.NET Routing:"It keeps the request-resource resolution logic within your application, so its very easy toadd application-dependent logic when you need, and it eliminates the need to maintainsynchronization between your application and a separate configuration resource.Routing works great with traditional webforms." - By Rex MReference:
  • 76. Oracle vs WCF vs TopXml AdaptersDifference between BizTalk Oracle Adapters(or)Compare and contrast between different BizTalk Oracle Adapters(or)Difference between Microsoft BizTalk Oracle Adapter ,Microsoft BizTalk WCFAdapter and TopXml Adapter for DatabasesMicrosoft BizTalk Microsoft BizTalk TopXml Adapter forOracle Adapter WCF Adapter DatabasesBizTalk Server support BizTalk Server BizTalk Server supportversion: support version: version:BizTalk Server 2006 BizTalk Server 2006 R2 BizTalk Server 2004/2006Access: Access: Access:ODBC driver to connect Oracle Adapter for Oracle Adapter for .NETto DB .NET (ODP.NET) (ODP.NET)Processing: Processing: Processing:Supports “PollingQuery” Single Polling Generation of BizTalkand mechanism that schemas based on SQL“TableChangedEvent” provides the following statements, Stored features: Procedures (in, out, return parameters), multiple · Generate strongly tables typed schema based on a SELECT statement · Periodic polling of data source · Specify Post-Poll statements to be · Oracle alerts (send and executed after a polling receive) can send event asynchronous notifications based on some events. · Poll and Post-Poll Uses DBMS_ALERTS statements executed in oracle package. a Transaction context · Oracle Receiver can be · Specify Transaction configured to receive alerts Isolation level and Oracle Sender can send alerts to data source. · Poll, Post-Poll and transaction levels can · Oracle Pipes allow inter- be specified with process communications binding properties with Oracle sessionsIDE Integration: IDE Integration: IDE Integration:Standard integration Enhanced integration at Redesigned and developed design time between in C#.NET that provides
  • 77. BizTalk and Visual tight integration with Studio that provide the BizTalk Adapter framework following features: · Generate schemas based · Standardized GUI for on stored procedures and browsing, searching also Select, Insert, Update, and retrieving LOB Delete and InsertUpdate artificats statements on tables and views · Design-time enhancements for browsing stored procedures, functions and packages (categorized and hierarchical manner)Programming Programming Programming Interface:Interface: Interface: Schema generationStandard XML schema Exposes WCF capabilities that allowmessages Programming interfaces importing database schema that provide WCF from the underlying data· Metadata is retrieved channel, WCF service provides into theas XML messages model and web service orchestrations. model · Uses Enterprise · Exposes programming Instrumentation framework interfaces for retrieving for tracing and logging metadata including search and browse · Send Adapters are capabilities equipped with Exception handlers that allows you to specify Send Adapter behavior when a particular exception is raisedTransactions: Transactions: Transactions:· Not Supported · Supports WCF mode Supports Transactions and Transactions for Transaction Isolation levels Outbound and InboundAdditional Features: Additional Features: Additional Features:· Not Supported · Supports IN, OUT, · Supports various Data INOUT REFCURSORS sources such as IBM DB2, with strongly typed and SyBase, MySQL etc weakly typed variants · Extendable Data · Supports BLOB, Providers CLOB, BFILE types in tables and stored procedures with streaming capabilities
  • 78. · Enhancing on top of ODP.NET, the WCF- based Oracle DB adapter supports RECORD type parameters in stored procedures/functions even though these types are not natively supported by ODP.NET (version ggbug.aspx? PostID=5755446Support and Support and Support and Licensing:Licensing: Licensing: · Additional pricing and· Depends on licensing · Depends on licensing licensing modelagreement with agreement withMicrosoft Microsoft · Online Support· No additional pricing · No additional pricingfor the adapters for the adaptersReference: Adapter vs BizTalk AdapterDifferences between the Windows Communication Foundation (WCF) Line-Of-Business (LOB) Adapter Pack and the BizTalk Adapter Framework(OR)Difference between WCF LOB Adapter SDK and BizTalk Server Adapter Framework S.No WCF LOB Adapter SDK BizTalk Server Adapter Framework 1 API: API: .NET 3.0 Assembly, provides COM, provides basic support for help classes for metadata adapter operations. processing, connection management, and messaging . 2 Exposed as WCF binding; Adapter exposure: available to any application Exposed only to BizTalk Server; not that can consume a WCF reusable by other applications. binding including BizTalk Server 2006 R2 (using the
  • 79. WCF adapter). 3 Tools : Tools : Adapter Code Generation N/A Wizard, metadata browser for Visual Studio 2005. 4 Extensibility : Extensibility : Yes (as WCF channel No extension)Reference: Cross vs ID Cross ReferencingDifference between Value and ID Cross references in BizTalk Server(OR)Difference between Value Cross Referencing and ID Cross Referencing in BizTalkServer S.No Value Cross Referencing ID Cross Referencing 1 Whether it can be modified Whether it can be modified during runtime: during runtime: These cannot me modified These may be set at run-time. Set during run-time. Common ID functoid is used for this. 2 Where it occurs ? Where it occurs ? This occurs between app This occurs between appinstance types. types. 3 Where it occurs normally ? Where it occurs normally ? This cross-referencing This cross-referencing commonly commonly occurs between occurs between entity unique enumeration fields. identifiers. 4 Caching Mechanism is used Caching Mechanism is used or or not: not: This uses caching mechanism. In this, we will hit the database for After any changes in database, every call. we have to restart the corresponding host instances to see the changes.
  • 80. 5 What kind of mapping is What kind of mapping is used ? used ? It’s a one-to-one mapping. It’s a many-to-one mapping. 6 Mapping Direction - Mapping Direction - Unidirectional or Unidirectional or Bidirectional ? Bidirectional ? The mapping is gauranteed in both The mapping is gauranteed in directions. only one direction. 7 Value Cross Referencing ID Cross Referencing behaviour behaviour while using while using Reverse Mapping: Reverse Mapping: Reverse mapping is always in When you want to use them for synch with the initial mapping. the reverse mapping for a value which is mapped to multiple inputs, the first value stored in the xref tables is fetched. 8 Following mapping is Following mapping is allowed or allowed or not? not? Apple – Fruit Apple – Fruit Banana – Fruit Banana – Fruit Grape – Fruit Grape – Fruit The above mapping is allowed. The above mapping is not allowed So in this case , the reverse allowed and are restricted by mapping may not give the constraints on the Id cross expected output. reference tables. 9 What functoids need to be What functoids need to be used used in the maps ? in the maps ? We have to use the We have to use the GetCommonId GetCommonValue & & GetApplicationId functoids in the GetApplicationValue functoids maps in the mapsReference:
  • 81. CSharp Difference FAQs-11.Difference between C# 3.5 and C# 4.0 S.No C# 3.5 C# 4.0 1 C# 3.5 does not support C# 4.0 supports dynamic 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 cannot be specified with can be specified with default values default values. C# 3.5 does not using optional parameters. support optional parameters. 5 In C# 3.5, method parameters C# 4.0 provides named parameters have to be specified in the to represent the values of method same order as in method parameters without following the declaration in the method call. order of declaration. C# 3.5 does not provide named parameters. 6 In C# 3.5, usage of ref In C# 4.0, usage of ref keyword is keyword is mandatory while optional while executing methods executing methods which are which are supplied by the COM supplied by the COM interfaces. interfaces. 7 The COM object’s indexed The COM object’s indexed properties are not recognized properties are recognized in C# in C# 3.5. 4.0. 8 Co-variance and contra- C# 4.0 enhances Generics by variance are not supported in introducing co-variance and contra- Generics of C# 3.5. variance.2.Difference between C# and VB.NET S.No C# VB.NET 1 In C#, variables are declared In VB.NET, the variables are using declarators. declared using keywords such as private, protected, friend, public, static, shared and Dim.
  • 82. 2 In C#, an object can only be In VB.NET, an object can be created using new. created 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 declaration to indicate that the does not return a value. method does not return any value.4 In C#, no keyword is required In VB.NET, Overloads keyword is to indicate an overloaded used to indicate an overloaded method. method.5 The current object is referred The current object is referred as using this pointer in C#. me in VB.NET.6 Non virtual call cannot be To make a non-virtual call to the made in C#. current object’s virtual method, MyClass is used in VB.NET.7 Compound data type is Compound data type is declared in declared in C# using class, VB.NET using Structure. struct and 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 Object cleanup can be done by explicitly done by destructor in using Finalize method in VB.NET. C#.10 In C#, an object is subject to In VB.NET, an object cannot be asynchronous modification modified in an asynchronous way. using volatile keyword.11 In C#, all the variables have to In VB.NET, variables can be forced be declared before being used. for explicit declaration using Option Explicit.12 In C#, default property is In VB.NET, default property is defined by using indexers. defined using Default.13 In C#, base class can be In VB.NET, base class can be referred using the keyword referred using the keyword ‘base’. ‘MyBase’.14 Abstract class of C# can only MustInherit keyword of VB.NET is be inherited and not used to denote that a class can instantiated. only be inherited and not instantiated.15 Sealed keyword of C# is used NotInheritable keyword of VB.NET to denote that a class cannot denotes that the class cannot be inherited. involve in inheritance.
  • 83. 16 Division can be performed in Division can be performed in C# using / operator. VB.NET using operator. 17 Remainder of division can be Remainder of division can be retrieved using mod operator retrieved using %. of C#. 18 C# does not have In VB.NET, exponentiation can be exponentiation operator. performed using ^ operator. 19 C# has Bitwise operators Bitwise operators in VB.NET are namely &,| and ^. And, Or, Xor. 20 Object reference variables can Object reference variables can be be compared using == compared using Is operator in operator in C#. VB.NET. 21 The short ciruit operators in C# The short circuit operators in are && (Boolean AND) and || VB.NET are AndAlso (Boolean (Boolean OR). AND) and OrElse (Boolean OR).3.Difference between C# and C++ S.No C# C++ 1 C# is a high level language C++ is a low level and indeed that is component oriented. platform neutral programming language. 2 When compiled, C# code is When compiled, C++ code is converted into Intermediate converted into assembly language language code. This code. intermediate 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 automatically handled by allocated in the heap dynamically garbage collector. has to be explicitly deleted. 4 In C# Switch Statement, the In C++ Switch Statement, the test test variable can be a string. variable cannot be a string. 5 In C# switch statement, when In C++ switch statement, when break statement is not given, break statement is not given, the the fall through will not happen fall through will happen to the next to the next case statement if case statement even if the current 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.
  • 84. control statement called for each. 7 C# struts can contain only C++ struts behave like classes value types. The struts is except that the default access is sealed and it cannot have a public instead of private. default no-argument constructor. 8 In C#, delegates, events and In C++, only variables, properties can also be constructors, functions, operator specified as class members. overloads and destructors can be class members. 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 has a closing brace definition has a closing brace alone. followed by a semicolon. 10 The access modifiers in C# are The access modifiers in C++ are public, private, protected, public, private, protected. C++ internal and protected internal. does not have internal and protected internal access modifiers. 11 C# has finally block in C++ does not have finally block in exception handling exception handling mechanism. mechanism. The code 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 throw a class that is derived any class. from the System.Exception class. 13 C# does not have the concept C++ has the concept of function of function pointers. C# has a pointers. similar concept called Delegates.Reference:
  • 85. Object vs Var vs Dynamic KeywordsDifference between Object, Var and Dynamic KeywordsObject Var DynamicIntroduction: Introduction: Introduction:Object keyword is Var keyword is introduced Dynamic keyword isintroduced in C# 1.0 in C# 3.0 introduced in C# 4.0Data Storage: Data Storage: Data Storage:Can able to store any Can able to store any Can able to store any typekind of value, because type of value but it require of the variable, similar toobject is the base class to initialize at the time of old VB language variable.of all type in .net declaration.framework. f4R_nVJyN7Q/TjKtHKB0 NNI/AAAAAAAACcE/vZm riKOlC5Y/s1600/var+iniali ze+error.JPGType Safety: Type Safety: Type Safety:Compiler has little Its compiler safe i.e Compiler doesnt have anyinformation about the compiler has all information about the thistype . information about the type of variable. stored value, so that it doesnt cause any issue 9B9snB1pPFg/TjKtRr435OIO3j4Ud1rn9s/TjKtOoGs at run-time. /AAAAAAAACcM/FnUjqaGrbI/AAAAAAAACcI/Q1a FYI0/s1600/dynamic.JPG9HF2Hbok/s1600/object BXXEgzeJ8XE/TjKtWeI_J.JPG GI/AAAAAAAACcQ/iW6x h5sYPg4/s1600/var+com piler.JPGSupports as method Supports as method Supports as methodargument type : argument type : argument type :Object type can be Var type can not be Dynamic type can bepassed as function passed as function passed as functionargument and function argument and function argument and function alsoalso can return object can not return object can return object typetype type. This type of variable can work in the scope where it defined. dkV7VvttM34/TjKtbFDf0yI /AAAAAAAACcU/PnUFg5 KIDcE/s1600/var+passing +argument.JPGNeed type casting on Need type casting on Need type casting onassignment : assignment : assignment :
  • 86. Require to cast object No need to cast because Casting is not require butvariable to original type compiler has all you need to know thebefore using it. So this information to perform property and methodsassigning to object type operation. related to stored typeand converting tooriginal type called asBoxing and Un-Boxingfor value type and forthe reference type itscasting of types. Itsactually increasing theoverhead when we dothis both operation.Allows to performoperation of given typeonce it get cast anyuser defined or primitivedata type.Stored Value: Stored Value: Stored Value:Cause the problem at Doesnt cause problem Cause problem if the wrongrun time if the stored because compiler has all method or propertyvalue is not get info about stored value. accessed because all theconverted to underlying information about storeddata type. value is get resolved only at run time/- Gk8fm_tIc98/TjKtjhCgnPI/AjiI/AAAAAAAACcY/ldRU AAAAAAACcc/BZshBUrwCTGHpTO4/s1600/Objec 90/s1600/dynamic+error.JPt+error.JPG GAs source in for each As source in for each As source in for eachiteration: iteration: iteration:Not supported Supported SupportedApplication Area: Application Area: Application Area:Useful when doesnt Useful when getting result Useful when coding usinghave more information out of the linq queries. In reflection or dynamicabout the data type i.e., 3.5 framework it introduce language support or withto hold objects as base to support linq feature. the COM objects, becauseclass. we require to write less amount of code.Compilation Example: Compilation Example: Compilation Example:Object o = new var o = new Button(); dynamic o = new Button();Button(); o.Width will compile o.Width and even doesn’t compile will compile where xyz is not a memberReference:
  • 87. Identifier vs Keyword in C#Difference between Identifier and Keyword in C# S.No Identifier Keyword 1 Meaning: Meaning: A C# identifier is a name given Keywords are predefined reserved to a class, delegate, interface, identifiers that have special method, namespace or meanings to the compiler. variable. 2 What it consists of ? What it consists of ? Must be any combination of Must be only letters. letters, numbers, and underscores. 3 Upper case / Lower case / Upper case / Lower case / Both ? Both ? Most of the keywords are Allows both Uppercase and Lowercase.But,only Namespaces, Lowercase. Types and Members have their first character in uppercase. 4 Whether Unicode characters Whether Unicode characters are are allowed or not ? allowed or not ? Identifiers can begin with an Unicode characters are not used in allowed Unicode character or any C# keywords an underline. But,we need to use nonformatting Unicode characters in any part of an identifier. i.e., u0027format // error – Unicode formatting character which is not allowed. 5 Whether it can be used to Whether it can be used to name name classes, methods, or classes, methods, or variables ? variables ? We cannot use keywords for The purpose of Identifier is to naming classes, methods, or provide names to variables. namespaces, classes, methods, variables, and interfaces.Note: Keywords cannot be used as identifiers in your program unless they include the "at"sign (@) as a prefix. For example, @new would be a legal identifier; but, new is not,because it is a keyword.Reference:
  • 88. null keyword vs DBNull class in C#Difference between null and System.DBNull.Value S.No null DBNull 1 Conceptual Difference: Conceptual Difference: The keyword null represents The class System.DbNull an invalid reference. represents a nonexistent value in a database field. 2 What is the purpose of null What is the purpose of DBNull keyword ? class ? NULL is used to check if a DBNULL is used to check if a whole record is not found in certain field in a database is null. the database. 3 Is it a Value / Reference / Is it a Value / Reference / Nullable type ? Nullable type ? null is the default value of DBNull does not match the type of reference-type variables. a nullable value type, a reference Ordinary value types cannot be type, or a value type, and therefore null. is not directly assignable. Please look at: Handle null, then DBNull to avoid InvalidCastException Reason: Of DBNull class only one instance can exist as it a singleton class. Sole instance is DBNull.Value.Handle null, then DBNull to avoid InvalidCastException:For instance, sometimes in code you will see items in a data row being used withoutchecking for null first. When the underlying field is not null, this is OK, but if a null isavailable, the following code will not work:Example-1Decimal amount = (Decimal)row["AmountValue"]; //returned value is DBNullBecause DBNull is not the same type, an InvalidCastException occurs. Rather, a nullcheck has to be performed. The safe alternative to this is the following:Example-2Decimal amount = 0;If (!row.IsNull("AmountValue"))amount = (Decimal)row["AmountValue"];
  • 89. If you want to set a rows value, you can do something like below. The row takes aninstance of type object, and therefore can be assigned DBNull:Example-3If (amountValue > 0)row["AmountValue"] = amountValue;Elserow["AmountValue"] = DBNull.Value;The value property returns the actual instance of DBNull (a static property). Sometimes, ahelper routine would be good to handle this conversion for you, reducing the amount to atotal of one line instead of four. That may not seem like much, but a table with thirtycolumns will make this much coding a chore.Checking null and DBNull valuesHow to check for null value ?1. Create the variable. A variable must be declared before using it. The code belowallocates memory and declares the variable for use.string myNullVar = null;The code uses the "null" value assignment for the new variable.2. Check if the variable is null. The code below checks if the variable is null. If it is null, thecode assigns it a color value.if(myNullVar == null) {myNullVar = "purple";}3.Check if the variable is not null. In some cases, you may wan to reassign the variableback to null. The following code checks if the variable is not null, and assigns it a nullvalue.if(myNullVar != null) {myNullVar = null;}How to check for DBNull values ?4. Declare a variable. Just like section 1, to check for DBNull, a variable needs to bedeclared. However, the variable is assigned the DBNull value.string myNullVar = System.DBNull;5. Use the "Equals()" method from the string class to check for the DBNull value. The codebelow checks for this value and assigns myNullVar a color.if (myNullVar.Equals(System.DBNull.Value)) {myNullVar = "purple";}6.Evaluate if the variable is not null. Similar to section one, you may want to check if thevariable is not null to reassign it back to DBNull. The "!" character evaluates to "not" in thefollowing example.if(!myNullValue.Equals(System.DBNull.Value)) {myNullValue = System.DBNull;
  • 90. }Note:However note that neither checking null of nor DBNull.value will work if the index is out ofrange. If we check for an index or a column that doesnt exist, it will throw an index out ofrange exception.Reference: generics vs C++ templatesDifference between C# generics and C++ templates S.No C# Generics C++ Templates 1 Strongly / Loosely typed: Strongly / Loosely typed: C# Generic types are strong C++ Templates are loosely typed. typed. 2 Instantiated at Compile Instantiated at Compile time / time / Runtime: Runtime: C# Generic types are C++ templates are instantiated at instantiated at the runtime. the compile time. 3 Whether it permits the type Whether it permits the type parameters to have default parameters to have default values ? values ? C# Generic types do not permit C++ templates permit the type the type parameters to have parameters to have default values. default values. 4 Whether DLL can be created Whether DLL can be created using C# Generics ? using C++ Templates ? Libraries or DLLs can be C++ templates are always created using C# Generics. expanded at compile time. Therefore, the C++ compiler must have access to all template types— generally through header files— and any types used to create the closed types from the template types at compile time. For this reason alone, it is impossible to package C++ templates into libraries or DLLs. The STL is a perfect example: notice that almost every bit of your favorite STL implementation exists in header files.
  • 91. 5 Whether it is possible to call Whether it is possible to call arithmetic operators in a C# arithmetic operators in a C++ generic class ? template class ? C# generics do not provide the With C++ template class, it is same amount of flexibility as possible to call arithmetic C++ templates. For example, it operators. is not possible to call arithmetic operators in a C# generic class, although it is possible to call user defined operators.6 Whether explicit Whether explicit specialization is specialization is supported supported by C++ templates ? by C# generics ? C++ template support explicit C# generics does not support specialization. explicit specialization; that is, a custom implementation of a template for a specific type.7 Whether partial Whether partial specialization is specialization is supported supported by C++ templates ? by C# generics ? C++ template support partial C# generics does not support specialization. partial specialization: a custom implementation for a subset of the type arguments.8 Whether type parameter can Whether type parameter can be be used as the base class used as the base class for the for the generic type ? template type ? C# does not allow the type C++ allows the type parameter to parameter to be used as the be used as the base class for the base class for the generic type. template type.9 Whether generic type Whether template type parameter can itself be a parameter can itself be a generic ? template? In C#, a generic type C++ does allow template parameter cannot itself be a parameters. generic, although constructed types can be used as generics.10 What type of code it allows ? What type of code it allows ? C# requires code in a class to C++ allows code that might not be be written in such a way that it valid for all type parameters in the will work with any type that template, which is then checked for satisfies the constraints.C# the specific type used as the type disallows as allowed in C++ parameter. (Please look at example from For example, in C++ it is possible R.H.S column); the only to write a function that uses the language constructs allowed arithmetic operators + and - on are those that can be deduced objects of the type parameter,
  • 92. from the constraints. which will produce an error at the time of instantiation of the template with a type that does not support these operators. 11 Which language supports Which language supports generics? templates ? Generics can be supported by Templates are a C++ only any .NET language that wishes language feature. to do so. 12 Whether it allows non- Whether it allows non-template template parameters ? parameters ? C# does not allow non-type C++ allows non-type template template parameters. parameters.Reference: vs as operators in C#Difference between is and as operators in C# S.No Is operator As opeator 1 Meaning: Meaning: The is operator allows us to The as operator is used to perform check whether an object is certain types of conversions compatible with a specific type. between compatible reference Here the phrase "is types. compatible" means that an i.e., The as operator is used to object is either of that type or is perform explicit type conversion of derived from that type. reference type.If the type being converted is compatible with the specified type,then that conversion is successful else as operator will return a null value. 2 How it works ? How it works ? i.Checks whether Object is i.Checks whether Object is compatible with given type compatible with given type ii. If yes, returns true ii. If yes, returns not null reference iii. If no, returns false i.e same object iii. If no, returns null instead of Remarks: raising an exception. An is expression evaluates to true if both of the following conditions are met: expression is not null. expression can be cast to type. That is, a cast expression of the form (type)(expression) will
  • 93. complete without throwing an exception. For more information, see 7.6.6 Cast expressions. 3 When to use is operator ? When to use as operator ? The is-cast is only ideal if the If we need to use the casted casted variable will not be variable, use the as-cast. needed for further use. 4 For what type of For what type of conversions,as conversions,is operator can operator can be used ? be used ? as operator only performs is operator only considers reference conversions and boxing reference conversions, boxing conversions. conversions, and unboxing conversions. 5 Syntax: Syntax: expression is type expression as type 6 Example: Example: int k = 0; object x = "I am here"; if (k is object) object y = 10; { Console.WriteLine("i is an string s1 = x as string; // here object"); conversion is compatible so,s1="I } am Here" string s2 = y as string;// here conversion is imcompatible so,s2=nullNotes:1.Syntax: expression as type is equivalent to:expression is type ? (type)expression : (type)nullExample: Employee e = obj as Employee; is equivalent to:Employee e = obj is Employee ? (Employee)obj : (Employee)null;2.Both is and as operators cannot be overloaded.3.The is operator will never throw an exception.4. A compile-time warning will be issued if the expression expression is type is known toalways be true or always be false.5. Both is and as operators cannot use user-defined conversions6.The as cast is an efficient, elegant way to cast in the C# language. It promotesexception-neutral and less redundant code.
  • 94. Reference:
  • 95. Design Patterns - Difference Between FAQs1. Difference between Factory Pattern and Abstract Factory PatternS.No Factory Pattern Abstract Factory Pattern1 Create object through Create object through inheritance composition2 Produce only one product Produce families of products3 Implements code in the Concrete factories implements abstract creator that make factory method to create use of the concrete type that product sub class produces2.Difference between Abstract Factory Pattern And Builder PatternS.No Builder Pattern Abstract Factory Pattern1 In Builder Pattern, there will Abstract Factory Pattern will be one Director class which return the instance directly. will instruct Builder class to build the different parts/properties of our object and finally retrieve the object.2 It will have reference to the It does not keep the track of its created object. created object.3.Difference between Builder Pattern And Composite PatternS.No Builder Pattern Composite Pattern1 It is used to create group of It creates Parent - Child objects of predefined types. relations between our objects.4.Difference between MVC and MVPS.No MVP MVC1 MVP is a bit more complex to MVC is easier to implement implement than MVC .Also, it than MVP. has additional layer for view interfaces.2 The request is always The request is received by the received by the View and controller which in turn gets the delegated to the presenter required data and loads up the which in turn gets the data appropriate view does the processing3 The presentation and view The controller logic can be unit logic an be unit tested as the tested.
  • 96. view is loosely coupled. Note: We can unit test view if we are using Razor view engine. ASPX viewengine are not that easily unit testable4 MVP is best suitable for MVC is best suitable for Web Windows Programming as Programming. the flow naturally tend towards this pattern.5.Difference between Proxy Pattern and Observer PatternS.No Proxy Pattern Observer Pattern1 The Proxy Pattern is used for The Observer Pattern is used wrapping a kind of special by a publisher object to notify object with 1 or more other subscriber objects with objects. information.2 Either because we dont The publisher object does not always have the wrapped know the subscribing objects - object or because it needs to except that the conform to a be managed in a certain way certain subscriber interface. that can be simplified via the This is a very flexible pattern for proxy object(s). This is kind distributing events, since those of a way to exchange the API that wants to listen on certain of an existing class with a object has the power to do so proxy class. We are not just without changing the code of talking events here, but the publishing object. whatever kind of functionality to define via the proxy object instead of the real object.6. Difference between Singleton Pattern and static classS.No Singleton Pattern static class1 Singleton pattern maintains We cannot create instance for single instance. static class.2 A singleton can extend A static class cannot . classes and implement Note: It can extend classes, but interfaces. it does not inherit their instance members.3 A singleton can be initialized A static class is generally lazily or asynchronously. initialized when it is first loaded, leading to potential class loader issues.4 Singletons can be handled static class cannot be handled polymorphically without polymorphically. forcing their users to assume that there is only one
  • 97. instance.5 Singleton Class can have Static are always just shared value when Class object and have no instance but instantiated between server 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 We cannot pass parameter in as parameter static class7 Singleton provides flexibility Static classes once defined and also provides sort of a could not accomodate any mechanism to control object future design changes as by creation based on various design static classes are rigid requirements. They can be 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.7.Difference between Strategy and Inversion of Control (IOC)S.No Strategy Pattern Inversion of Control (IOC) Pattern1 The strategy pattern is useful Inversion of when we want classes to Control/Dependency Injection depend on the interface (IoC/DI) comes into play when rather than the we want the concrete strategy implementation.And we can implementation injected into a easily swap out behavior class. For example, we could depending on which concrete use the DI Framework Ninject implementation we provide. and configure it so that it will know which concrete strategy implementation to inject into a class in specific scenarios. Note: Strategy is just one of the ways that IOC is implemented
  • 98. 8.DIfference between IDictionary and DictionaryS.No IDictionary Dictionary1 IDictionary is just a contract, Dictionary is concrete abstraction implementation.2 It is recommended for Argument or Property is not example to expect as required for Dictionary. argument an IDictionary rather than 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 InjectionS.No Factory Pattern Dependency Injection(DI)1 Factory is used to create DI is used to move the objects 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. Autofac10.Difference between String.Clone() and String.Copy() methodS.No String.Clone() String.Copy()1 Returns a reference to this Creates a new instance of instance of String. String with the same value as a specified String. i.e., it gives pointer value(ie Current memory Reference) i.e., it creates an instance in Heap Memory and gives pointer value(ie New Memory Reference)
  • 99. 11.Difference between Strategy Pattern and Factory PatternS.No Strategy Pattern Factory Pattern1 Strategys sole intent to is to Factorys sole purpose is to provide a mechanism to create objects . select different algorithm.2 We cannot use "strategy" to We can use "factory" to create create objects of "factory". objects of "strategy".12.Difference between Proxy and AdaptorS.No Proxy Pattern Adaptor Pattern1 Proxy on the other hand Adapter is used to adapt to represents a standin object incompatible interfaces. Its for the real object. This is more directed from the client required when the real object (those who consume the object) is complex to create, is not perspective. A client expects an available, or for interface to be of particular type authentication purpose. For and adapter plays a role in e.g. web service proxy, proxy filling that gap. authentication server etc. Its more from making it easier Proxy can be categorized into for the client to adapt to other third party libraries within there own by adapting to it. Virtual Proxy Remote Proxy Protection Proxy13.Difference between Decorator and VisitorS.No Decorator Pattern Visitor Pattern1 Decorator may have just a Visitor has a tree of objects to single object to customize. be worked upon.2 Decorator does not require a Visitor requires a traverser for traverser for successful successful implementation. implementation.3 Decorator pattern is a Visitor pattern is Behavioral structural pattern that help us pattern that seperate the data to add new function to an structure from the operation object in the run time , note (functionality ) that work on it , that in the run time not design this mean we can add different time . operation on the same data structureReference:
  • 100. between-faqs.htmlDifference between MEF and DI / IOCDifference between MEF and DI / IOC S.No MEF DI / IOC 1 Abbreviation: Abbreviation: MEF stands for Managed DI / IOC stands for Dependency Extensibility Framework Injection and Inversion Of Control 2 Meaning: Meaning: Managed Extensibility Dependency injection is a software Framework (MEF) is a design pattern that allows a choice component of .NET of component to be made at run- Framework 4.0 for creating time rather than compile time. This lightweight, extensible can be used, for example, as a applications. It allows simple way to load plugins application developers to dynamically or to choose mock discover and use extensions objects in test environments vs. with no configuration required. real objects in production It also lets extension environments. This software design developers easily encapsulate pattern injects the dependent code and avoid fragile hard element (object or value etc) to the dependencies. MEF not only destination automatically by allows extensions to be reused knowing the requirement of the within applications, but across destination.Inversion of Control applications as well. MEF was usually refers to the "containers" introduced as a part of .NET while Dependency Injection refers 4.0 and Silverlight 4. to the actual pattern.DI is a form of IoC.Dependency injection is the main method to implement Inversion of Control. 3 Where it can be used ? Where it can be used ? MEF is useful for dynamic IOC is most useful with Static dependencies. dependencies 4 Used for Known / Unknown Used for Known / Unknown parts: parts: MEF is for discovery of IOC is for registration of known unknown parts. parts. 5 Best choice for 3rd party Best choice for 3rd party controls or not: controls or not: When working with/for 3rd When working with/for 3rd party party dlls , MEF is more the dlls , IOC is not the best choice. best choice. 6 Swapping DLLs at runtime Swapping DLLs at runtime possible or not: possible or not: If we have two dlls, taking a If we have two dlls, taking a
  • 101. decision at runtime to swap the decision at runtime to swap the two two is possible using MEF. is not possible using IOC. 7 Plug-in versioning problem: Plug-in versioning problem: Plug-in versioning problem is Plug-in versioning problem is there not there in MEF in IOCReference: vs SCRUM methodologiesDifference between RUP and SCRUM methodologies S.No RUP SCRUM 1 Cycle: Cycle: Formal Cycle is defined across Each sprint (iteration) is a complete 4 phases, but some workflows cycle. can be concurrent . 2 Planning: Planning: Formal project plan, No end-to-end project plan. Each associated with multiple next iteration plan is determined at iterations, is used. The plan is the end of the current iteration end-date driven and also has (NOT end-date driven). Product intermediate milestones. Owner (Key Business User) determines when the project is done. 3 Scope: Scope: Scope is predefined ahead of Instead of scope, SCRUM uses a the project start and Project Backlog, which is re- documented in the Scope evaluated at the end of each document. Scope can be iteration (sprint). revised during the project, as requirements are being clarified, but these revisions are subject to a strictly controlled procedure. 4 Artifacts: Artifacts: Vision/Scope Document, The only formal artifact is the Formal functional requirements operational software. package, system architecture document, development plan, test plan, test scripts, etc. 5 Type of Project/Product: Type of Project/Product: Recommended for large, long- Recommended for quick term, enterprise-level projects enhancements and organizations
  • 102. with medium-to-high that are not dependent on a complexity. deadline.Summary: Both methodologies are considered to be Agile and approach project activitiesin the iterative way.Reference: Between Flowchart and Data Flow DiagramDifference Between Flowchart and Data Flow Diagram (DFD) S.No Flowchart Data Flow Diagram (DFD) 1 Flow chart presents steps to Data flow diagram presents the complete a process flow of data 2 Flow chart does not have any Data flow diagram describes the input from or output to external path of data from external source source to internal store or vice versa. 3 The timing and sequence of The processing of data is taking the process is aptly shown by place in a particular order or a flow chart several processes are taking simultaneously is not described by a data flow diagram. 4 Flow chart shows how to make Data flow diagrams define the a system function. functionality of a system 5 Flow charts are used in Data flow diagram are used to designing a process describe the path of data that will complete that process. 6 We have following types of We have following types of data flowcharts, flow diagrams, • System flow chart • Physical data flow diagrams • Data flow chart • Logical data flow diagrams • Document flow chart • Program flow chartReference:
  • 103. .NET Framework Difference FAQs-1 1. What is the difference between CCW and RCW? S.No CCW RCW 1 Abbreviation: Abbreviation: CCW stands for COM Callable RCW stands for Runtime Wrapper Callable Wrapper 2 Meaning: Meaning: COM to .NET communication .NET to COM Communication happens through CCW happens through RCW 3 Process involved for CCW: Process involved for RCW: i)Create Assembly and compile i)Create Public Key Token file with strong name. using sn.exe ii)Register Assembly using ii)Use tlbimp /keyfile: regasm /out: iii)Register Assembly in GAC iii)Register Imported Assembly using gacutil /i in GAC using gacutil /i iv)Use tlbexp to export Assembly as Type Library for COM. 2. What are the differences between DLL and EXE? S.No DLL EXE 1 DLL stands for Dynamic Link EXE stands for Extensible Library Execute File 2 DLL can not be used by End EXE is used by End User User. like-Client 3 We can not run the DLL We can run the EXE 4 An ActiveX DLL runs in An ActiveX EXE is an out of process server running in the process server which runs in same memory space as the its own separate memory client process. space. 5 If an unhandled error occurs it If an error occurs the client will cause the client process processes can continue to to stop operating. operate. 6 DLL will run within an EXE EXE can run independently 7 DLL is an in-process file EXE is an out-process file 8 A DLL is visible to the system An EXE is visible to the
  • 104. as a Win32 DLL but most system as a regular Win32 likely without any entry points. executable. Its entry point The .NET runtime stores refers to a small loader which information about the initializes the .NET runtime contained assembly in its own and tells it to load and header. execute the assembly contained in the EXE. 3. 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 It compiles directly to language machine code 3 It provides services like It does not provide security, security, exception handling, exception handling, garbage garbage collection etc collection etc 4 It can access both managed It can access only and unmanaged code unmanaged codeReference: Framework Difference FAQs-21.Difference between Finalize() and Dispose() methods in .NET S.No Finalize() Dispose() 1 Finalize() belongs to the Object Dispose() belongs to the class. IDisposable interface 2 It is automatically called by the We have to manually write the Garbage Collection code to implement it(User Code) mechanism when the object ex: if we have emp class we have goes out of the scope(usually to inherit it from the IDisposable at the end of the program) interface and write code. We may have to suppress the Finalize method using GC.SuppressFinalize() method. 3 It is slower method and not Faster method for instant disposal suitable for instant disposing of of the objects. the objects. Example: user interface Controls. Example: Forms, SqlConnection class have built in implementaion of Dispose class employee method. {
  • 105. //This is the destructor of emp class ~employee() { } //This destructor is implicitly compiled to the Finalize method. } 4 It is non-deterministic function It is deterministic function as i.e., it is uncertain when Dispose() method is explicitly Garbage Collector will call called by the User Code. Finalize() method to reclaim memory.2.Difference between Dispose and Destructor in .NET S.No Dispose Destructor 1 Unmanaged resources are It is used to release unused removed by dispose method managed resources and it is called and it is called manually automatically by the Garbage Collector 2 It is used to remove the It is used to de-allocate the unused resources from the allocated memory by the memory. constructor method3.Difference between Close() and Dispose() methods in .NET S.No Close() Dispose() 1 When a Close() method is Where as Dispose() method called,database connection will permanently close and removes be temporarily closed and can connection object from memory be opened once again using and the resource no longer exists Open() method. for any further processing. Note: However, calling Dispose does not remove the connection from the connection pool.Example:try{
  • 106. string constring = "Server=(local);Database=my; User Id=sa; Password=sa";SqlConnection sqlcon = new SqlConnection(constring);sqlcon.Open(); // here connection is open// some code here which will be execute}catch{// code will be execute when error occurred in try block}finally{sqlcon.Close(); // close the connectionsqlcon.Dispose(); // desroy the connection object}Note: Only call the Close method on a Stream or a database connection if the object willbe reused. Otherwise, use the Dispose method.Reference: Framework Difference FAQs-31.Difference between Namespace and Assembly S.No Namespace Assembly 1 Namespace is the logical Scope for a particular type is naming decided at design time defined at run time using Assembly. by the developer. 2 Namespace contains set of Assembly contains code of the unique names. form MSIL ( Microsoft Intermediate Language) 3 Classes available in your Logical units are physically program will be logically grouped together as assembly. grouped together under a namespace. 4 Namespace can include An assembly can contain types multiple assemblies. belonging to different namespaces. 5 Namespace doesnt have any Assembly can be classified as classification. private assembly and public assembly. Private assembly is specific to a single application but shared/public assembly contains libraries which can be used by
  • 107. multiple applications.6 Namespaces have to be Assemblies need not be explicitly mentioned in Project- specified. They are automatically Properties. described in metadata and manifest files.7 Namespaces can be nested. Such nesting is not permissible in For example: assemblies. namespace sampleApp1 { namespace SampleApp2 { class sampleClass { … } } }8 Namespace is the one which Creating an assembly on your own you directly specify in your is not as simple as you create a code. A simple example for namespace. If you want to package namespace is shown below: the code shown as an example for namespace the namespace into an assembly, sampleNamespace { then you have to follow the steps class sampleClass { shown below: public void displayMsg() { " Generate a key file inside the Console.WriteLine("In same folder where you have sampleClass"); placed the code by typing the } following statement in the } command prompt: } sn -k sampleKey.key In this example, " Sign your code component with sampleNamespace is the this key. Assume that your code namespace you have created component is named as and sampleClass is within the sampleClass.cs. Now use the scope of this namespace. following command: csc sampleClass.cs /t:library /a.keyfile:sampleKey.key " Place your signed assembly inside GAC using AL Utility: AL /i: sampleClass.dll " Now create a code that accesses the code in your assembly: Using System; Using sampleNamespace; public class testClass { sampleClass obj = new sampleClass(); obj.displayMsg(); } " To test if your assembly got created and to test if the above code is working, compile the above
  • 108. code using the following statement: csc testClass.cs /t:exe /r: " Now if you execute testClass.cs, you should get the following output: In sampleClass2.Difference between System Exception and Application Exception S.No System Exception Application Exception 1 CLR throws system exception Application throws application exception 2 System exceptions are generic Application exceptions are not in nature generic. Each application exception has its own customized meaning 3 Each system exception has a Application exceptions do not have meaning. You can directly use a meaning for themselves. You them or you can derive new have to explicitly derive from them ones by inheriting and create your own custom System.Exception exceptions specific to your application 4 Example for system exceptions Example for application exceptions include SqlException, include SharePointException, StackOverflowException CmsException3.Difference between COM and .NET Component S.N COM Component .NET Component o 1 Interface based Object based communication communication 2 Reference count will be used Garbage Collector to manage to manage memory memory 3 Binary Standard objects Type Standard objects 4 Objects are created by Objects are created by normal new coCreateInstance operator 5 Object info resides in Type Object info resides in assembly library files 6 HRESULT will be returned Exceptions will be returned COM=HRESULT will be returned4.Difference between Private Assembly and Public Assembly
  • 109. S.N Private Assembly Public Assembly o 1 Private assembly can be used Public assembly can be used by by only one application. multiple applications. 2 Private assembly will be stored Public assembly is stored in GAC in the specific applications (Global Assembly Cache). directory or sub-directory. 3 There is no other name for Public assembly is also termed as private assembly. shared assembly. 4 Strong name is not required for Strong name has to be created for private assembly. public assembly. 5 Private assembly doesnt have Public assembly should strictly any version constraint. enforce version constraint. 6 By default, all assemblies you An example to public assembly is create are examples of private the actuate report classes which assembly. Only when you can be imported in the library and associate a strong name to it used by any application that and store it in GAC, it becomes prefers to implement actuate a public assembly. reports.Reference: vs Strong-named .NET componentsDifference between Weak-named .NET components and Strong-named .NETcomponents S.No Weak-named .NET Strong-named .NET components components 1 Weak names are not Strong names are digitally signed guaranteed to be unique and and provide a public key that thus cannot be shared without ensures there are no conflicts. potentially causing conflicts. 2 Weak-named .NET Strong-named .NET components components must be can be copied into the server’s individually copied to the /bin GAC directories of the Web applications where they are used. 3 .NET components with weak Furthermore, .NET components names can call unmanaged with strong names cannot call
  • 110. code (such as COM unmanaged code (such as COM components) and thus causes components) and thus avoid potential conflicts with potential conflicts with dependencies. dependencies.Reference: between STA and MTADifference between STA and MTA S.No STA MTA 1 STA stands for Single MTA stands for Multi Threaded Threaded Apartment Apartment 2 In STA,there may be multiple In MTA, only one apartment will be apartment.But only single there and all threads will execute thread can be executed in a within that single apartment. apartment. 3 In STA, if there is a need to In MTA, threads communicate communicate between threads directly to each other without a we need a proxy, they can not proxy. do it directly. 4 MTA applications execute MTA applications typically execute slower than STA faster than STA because there is less system overhead and can be optimized to eliminate system idle time. 5 If the COM object cannot If the COM object can handle its handle its own synchronization own synchronization then the MTA i.e not thread safe then the model can be used STA model can be usedSummary:An apartment is a logical container within a process for objects sharing the same threadaccess requirements.All objects in the same apartment can receive calls from any thread in the apartment.The .NET Framework does not use apartments, and managed objects are responsible forusingall shared resources in a thread-safe manner themselves.Reference:
  • 111. Assembly.CreateInstance() vs Activator.CreateInstance()Difference between Assembly.CreateInstance() and Activator.CreateInstance() S.No Assembly.CreateInstance() Activator.CreateInstance() 1 Namespace: Namespace: Derives from Derives from System namespace. System.Reflection namespace. 2 Meaning: Meaning: Locates a type from this Creates an instance of the type assembly and creates an whose name is specified in the instance of it using the system specified remote domain, using the activator.In simple terms, named assembly and default Assembly.CreateInstance constructor.In simple terms, looks for a type in a particular Activator.CreateInstance can assembly. create an object of any type. 3 Does it have overload Does it have overload method to method to create objects in create objects in other app other app domains, or on domains, or on another server ? another server ? Activator.CreateInstance has Assembly.CreateInstance overloads that Method does not have Assembly.CreateInstance Method overload method to create does not have;for instance, it can objects in other app domains, create objects in other app or on another server using domains, or on another server Remoting as like using Remoting. Activator.CreateInstance Method.Reference:
  • 112. Informix vs IBM Data Server .NET ProvidersDifference between Informix .NET Provider and IBM Data Server .NET Provider S.No Informix .NET Provider IBM Data Server .NET Provider 1 Protocol support: Protocol support: SQLI DRDA 2 Informix server support: Informix server support: Any supported Informix version Informix v11.10 or later ONLY 3 LOB (BLOB & CLOB) column LOB (BLOB & CLOB) column size limit: size limit: 4 TB 2 GB 4 Support for .NET framework Support for .NET framework 3.0, 3.0, 3.5: 3.5: No Yes Supports 1.1 and 2.0 Supports 2.0, 3.0, and 3.5 frameworks. Limited VSAI frameworks. windows application support. 5 Support for LINQ (Entity Support for LINQ (Entity Framework): Framework): No Yes 6 Silverlight and AJAX Silverlight and AJAX development support : development support : No Yes 7 ASP.NET dynamic data ASP.NET dynamic data support: support: Yes No 8 ADO.NET Entity Data ADO.NET Entity Data Modeling Modeling (EDM) support: (EDM) support: No Yes 9 Visual Studio Tools for Visual Studio Tools for Office Office (VSTO) development (VSTO) development using EDM: using EDM: Yes No 10 VSAI support for Visual VSAI support for Visual Studio Studio 2008, Web application 2008, Web application development support, WPF development support, WPF and and WWF enhancements: WWF enhancements: No Yes 11 VSAI Designers to create VSAI Designers to create tables, tables, procedures, procedures, functions and
  • 113. functions and triggers, run triggers, run procedures and procedures and functions: functions: No YesReference: vs SVNDifference between Subversion and Team Foundation Server 2010(OR)Difference between TFS and SVN S.No Subversion Team Foundation Server 2010 1 Check-Out : Get Latest : Download the latest version of Download the latest version of all all the files. the files. 2 Update: Get Latest: Updates a file to the latest Updates a file to the latest version. version. This does nothing if This does nothing if you already you already have the latest have the latest version or a newer version or a newer version version than what is found on the than what is found on the server. server. 3 N/A Check-Out: Communicate to TFS that you desire to edit a file or folder and set it to writeable within your local filesystem. 4 Commit: Check-In: Uploads any new changes to Uploads any new changes to files files you have edited to the you have edited to the Server. Server. 5 Revision: Changeset: The Unit of versioning. Each The Unit of versioning. Each time time you Check-in, that Check- you Check-in, that Check-in is in is given a unique Changeset given a unique Changeset ID. ID. 6 Copy: Branch: A folder that contains a copy of A folder that contains a copy of the the Main source tree. Main source tree. 7 Revert : Rollback: Used to undo changes from a Used to undo changes from a Changeset inside the Changeset inside the Repository.
  • 114. Repository. 8 Diff : Compare : Used to analyze differences Used to analyze differences between the a file or folder between the a file or folder found in found in your Workspace and your Workspace and that same file that same file or folder found in or folder found in the Repository. the Repository. 9 Blame: Annotate: Downloads every version of a Downloads every version of a file file and goes line-by-line and goes line-by-line creating an creating an output file showing output file showing the changeset, the changeset, date, and user date, and user who last edited who last edited each line of each line of code. code. 10 Log : History: Details a timeline of each Details a timeline of each Changeset and which user Changeset and which user updated updated that particular file. that particular file. 11 N/A Workspace: A container that maps your Working Folder found on your Local Machine to the Team Foundation Server Repository. Includes details like Name, Owner, and Computer.Summary: 1. Both TFS and SVN uses the same name Add to place a File or Folder into the Repository. 2. Both TFS and SVN uses the same name Delete to mark a File or Folder as Deleted on the Server. The file is still there, but it will not be downloaded or uploaded at the next Get or Check-in command.Reference: vs GetDescendants() in SitecoreDifferences between GetChildren() and GetDescendants() Methods in Sitecore S.No GetChildren() GetDescendants() 1 How it can be accessed ? How it can be accessed ? This method can be accessed This method can be accessed as as follows: follows: itemObject.GetChildren(); itemObject.Axes.GetDescendants() ;
  • 115. 2 Items returned by Items returned by GetChildren(): GetDescendants(): Returns all the direct children Returns all the items under an of an item. item. i.e. All the items present at level 1 under the item. 3 How to find all the Children How to find all the Children using GetChildren() ? using GetChildren() ? If we need all the children, we If we want all the children, then Call need to recursively call GetDescendants() method and we GetChildren() method, for all have them all and no recursive the items under a specific item. calls as like GetChildren(). So This surely gonna consume that’s where this method seems more time! good.What is Sitecore ?Sitecore is a web content management system software company that provides enterprisewebsite, intranet, portal and marketing automation software. The company was founded in2001 and has offices in Australia, Denmark, Sweden, Canada, Germany, Japan,Netherlands, United Kingdom, and United States.Sitecores software is built on Microsoft .NET 3.5/4.0. Content can be stored as XML or.NET objects and Sitecore CMS can leverage either Microsoft SQL Server or OracleDatabase for its database storage, though MS SQL Server is the most popular.[citationneeded] Sitecore also allows deployment via Microsoft Azure.[1]Reference:
  • 116. DOTNET Programming Concepts Difference FAQs-11.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 Here, we can add data with the key the list 3 Retrieving data using Arraylist Retrieving by key in Hashtable is is slower than Hashtable faster than retrieving in Arraylist because If we want to find because If we want to find something in a arraylist we something in a hashtable we dont have to go through each value have to go through each value in in arraylist. hashtable, instead search for key values and is faster.2.Difference between Hash Table and Arrays S.No Hash Table Array 1 Hash table stores data as Array stores only value name,value pair. 2 To access value from hash In array, to access value , we need table, we need to pass name. to pass index number. 3 We can store different type of In array ,we can store only similar data in hash table, say type of data. int,string etc.3.Difference between Dictionary and Hashtable S.No Dictionary Hashtable 1 Dictionary is a generic type Hashtable is not generic type. 2 In Dictionary we need to specify Hashtable is a collection of the types of both the key and the name/value pairs that are organised corresponding value.The value on the basis of hash code of the key represents the actual object being specified. stored and the key represents a means to identify a particular object. 3 In Dictionary public static Hashtable is thread safe for use by members are type safe but any multiple reader threads and a single
  • 117. instance members are not type writing thread. safe. 4 We cannot use Dictionary with We can use Hashtable withWeb Web Services The reason is no Services web service standard supports generic standard. 5 Dictionary is aster than Hashtable It is slower than dictionary because to because boxing is not required. retrieve a value we must cast it as its actual type, because it will be returned via object reference.4.Difference between array and stack S.No Array Stack 1 An array can be multi- Stack is strictly one-dimensional dimensional 2 An array allows direct access With a stack, only the top element to any of its elements is directly accessible; to access other elements of a stack, we must go through them in order, until we get to the one we want5.Difference between Stack and Heap S.No Stack Heap 1 Memory will be allocated at the Memory will be allocated at the run compile time. time. 2 Here the memory is allocated by Here the memory is allocated by the the compiler. user. 3 Memory will be allocated only in Memory will be allocated in sequential sequential locations. locations and non- sequential locations. 4 The memory will also be deleted The memory must be deleted explicitly by the compiler. by the user. 5 There is lot of chance of memory There is no chance of memory wastage. wastage if the memory is handled perfectly.
  • 118. 6.Difference between Array and ArrayList S.No Array ArrayList 1 They are fixed length. They are resizable and variable length 2 They are compiled strong type They are flexible and can collection. accommodate any data types. 3 Because arrays are of fixed size In arraylist lots of boxing and unboxing and strong type collection are done there for its performance is performance is faster. slower. 4 Array is in the System ArrayList is in the System.Collections namespace namespace. 5 Ex:Char[] vowel=new Char[]; Ex:ArrayList a_list=new ArrayList();Reference: Programming Concepts Difference FAQs-21.Difference between for and foreach loopS.No For loop Foreach loop1 In case of for the variable In case of Foreach the of the loop is always be int variable of the loop while be only. same as the type of values under the array.2 The For loop executes the The Foreach statement statement or block of repeats a group of embedded statements repeatedly statements for each element until specified expression in an array or an object evaluates to false. collection.3 There is need to specify We do not need to specify the loop bounds(Minimum, the loop bounds minimum or Maximum). 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)
  • 119. } { j=j+1; Console.ReadLine(); } } Console.ReadLine(); } } }2. Difference between Covariance and ContravarianceS.No Covariance Contravariance1 Converting from a broader Converting from a more type to a specific type is specific type to a broader type called co-variance.If B is is called contra-variance. If B derived from A and B is derived from A and B relates to A, then we can relates to A, then we can assign A to B. Like A=B. assign B to A. Like B= A. This This is Covariance. is Contravariance.2 Co-variance is guaranteed Contra-variance on the other to work without any loss of hand is not guaranteed to information during work without loss of data. As conversion. So, most such an explicit cast is languages also provide required. facility for implicit conversion. e.g. Converting from cat or dog to animal is called contra- e.g. Assuming dog and cat variance, because not all inherits from animal, when features (properties/methods) you convert from animal of cat or dog is present in type to dog or cat, it is animal. called co-variance.3 Example: class Fruit { } class Mango : Fruit { } class Program {
  • 120. delegate T Func(); delegate void Action(T a); static void Main(string[] args) { // Covariance Func mango = () => new Mango(); Func fruit = mango; // Contravariance Action fr = (frt) => { Console.WriteLine(frt); }; Action 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.
  • 121. 3.Difference between IList and IEnumerableS.No IList IEnumerable1 IList is used to access an IEnumerable is a forward only element in a specific collection, it can not move position/index in a list. backward and between the items.2 IList is useful when we IEnumerable does not want to Add or remove support add or remove items items from the list. from the list.3 IList can find out the no of Using IEnumerable we can elements in the collection find out the no of elements in without iterating the the collection after iterating collection. the collection.4 IList does not support IEnumerable supports filtering. filtering.4.Difference between IEnumerable and IQueryableS.No IEnumerable IQueryable1 IEnumerable exists in IQueryable exists in System.Collections System.Linq Namespace. Namespace.2 IEnumerable is best to IQueryable is best to query query data from in- data from out-memory (like memory collections like remote database, service) List, Array etc. collections.3 While query data from While query data from database, IEnumerable database, IEnumerable execute select query on execute select query on server side, load data in- server side with all filters. memory on client side and then filter data.4 IEnumerable is suitable for IQueryable is suitable for LINQ to Object and LINQ LINQ to SQL queries. to XML queries.5 IEnumerable does not IQueryable supports custom supports custom query. query using CreateQuery and Execute methods.6 IEnumerable does not IQueryable support lazy support lazy loading. loading. Hence it is suitable Hence not suitable for for paging like scenarios. paging like scenarios.7 Extension methods Extension methods supports supports by IEnumerable by IEnumerable takes takes functional objects. expression objects means
  • 122. 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 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 IEnumeratorS.No IEnumerable IEnumerator1 The IEnumerable interface IEnumerator provides two is a generic interface that abstract methods and a provides an abstraction for property to pull a particular
  • 123. looping over elements. element in a collection. And In addition to providing they are Reset(), MoveNext() foreach support, it allows and Current The signature of us to tap into the useful IEnumerator members is as extension methods in the follows: System.Linq namespace, void Reset() : Sets the opening up a lot of enumerator to its initial advanced functionality position, which is before the The IEnumerable interface first element in the collection. contains an abstract bool MoveNext() : Advances member function called the enumerator to the next GetEnumerator() and element of the collection. return an interface object Current : Gets the IEnumerator on any current element in the success call. collection2 IEnumerable does not IEnumerator does remember remember the cursor state the cursor state i.e currently row which is iterating through3 IEnumerable is useful IEnumerator is useful when when we have only iterate we have to pass the iterator the value as parameter and has to remember the valueReference: Programming Concepts Difference FAQs-31.Difference between directCast and ctype in .NET S.No DirectCast ctype 1 DirectCast is generally used to Ctype is generally used to cast cast reference types. value types. 2 When you perform DirectCast Exceptions are not thrown while on arguments that dont match using ctype. then it will throw InvalidCastException. 3 If you use DirectCast, you Ctype can cast object of one type cannot convert object of one into another if the conversion is type into another. Type of the valid. Consider the following object at runtime should be example: same as the type that is Dim sampleNum as Integer specified in DirectCast. Dim sampleString as String Consider the following sampleNum = 100 example: sampleString = Dim sampleNum as Integer CType(sampleNum, String)
  • 124. Dim sampleString as String This code is legal and the Integer sampleNum = 100 100 is now converted to a string. sampleString = DirectCast(sampleNum, String) This code will not work because the runtime type of sampleNum is Integer, which is different from the specified type String. 4 To perform DirectCast between To perform ctype between two two different classes, the different value types, no classes should have a relationship between them is relationship between them. required. If the conversion is legal then it will be performed. 5 Performance of DirectCast is Performance wise, ctype is slow better than ctype. This is when compared to DirectCast. This because no runtime helper is because ctype casting requires routines of VB.NET are used execution of runtime helper for casting. routines of VB.NET. 6 DirectCast is portable across Ctype is specific to VB.NET and it many languages since it is not is not portable. very specific to VB.NET2.Difference between Convert.ToString() and object.ToString() S.No Convert.ToString() object.ToString() 1 Convert.ToString(object) does object.ToString() give run time error not give any error in case of if object value is null object value is nullExample:object obj=null;string str=obj.ToTsirng(); //it will give run time errorstring str1=Convert.ToString(obj); // it will run, not give any error3.Difference between String.Equals(string1,string2) and string1.Equals(string2) S.No String.Equals(string1,string2 string1.Equals(string2) ) 1 String.Equals(string1,string2) If any of strings value is null, will not throw any error if any of string1.Equals(string2) will throw strings value is null runtime errorExample:try{string str1 = null;
  • 125. string str2 = "abc";bool chk; chk = str1.Equals(str2); // will give runtime errorchk = String.Equals(str1, str2); //will not give any error}catch (Exception ex){MessageBox.Show(ex.Message);}4.Difference between catch(Exception objex) and catch() block S.No catch(Exception objex) catch() block 1 catch(Exception objEx) will catch() will catch all types of catch only .net compliance exception i.e., both non-compliance exceptions . and .net compliance exceptions5.Difference between "Convert" class and "Parse()" method S.No Convert Class Parse() method 1 The Convert class is used to The Parse method is used to convert any value from any convert only one string value to any data type to another data type. other data type. Every data type is This class consist of different consisting of parse() method. methods for making conversions. 2 Example: Example: 1) char ch = 1) int x = int.Parse("600"); -> string Convert.ToChar("x"); -> string to int to character 2) char ch = char.Parse("dnf"); -> 2) float f = string to character Convert.ToSingle(45); -> int to float 3) int x = Convert.ToInt(4.5f); -> float to intReference: Between ref and out parametersDifference between Ref and Out parameters S.No Ref Out 1 Ref parameters are both input Out parameters are only for output and output - a value is passed - a value is passed out of a method into a method and a new value is passed out
  • 126. 2 An argument passed to ref out argument does not have to be parameter must be initialized explicitly initialized. 3 Ref parameter may be written Out parameter must be written to to before returning from before returning from method method 4 Ref parameter may be Out parameter may not be referenced inside method referenced inside method before before being written to being written toExample for ref parameter :class Program{static void M1(ref int i){i = 1;i += 1;}static void Main(string[] args){int j=0; //AssignedM1(ref j);Console.Write(j);Console.Read();}}The output is same: 2, but we have to assign the variable before used otherwise we willget an error.Example for out parameter :class Program{static void M1(out int i){i = 1;i += 1;}static void Main(string[] args){int j; //Not assignedM1(out j);Console.Write(j);Console.Read();}}
  • 127. }The output is : 2Summary:1. Both are treated differently @ runtime but same in the compile time, so can’t beoverloaded.2. Both are passed by references except ‘ref’ requires that the variable to be initializedbefore passed.Reference: between Checked and Unchecked keywords in .NETDifference between Checked and Unchecked keywords in .NET S.No Checked keyword Unchecked keyword 1 The checked keyword is used The unchecked keyword is used to to explicitly enable overflow suppress overflow-checking for checking for integral-type integral-type arithmetic operations arithmetic operations and and conversions. conversions. i.e.,Unchecked Keyword is used to i.e., Checked Key word is used enforce the compiler to do not to enforce the compiler to check that is there any buffer check the buffer overflow while overflow or Not. operating arithmetic operators. 2 If there is any Buffer overflow If here any Buffer overflow is code will throw exception. occurred it will just truncate the value but not throw exceptionExample for Checked keyword:static void Main(string[] args){int _value1 = 1500056564;int _value2 = 1200046565;checked{// this Code will give exception BuferOverflowSystem.Console.WriteLine(_value1 * _value2); System.Console.Read();}}Example for Unchecked keyword:static void Main(string[] args){int _value1 = 1500056564;
  • 128. int _value2 = 1200046565;unchecked{// This Code will Not Give ExceptionSystem.Console.WriteLine(_value1 * _value2);System.Console.Read();}}Note: Both the Checked and Unchecked keywords control whether or not an exception willbe thrown when an operation causes a number to overflow.Reference: between Clone and CopyTo methods in .NETDifference between Clone and CopyTo methods in .NET S.No Clone CopyTo 1 Clone method returns a new CopyTo method copies elements of array containing all elements the array into an existing array. copied from the array on which Elements will be copied into a clone method is called. specific index and its increments. 2 The array size of the Array size of the destination array destination array need not be has to be declared before mentioned. triggering copyTo method. 3 If the array size declared is Array size should be large enough smaller to fit in elements, the to fit both existing array elements array size will automatically and the elements to be copied. If grow based on the number of the size is smaller than the actual elements that are getting number of elements, then you will copied. get the following error while performing CopyTo: "Destination array was not long enough. Check destIndex and length, and the arrays lower bounds."Here is an example of Clone method:class sampleClass{public static void Main() {int[] array1 = new int[] {10,20,30};int[] array2 = array1.Clone() as int[];for(int i=0;iConsole.Write(array2[i]+" ");}}
  • 129. }Output of this code will be:10 20 30Here is an example of CopyTo method:class sampleClass{public static void Main() {int[] array1 = new int[] {10,20,30};int[] array2 =new int[array1.Length];array1.CopyTo(array2,0);for(int i=0;iConsole.Write(array2[i]+" ");}}}Output of this code will be:10 20 30Note: Both the Clone and CopyTo methods belong to System.Array namespace.Reference: between Int and Int32Difference between Int and Int32 S.No Int Int32 1 Int is a datatype which has Int32 is the alias of Int following three types, Int16 Int32 Int64Summary:Both int and int32 are same . So there is no real difference between them .To make it userfriendly ,int32 is given alias name as int.Reference: between Constructor and Destructor in C#Difference between Constructor and Destructor in C# S.No Constructor Destructor 1 It is a special type of method It will be executed automatically which will be executed while destroying object
  • 130. automatically while creating an object 2 Constructor name must be The name of destructor must be same as class name with out same as class name with a ~(tilde) return type prefix and with out return type and with out access specifiers 3 Syntax: Syntax: public class_name() ~class_name() { { } } 4 These are overloadable These are not overloadable 5 These are used to initialize the It is used to de-allocate the variables to open files or memory database connection etcReference: between Boxing and Unboxing in C#Difference between Boxing and Unboxing in C# S.No Boxing Unboxing 1 Meaning: Meaning: Boxing is the process of Unboxing is the process of converting a value type to the converting a reference type to reference type. value type. 2 Type of Conversion: Type of Conversion: Implicit Conversion Explicit Conversion 3 Example: Example: int i = 1; object obj = 123; object obj = i; //boxing i = (int)obj ; // unboxingReference: between Implicit Conversion and Explicit ConversionDifference between Implicit Conversion and Explicit Conversion S.No Implicit Conversion Explicit Conversion 1 Implicit Conversion perform In some cases we have to perform automatically in VB.NET, that conversions , that is the compiler
  • 131. is the compiler is taking care of does not automatically convert a the conversion and therefore type to another . These type of does not require any special conversion is called Explicit syntax in the source code. conversion . An explicit conversion uses a type conversion keyword, eg.CType ,CInt ,CStr etc., With these conversion keywords we have to perform the Explicit ConversionExample for Implicit Conversion:Dim K As IntegerDim Q As Double ...K = 432 Integer widens to Double, so Option Strict can be On.Q=KIn the above example, Visual Basic .NET implicitly converts the value of K to single-precision floating point before assigning it to Q.Example for Explicit Conversion:Dim K As IntegerDim Q As Double ...K = 432 Integer widens to Double, so Option Strict can be On.Q=KQ = Math.Sqrt(Q) Q had been assigned the value 432 from K.K = CInt(Q) K now has the value 21 (rounded square root of 432).In the above example, the CInt keyword converts the value of Q back to an integer beforeit is assigned to KReference:
  • 132. HTML Difference FAQs-11.Difference between HTML 4 and HTML 5 S.No HTML 4 HTML 5 1 HTML 4 uses common HTML5 uses new structures such structures like headers , as drag, drop and much more footers 2 HTML 4 cannot embed video HTML 5 can contain embedded or audio directly. HTML 4 video and audio without using flash makes use of flash player for it player 3 HTML 4 has traditional API’s HTML 5 introduced many new which does not include canvas API’s which facilitate flexibility of and content editable API’s web pages 4 In HTML 4, local storage is not In HTML 5, new tags and new possible and tags that can features like local storage are handle only one dimension are enhanced present 5 HTML 4 cannot handle HTML 5 is capable of handling inaccurate syntax inaccurate syntax2.Difference between HTML and DHTML S.No HTML DHTML 1 HTML site work slowly upon DHTML sites works faster upon client-side technologies. client-side technologies 2 HTML is static in nature DHTML is dynamic in nature 3 HTML files are saved with .htm DHTML files are saved with .dhtm extension extension 4 HTML does not make use of DHTML uses events, methods and any methods for making it much more for providing dynamism dynamic. HTML content is for HTML pages always static 5 HTML pages does not require DHTML requires processing from any processing from browser browser which changes its look and feel3.Difference between HTML and XHTML S.No HTML XHTML 1 HTML is an application of XHTML is an application of XML SGML
  • 133. 2 Attribute minimization and tags XHTML does not support omission is supported in HTML minimization of attributes and omitting tags 3 In HTML, document row In DHTML, row headings will be in headings will remain in normal bold font 4 In HTML, tbody portion will be DHTML does not contain tbody and in the dom tree shape and also t’th element second selector should match the ‘t’th element 5 HTML is not case sensitive XHTML is case sensitive 6 In HTML, document body In DHTML, html element is element is specified rather specified and document body than html element element does not replace it4.Difference between HTML and PHP S.No HTML PHP 1 In HTML the output remains For PHP, the output may not be the same as that of input same all the time 2 In HTML, browser cannot The output of PHP is HTML code interpret the code which the browser can interpret 3 HTML does not involve PHP PHP includes both PHP and HTML codes 4 HTML can create webpages PHP can design dynamic that are only static webpagesReference: between HTML and XML1.Difference between HTML and XML S.No HTML XML 1 Abbreviation: Abbreviation: HTML stands for HyperText XML stands for eXtensible Markup Markup Language Language 2 Purpose: Purpose: To display information and to To describe information and and to focus on how data looks. focus on what data is.
  • 134. 3 Tags: Tags: In HTML, tags are predefined In XML,tags are user defined 4 Rule on Attribute Values: Rule on Attribute Values: Quotes are not required for the Quotes required around attribute values of attributes values 5 Rule on Empty Tags: Rule on Empty Tags: Slash not required Slash required in empty tags 6 Case sensitiveness: Case sensitiveness: HTML is case insensitive XML is case sensitive. 7 Rule on End Tags: Rule on End Tags: End tags are not always End tags required for well formed required. documents. In a well formed document, elements can be defined as single tag or a pair of tags 8 Reusability and Reusability and Extensibility: Extensibility: Xml documents are reusable and Html document does not extensible supports reusability and extensibility 9 Data Interchange: Data Interchange: Not possible Possible 10 Content Type: Content Type:,Content is not,Content is changed changed every time when the every time when the page is page is reloaded reloadedReference:
  • 135. IIS vs ASP.NET Development ServerDifference between IIS and ASP.NET Development Server S.No IIS ASP.NET Development Server 1 Security Context : Security Context : In Internet Information In ASPNET Development Server, it Server(IIS), it is typically is determined by who has logged IUSR_MachineName. into our computer. i.e., IIS by default runs under i.e., Development server only ASP.NET account. accepts authenticated requests on the local computer as it runs under the security context of currently authenticated user account. It means it doesn’t run under less privileged ASPNET account. 2 Accessing Static Pages : Accessing Static Pages : In IIS, we can access static In ASP.NET Development Server, pages in a secure folder if we we can not access static pages in a are not logged in. secure folder if we are not logged in. 3 Serving Requests: Serving Requests: It will serve pages to another ASP.NET Development server can computer besides local only serve local requests. requests. 4 Support for e-mail sending Support for e-mail sending functionality or file functionality or file download download functionality: functionality: IIS provides support for e-mail ASP.NET Development Server sending functionality or file does not have protocols like SMTP download functionality by using or FTP and hence it does not protocols SMTP and FTP. support e-mail sending functionality or file download functionality.Reference: 5.0 vs IIS 6.0Difference between IIS 5.0 and IIS 6.0 S.No IIS 5.0 IIS 6.0 1 IIS 5.0 uses operating system IIS 6.0 uses both 32bit and 64 bit with 32 bit architecture. architecture.
  • 136. 2 IIS 5.0 has binary metebase IIS 6.0 has XML configuration. configuration. 3 IIS clustering provides cluster IIS 0.6 windows support the support in IIS 5.0. clusters. 4 The platform used by IIS 5.0 is IIS 6.0 uses Windows Server 2003 windows 2000. family.IIS vs ApacheDifference between IIS Web Server and Apache Tomcat Server S.No IIS Web Server Apache Tomcat Server 1 IIS webserver is operating Apache webserver is operating system dependent. It runs in system independent. only windows environment. i.e., Apache can run on almost any OS including UNIX, Apple’s OS X, and on most Linux Distributions. 2 IIS is developed by Microsoft. Apache is developed by Apache Foundation . 3 IIS server runs in user space Apache server runs in user space and Kernal space. only. 4 IIS is not Open Source. Apache webserver is open source. i.e., Apache is known to be open source because the source code is available for configuration as per our requirements, its a linux based product. 5 IIS is both webserver and Apache tomcat server is only application server. webserver. 6 IIS has a dedicated staff to Support for Apache comes from the answer most problems. community itself.Reference:
  • 137. JavaScript Difference FAQs-11.Difference between PHP and JavaScript S.No PHP JavaScript 1 PHP runs on server and the JavaScript can handle only local major functionality of PHP is to tasks that are specific. produce the HTML code which will be read by browser. 2 In PHP, code will be available In JavaScript the code can be only after the server interprets viewed even after the output is it. interpreted. 3 PHP is embedded only with JavaScript can be combined with HTML and PHP cannot be HTML, XML and AJAX. combined with XML. 4 PHP is used to produce web JavaScript can import files of pages on the go, read and information available by mentioning deploy databases, import the the URL of the file in the address files available on the server, bar of the browser. and gain files of data from further domains. 5 PHP does not execute within a JavaScript executes within a browser’s window. browser’s window. 6 PHP commonly uses MYSQL MYSQL is not commonly used by as a database. JavaScript.2.Difference between JScript and JavaScript S.No JScript JavaScript 1 JScript is released by JavaScript is released by Netscape Microsoft. in partnership with Sun Microsystems 2 JScript is reverse engineered JavaScript is a newly formed from Javascript by Microsoft in language. order to have its own ECMAScript language. 3 Microsoft’s JScript is a JavaScript is a language language openly implemented independent of the Java language on the lines of Netscape’s of Sun Microsystems. JavaScript. 4 JScript is used for creating JavaScript is used for developing active and also online content client applications and server for WWW. applications.
  • 138. 5 All versions of JScript have Very few versions of JavaScript access to ActiveX objects. have access to ActiveX objects.3.Difference between Java and JavaScript S.No Java JavaScript 1 Java is termed as an Object JavaScript is a Scripting Language. Oriented Programming language. 2 Java was originally created by Netscape,Inc. has developed the James Gosling belonging to JavaScript programming language. Sun Microsystems. 3 Standalone applications and Standalone applications or applets applets are created by Java are not created by JavaScript. programming language. 4 Java is known for the creation JavaScript code always needs a of applications that can run on browser for its execution. a browser but it does not always require a browser for program execution. 5 Java code can survive on its JavaScript should be placed own as a stand alone Java through a HTML document for its Program. functioning. 6 Java code should always be JavaScript code is always in text compiled. and it does not need compilation process.Reference: between == and === in JavaScriptDifference between == and === in JavaScript S.No == === 1 == denotes equal to === denotes exactly equal to including both value and type 2 0= =false // true 0= = =false // false, because they are of a different type 3 1= ="1" // true, auto type 1= = ="1" // false, because they are coercion of a different typeSummary:
  • 139. JavaScript has both strict and type-converting equality comparison. For strict equalitythe objects being compared must have the same type and also the belowcharacteristics:• Two strings are strictly equal when they have the same sequence of characters,same length, and same characters in corresponding positions.• Two numbers are strictly equal when they are numerically equal (have the samenumber value). NaN is not equal to anything, including NaN. Positive and negativezeros are equal to one another.• Two Boolean operands are strictly equal if both are true or both are false.• Two objects are strictly equal if they refer to the same Object.• Null and Undefined types are == (but not ===).Reference: between "setTimeout" function and setInterval functions in JavascriptDifference between "setTimeout" function and setInterval functions in Javascript S.No SetTimeout function SetInterval function 1 setTimeout is only execute the setInterval, will call the function in function after the defined time each time interval. in milleseconds, its execute only one time.Reference: between undefined value and null valueDifference between undefined value and null value S.No undefined value null value 1 Undefined value cannot be null value has keyword called null. explicitly stated i.e., there is no keyword called undefined 2 Typeof undefined variable or Type of null value returns object. property returns undefinedReference:
  • 140. Difference between onSubmit and onClick events in JavaScriptDifference between onSubmit and onClick events in JavaScript S.No onSubmit() onClick() 1 Event Category: Event Category: onSubmit() is a form event. onClick() is a mouse event. 2 When it occurs: When it occurs: This event occurs when we try This event occurs when a user to submit a form. clicks mouse left button. 3 When to use: When to use: We can put our form validation We can put our validation, warning against this event type. etc against this event type.Reference: vs JavaScriptDifference between VBScript and JavaScript S.No VBScript JavaScript 1 Definition: Definition: VBScript is an Active Scripting JavaScript is an object-oriented language,which uses the scripting language used to enable Component Object Model to programmatic access to objects access elements of the within both the client application environment within which it is and other applications. running. 2 Who developed ? Who developed ? VBScript is developed by JavaScript is developed by Microsoft. Netscape. 3 Client-side / Server-side Client-side / Server-side scripting language: scripting language: It is both Client and server side It is client side scripting language. scripting language. 4 Case sensitive or not: Case sensitive or not: It is not case sensitive. It is case sensitive. 5 Runs on which browser ? Runs on which browser ? VBScript runs only on IE Javascript runs on any browser 6 Default scripting language or Default scripting language or
  • 141. not: not: It is the not the deault scripting It is the default scripting language language.It must be specified for most web browsers. as the scripting language. 7 How to denote functions in How to denote functions in VBScript ? JavaScript ? It uses Function and End It uses curly braces to denote Function to denote functions. functions. 8 Same / Different Character Same / Different Character used used for different actions: for different actions: It uses different characters for It uses the same character (+) for different actions.example: & for both addition and concatenation. concatenation and + for addition. 9 File Extension: File Extension: File extension for VBScript is File extension for JavaScript is .js. .vbs or .vba.Reference:
  • 142. jQuery Difference FAQs-11.Difference between body.onload() function and document.ready() function used injQuery S.No body.onload() document.ready() 1 We can have only one onload We can have more than one function document.ready() function in a page 2 body.onload() function is called document.ready() function is called when everything gets loaded as soon as DOM is loaded on the page that includes DOM, images and all associated resources of the page.2.Difference between jquery.size() and jquery.length S.No jquery.size() jquery.length 1 jquery.size() is slower than jquery.length is faster than jquery.length jquery.size() 2 size() is a method length is a propertySummary:jquery.size() and jquery.length both returns the number of element found in theobject. jquery.size() is slower than jquery.length as there is always an overhead incalling a functionReference:$get vs $find in jQueryDifference between $get and $find in jQuery S.No $get $find 1 Shortcut Method: Shortcut Method: $get is the shortcut method for $find is the shortcut method for document.getElementById. “Sys.Application.findComponent(id, parent)”. 2 Signature used: Signature used: Signature of $get is Signature of $ind is $get(id, element) $find(id, parent)
  • 143. 3 Suitable Controls: Suitable Controls: When we want to retrieve Controls which are extender normal ASP.NET controls like controls cannot be retrieved textbox, checkbox, button etc through $get. So, Extender we can use $get. controls like ValidatorCalloutExtender, AutoCompleteExtender etc can be retrieved using $find.Reference: between Json Array and Json ObjectDifference between Json Array and Json Object S.No Json Array Json Object 1 A JSONArray is an ordered A JSONObject is an unordered sequence of values. collection of name/value pairs. 2 Its external text form is a string Its external form is a string wrapped in square brackets wrapped in curly braces with with commas separating the colons between the names and values. values, and commas between the values and names.Example for Json Array[ {"ircEvent": "PRIVMSG", "method": "newURI", "regex": "^http://.*"}, {"ircEvent": "PRIVMSG", "method": "deleteURI", "regex": "^delete.*"}, {"ircEvent": "PRIVMSG", "method": "randomURI", "regex": "^random.*"}]Example for Json Object{"bindings": [ {"ircEvent": "PRIVMSG", "method": "newURI", "regex": "^http://.*"}, {"ircEvent": "PRIVMSG", "method": "deleteURI", "regex": "^delete.*"}, {"ircEvent": "PRIVMSG", "method": "randomURI", "regex": "^random.*"} ]};Reference:
  • 144. vs jQuery.each()Difference between jQuery .map and .each S.No jQuery.each() 1 Used as: Used as: The map method can be used The each method is meant to be as an iterator. used as an immutable iterator. 2 What it returns ? What it returns ? Map function returns a new Each function returns the original array array. 3 Callback arguments used: Callback arguments used: map(arr, function(elem, index) each(arr, function(index, elem) {}); {});Note: If we overuse the return value of the map function we can potentially waste a lot ofmemory.Reference: vs jQuery.filter()Difference between find() and filter() in jQuery S.No jQuery.find() jQuery.filter() 1 What it does ? What it does ? Searches through all the child Searches through all elements in elements in the matched set. the matched set 2 Description: Description: Get the descendants of each Reduce the set of matched element in the current set of elements to those that match the matched elements, filtered by selector or pass the functions test. a selector.
  • 145. 3 Syntax: Syntax: .find( selector ) .filter( selector ) selector: A string containing a selector: A string containing a selector expression to match selector expression to match the elements against. current set of elements against. .find( jQuery object ) .filter( function(index) ) jQuery object: A jQuery object function(index): A function used as to match elements against. a test for each element in the set. this is the current DOM element. .find( element ) element: An element to match .filter( element ) elements against. element: An element to match the current set of elements against. .filter( jQuery object ) jQuery object: An existing jQuery object to match the current set of elements against.Reference: vs jQuery.html()Difference between append() and html() in jQuery S.No jQuery.append() jQuery.html() 1 .append() add some value with .html() do the same as like the existing one. .append() but it removes the old value.Here is an example given to understand the practical difference between .append() and.html(),<ul id="test"><li>test</li></ul>Now if .append() is used to add one <li>,as given below<script type="text/javascript>" jQuery("#test").append("<li>test1</li>"); </script>The output of this jQuery will be <ul id="test"> <li>test</li> <li>test1</li> </ul>Now if .html() is used to add one <li>,as provided below<script type="text/javascript>" jQuery("#test").html("<li>test1</li>"); </script>The output of this Script will be <ul id="test"> <li>test1</li> </ul>Here in this example .append() add one extra <li>, whether .html() removes the old onewith new one. This is the main difference between .append() and .html() in Jquery
  • 146. Reference: vs JQuery.children()Difference between find() and children() in jQuery S.No Jquery.find() Jquery.children() 1 What it does ? What it does ? Search through the matched Search through the matched elements’ child, grandchild, elements’ child only (single level great-grandchild…any levels down). down.Summary:Both find() and children() methods are used to filter the child of the matched elements,except the former is travels any level down, the latter is travels a single level down.Reference: array vs numerical array sortingDifference between sorting string array and numerical array in jQuery S.No jQuery.sort() for string array jQuery.sort() for numerical array 1 sort() method sorts the string sort() method does not sort the array in alphabetical order. numerical array in proper order. This is because sort method sorts on the basis of the ASCII values .Hence,the numerical values are not sorted correctly with the sort() method i.e., it considers the ASCII value of the first numerical digit of all numerical values for sorting purposes. 2 To sort string array, there is no To sort numerical values correctly, need to define a comparison we must define a comparison function with sort().But, it is function with sort(). better to have all uniform names. That is, they must Note: Please look at the points begin with either uppercase or below for comparison function lowercase, but not mixed case. process.If we define a comparison function, then a pair of values from the array will be repeatedlysent to the function until all elements of the array are processed. In the comparisonfunction, we thus write a statement considering the pair of values passed to it so that thefunction returns any of the following three values: <0 or="or">0.
  • 147. • When the function returns value is less than(<) 0, the second value of the pair of array values sent to the function is larger than the first value and hence must be pushed down the sorting order. • When the function returns value >0, the first value is larger than the second value, so it must be pushed down the sorting order. • When the function returns value =0, it means there is no need to change the sort order since the two values are same.Example: jQuery.sort() for string array$(document).ready(function() { var list= [ "jQuery", "Dojo", "JavaScript", "Ajax"]; $(#alltech).html(list.join("")); list = list.sort(); $(#sorted).html(list.join(""));})Results:List of Client side technologiesjQueryDojoJavaScriptAjaxList of Client side technologies in sorted orderAjaxDojoJavaScriptjQueryExample: jQuery.sort() for numerical array without using comparison function$(document).ready(function() { var list= [ 45, 32, 98, 24, 16, 9, 3]; $(#allnumber).html(list.join("")); list = list.sort(); $(#sorted).html(list.join(""));})Results:Numbers in Array before sorting4532
  • 148. 98241693Numbers in Array After sorting162433245998Well, the numerical values are not sorted correctly with the sort() method because asmentioned earlier that it considers the ASCII value of the first numerical digit of allnumerical values for sorting purposes. To sort numerical values correctly, we must define acomparison function with sort().Example: jQuery.sort() for numerical array with comparison function$(document).ready(function() { var list= [ 45, 32, 98, 24, 16, 9, 3]; $(#allnumber).html(list.join("")); list = list.sort(function(a,b){ return a-b; }); $(#sorted).html(list.join(""));})Results:Numbers in Array before sorting453298241693Numbers in Array After sorting391624
  • 149. 324598Reference: vs jQuery.delegate()Difference between jQuery live() and delegate() S.No jQuery.delegate() 1 Whether it can be used with Whether it can be used with chaining or not ? chaining or not ? live() cannot be used with delegate() can be used with chaining .So, the below thing chaining as provided below, cannot be done, $ $ (‘#foo’).children(‘table’).delegate(‘tr’ (‘#foo’).children(‘table’).find(‘td’ , ‘click’, function(){ ).live(‘click’, function(){ blah blah... blah blah... }); }); 2 Performance: Performance: Live() default context is In delegate we can set context document…. so it bubble till which cause less traverse document which cause the performance issue. $(‘#mytable’).delegate(‘a’,‘click’, function(){ But, in jQuery 1.4 , option is blah blah... provided to define context for }); live other than document as given below, $(‘a’, $(‘#mytable’) [0]).live(‘click’, function(){ blah blah... }); Note: Context is defining the search limit to bubble to top level of element.Summary: 1. Both live() and delegate() are used to attach event to current element and future elements which we append after DOM loaded e.g. we load some table rows using ajax. 2. By considering performance factor,so it is better to use delegate all the time instead of live() and bind().
  • 150. Reference: vs pageX/Y in jQueryDifference between jQuery mouse event clientX/Y & pageX/Y S.No ClientX/Y PageX/Y 1 What is the function of this What is the function of this event event ? ? It gives us x,y offset of the It gives us x,y offset of the mouse mouse click point relative to click point relative to top left of the top left browsers view port document regardless of the regardless of the scrolling. For scrolling. example, our browser window view port size 1024x820 px, the maximum value of clientX/clientY would be 1024 px/820 px irrespective of the document size.Example:$(document).click(function(e){alert(e.clientX);alert(e.clientY);alert(e.pageX);alert(e.pageY);});Reference: vs mouseleave() in jQueryDifference between mouseout and mouseleave in jQuery S.No mouseout() mouseleave() 1 Does it bubble the event ? Does it bubble the event ? By deault, in mouseout there is In mouseleave the events bubble no event bubbling. by default.Example:Consider the following example,
  • 151. 1. When we point the cursor of the mouse over the red area where the div is and there is an attached event listener for mouseout of that div, something like divElement.onmouseout = doSomething;, where this is of course pseudo code, and 2. When we point the mouse over the a-tag yet again the mouseout of the div doesn’t fire.That’s because of the event bubbling in JavaScript where if one element receives theevent, in this case the a tag has the mouse over it, the event bubbles to the parentelement and then to the parent of the parent and so forth to the document root.Why $.mouseout does not bubble the event ?In JQuery the mouseout doesn’t bubble and there comes the problem with the schemafrom the image. If we have,$(div).mouseout();and we point to the a-tag even it is inside the div, the mouseout event fires. Now thisseems strange. Our mouse is over that element but jQuery says us that it is out!What is the solution for event bubbling to take place automatically ? ORWhich event can be used to handle the above scenario ? ORWhich event can replace the mouseout to handle the above scenario?This is easy and mouseleave helps us enter with the mouse over the a-tag and still themouseleave event doesn’t fire. But if we move the mouse outside the div and we point thebody, now this seems normal.Reference:
  • 152. LINQ Difference FAQs-11.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 To use SQL we need to be familiar upon our .Net Language with SQL syntaxes and also the syntaxes and also we can pre-defined functions of SQL like consume base class library MAX,MIN,LEN and SUBSTRING functionalities. etc... 4 LINQ Statements can be As SQL statements execute on debugged as they execute Database server debugging of the under framework environment. code 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 It can generate db from model. 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 DataContext. esql,object services,entity client and linq to entities.Another Good Reference:
  • 153. between LINQ and Stored Procedures S.No LINQ Stored Procedures 1 As LINQ is part of .NET, we It is really very hard to debug the can use visual studio’s Stored Procedure debugger to debug the queries 2 With LINQ everything gets With Stored Procedures, we need complied into single DLL hence to provide an additional script for deployment becomes easy. deployment 3 LINQ is type safe, so queries Stored Procedures are not type errors are type checked at safe i.e., error can be caught only compile time.It is really good to during runtime. encounter an error when compiling rather than runtime exception! 4 LINQ supports multiple With Stored Procedures which databases need to be re-written for different databases. 5 LINQ supports abstraction As Stored Procedures does not which allows framework to add support abstaction , so it is difficult additional improvements like to add additional impovements like multi threading. It is much multi threading simpler and easier to add this support through LINQ than Stored Procedures. 6 LINQ queries need to compile Stored Procedures are ster thn before execution.Therefore, LINQ because they are LINQ is slower than Stored precompiled i.e., Stored Procedures. 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 intermediate LINQ provider or API. Context object is the bridge
  • 154. between LINQ and the database. 2 LINQ to SQL returns data of LINQ to Objects returns data of type IQueryable type IEnumerable. 3 LINQ to SQL is translated to LINQ to Objects does not need to SQL by way of Expression be translated. Trees, 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 LINQ to Objects is executed in the SQL 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 Supports Conceptual Data Model Data Model 2 Does not support Storage Supports Storage Schema Schema 3 Does not support Mapping Supports Mapping Schema Schema 4 Does not support New Data Supports New Data Access Access Provider Provider 5 Does not support Non-SQL Supports Non-SQL Server Server Database Support Database 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 Supports Single Entity from from Multiple Tables Multiple TablesReference:
  • 155. Linq difference faqs-21.Difference between LINQ to SQL and ADO.NET S.No LINQ to SQL ADO.NET 1 Used for data handling with Used for data handling with any SQL Server databases only. database: SQL Server/Access/Oracle/Excel etc. 2 Uses the extension methods of Does not use the extension System.Linq.Queryable class. methods of System.Linq.Queryable class. 3 Introduced in .net Framework It is there since the .net Framework 3.0 1.0 4 DataContext is used for SqlConnection/OleDbConnection Database connectivity. are used for database connectivity 5 Syntax and coding is Easier syntax and coding. somewhat 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 nHibernate is an ORM tool 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 largel applications where there is is no massive dependence on massive dependence on databases. databases. 5 With LINQ, database already With nHibernate, database does exists and the relationships not already exist and it needs to be and some programming will be defined . dependent on how the database is defined.
  • 156. 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 LINQ to SQL Entity FrameworkReference: Difference FAQs-31.Difference between First() and Single() extension methods in LINQ S.No First() Single() 1 There is at least one result, an There is exactly 1 result, no more, exception is thrown if no result no less, an exception is thrown if is returned. no result is returned.2.Difference between FirstOrDefault() and SingleOrDefault() extension method inLINQ S.No FirstOrDefault() SingleOrDefault() 1 It gets the first item that If we specify this extension method matches a given criteria. that means we are specifically saying that there can be only one value that matches the criteria. If there are more then 1 value that matches the criteria, throw an exception.3.Difference between Count() and LongCount() extension methods in LINQ S.No Count() LongCount() 1 Count() has a lesser range LongCount() has a greater range than LongCount() than Count(). long.MinValue = long.MinValue = -2,147,483,648 -9223372036854775808 long.MaxValue = long.MaxValue = 2,147,483,647 9223372036854775807
  • 157. 2 Its DotNet Framework type is Its DotNet Framework type is System.Int32 System.Int64Example for Count():public static long display(){var tempval = (from h in objDB.tbl_mvc_loginselect h).Count ();return tempval;}Example for LongCount():public static long display(){var tempval = (from h in objDB.tbl_mvc_loginselect h).LongCount ();return tempval;}Summary:They both does the same thing .If we want to count something which is quite big then wehave to use LongCount() extension method otherwise we can use Count().Reference: between findall() and where() in LINQDifference between findall() and where() in LINQ S.No findall() where() 1 FindAll() is a function on the Where() works on any type that List type i.e., it can only be implements IEnumerable used on List instances (or instances of classes that inherit from it, of course). It is not a LINQ extension method like Where().So,if our collection is IEnumerable type, then we cannot use FindAll() as its a function of List. 2 The FindAll method of the List The Where extension method for class actually constructs a new IEnumerable will simply iterate over list object, and adds results to an existing list and yield an it. enumeration of the matching
  • 158. results without creating or adding anything (other than the enumerator itself.) 3 As findall() creates a list before Where is much faster than FindAll. creating query, hence it is No matter how big the list is, slower than Where() Where takes exactly the same amount of time because Where() just creates a query, It doesnt actually do anythingSuppose we have a class Person :public class Person{public string FirstName { get; set; }public string LastName { get; set; }}Now, create an object of person class :Person person = new Person();Take a List of person class :List lstPerson = new List();Now, assign values to this class and add it to list :person.FirstName = "FirstName1";person.LastName = "LastName1";lstPerson.Add(person);person.FirstName = "FirstName2";person.LastName = "LastName2";lstPerson.Add(person);Now, we want to find all the records where FirstName = "FirstName1".To do this, we have two options : FindAll() and Where()FindAll() :List result = lstPerson.FindAll(delegate(Person per){return per.FirstName == "Firstname1";});Where() :List result = lstPerson.Where((Person per) => per.FirstName == "FirstName1").ToList();Reference:
  • 159. Difference between Skip() and SkipWhile() extension methods in LINQDifference between Skip() and SkipWhile() extension methods in LINQ S.No Skip() SkipWhile() 1 Skip() will take an integer SkipWhile() continues to skip the argument and skips the top n elements as long as the input numbers from the given condition is true. Once condition IEnumerable turns false it will return all remaining elements.2.Signature of Skip ():public static IEnumerable Skip( this IEnumerable source, int count);3.Example:int[] numbers = { 5, 4, 1, 3, 9, 8, 6, 7, 2, 0 };var firstNumbersLessThan6 = numbers.Skip(3);In this example, the Skip method will skip the first 3 items from the collection and returnthe remaining items as an IEnumerable collection.So the output of this example will be 3, 9, 8, 6, 7, 2 and 0.2a.Signature of SkipWhile ():public static IEnumerable SkipWhile( this IEnumerable source, =unc predicate);2b.Another signature for overriding:public static IEnumerable SkipWhile( this IEnumerable source, Func predicate);3a.Example I:int[] numbers = { 5, 4, 1, 3, 9, 8, 6, 7 };var remaining = numbers.SkipWhile(n => n < 9);In this example the SkipWhile operator will skip the items from the starting position untilthe conditions fails. Once the condition has failed then it will return the remaining items asan IEnumerable collection.So the output for this example is 9, 8, 6 and 7.3b.Example II:int[] numbers = { 5, 4, 1, 3, 9, 8, 2, 0 };var indexed = numbers.SkipWhile((n, index) => n > index);In this example the SkipWhile method will skip the items greater than their positions.
  • 160. So in this example the output is 1, 3, 9, 8, 2 and 0. Because the position of the 1 is 2 sohere the condition fails.Reference: vs TakeWhile()Differences between Take() and TakeWhile() extension methods in LINQ S.No Take() TakeWhile() 1 Meaning: Meaning: The Take (int...) method of The TakeWhile (Func...) will return System.Linq.Queryable class elements starting from the returns the portion of a source beginning of an IEnumerable i.e. an IEnumerable collection collection until it satisfies the of a source with the first n condition specified. If the condition number of items from the is false then it will return the source. collection immediately. 2 Signature of Take (): Signature of TakeWhile (): http://www.c- http://www.c- bd951/how-to-use- 1/how-to-use-taketakewhile-and- taketakewhile-and- skipskipwhile-in- skipskipwhile-in- linq/Images/Linq2.gif linq/Images/Linq1.gif Another signature for overriding the method: http://www.c- 1/how-to-use-taketakewhile-and- skipskipwhile-in- linq/Images/Linq3.gifExample for Take() extension method:int[] numbers = { 5, 4, 1, 3, 9, 8, 6, 7, 2, 0 };var firstNumbersLessThan6 = numbers.Take(5);In the above example the Take method returns an IEnumerable collection with only the first5 items as we have specified in the Take argument.I.e. it will return 5, 4, 1, 3 and 9 only.Examples for TakeWhile() extension method:
  • 161. Example I:int[] numbers = { 5, 4, 1, 3, 9, 8, 6, 7, 2, 0 };var firstNumbersLessThan6 = numbers.TakeWhile(n => n < 9);In the above example the TakeWhile will return the collection of items when the conditionfails. i.e. if the control reaches the item 9 then the condition fails here so it will return theitems from 5 to 3 [5, 4, 1, 3].Quick Note:Even though the collection has the items which are less than 9 such as 8,6,7,2,and 0 but itreturned only 5,4,1 and 3. The point here is the TakeWhile wont consider the items whichare the item which makes the condition fail.Example II:String colection = { "one", "two", "three", "four", "five" };var strings = collection.TakeWhile(n => n.Length < 4);In this example, the TakeWhile will return the string collection having a length of 4characters i.e. it will return only the "one" and "two" because the length of the "three" is 5so it fails there.Example III:String colection = { "one", "two", "three", "four", "five" };var strings = collection.TakeWhile((s, index)=> s.Length > index );In this example the TakeWhile will return the items starting from the beginning of the arrayuntil a string length is greater than its position in the collection.So this example will return "one" and "two". Because the "three" has the length of 5 and itsposition [index] is 2. Since 2 is less than 5 the condition fails at "three".Reference: vs SQL KeywordsDifference between LINQ and SQL Keywords C# LINQ VB LINQ ANSI SQL let Let AS Count(), Sum(), Aggregate COUNT, SUM,… with no group … Skip() Skip n/a
  • 162. SkipWhile() Skip While n/a Take() Take n/a TakeWhile() Take While n/a orderby Order By ORDER BY group Group By GROUP BY Distinct() Distinct DISTINCTNote:Select ,From,Where,Join and Into keywords have the same name in C# LINQ,VB LINQand ANSI SQL.Reference:
  • 163. Difference between ViewData,ViewBag and TempData in MVC 3.0Difference between ViewData,ViewBag and TempData in MVC 3.0 ViewData ViewBag TempData ViewData is a ViewBag uses the dynamic Temp data use during dictionary of feature that was added in to the current and objects that are C# 4.0 It allows an object to subsequent request only accessible using dynamically have properties means it is use when strings as keys added to it. We can say you are sure that next ViewBag=ViewData + request will be dynamic wrapper around the redirecting to next view. ViewData dictionary.Example for ViewData:ViewData[“JustLearn”]=”Just Learn on is rock!!”Example for ViewBag:ViewBag.JustLearn =”Just Learn on is rock!!”Example for TempData:TempData[“JustLearn”]=”Just Learn on is rock!!”Reference: 2 vs MVC 3 in ASP.NETDifference between MVC 2 and MVC 3 in ASP.NET S.No MVC 2 MVC 3 1 View Engines: View Engines: MVC 2 uses only Web Forms The view engines used in the view engine (.aspx). ASP.NET MVC 3 Framework are the Razor View Engine (.cshtml or .vbhtml) and the Web Forms view engine (.aspx). 2 Chart, WebGrid, WebImage, Chart, WebGrid, WebImage, WebMail Controls: WebMail Controls: Not Available Available 3 Objects available for sharing Objects available for sharing data between View and data between View and Controller: Controller: TempData, ViewData TempData, ViewData ,ViewBag 4 Web Forms view engine Razor View Engine syntax:
  • 164. syntax: @Html code <%=Html code %> 5 Support for jQuery: Support for jQuery: Good Better 6 Support for Dependency Support for Dependency Injection: Injection: Good Better 7 Support of Layouts: Support of Layouts: Only Master Page (.master) Both Master Page (.master) and Layout Page (_Layout.cshtml)Note:Master pages are the same if we are using the .aspx view engine. If we are using Razor,then its the Layout page.Reference: 2.0 vs ASP.NET MVC 4.0Difference between Grails 2.0 and ASP.NET MVC 4 S.No Grails 2.0 ASP.NET MVC 4.0 1 Meaning: Meaning: Grails is an open source web The ASP.NET MVC Framework is application framework which a web application framework that uses the Groovy programming implements the model-view- language (which is in turn controller (MVC) pattern. based on the Java platform). It is intended to be a high- Based on ASP.NET, it allows productivity framework by software developers to build a Web following the "coding by application as a composition of convention" paradigm, three roles: Model, View and providing a stand-alone Controller. development environment and A model represents the state of a hiding much of the particular aspect of the application. configuration detail from the A controller handles interactions developer. and updates the model to reflect a change in state of the application, and then passes information to the view. A view accepts necessary information from the controller and renders a user interface to display that. 2 Community Support: Community Support: No. Grails is built on Groovy Yes. MVC 4 may be built on .NET
  • 165. which is a dynamic language VB or .NET C#. The usage of C# that compiles into byte-code seems to be growing versus VB that runs on the Java virtual according to job machine. Unfortunately, the trends. Therefore, in the number of Groovy developers comparison with Grails, this in the world are far comparison is focused on MVC outnumbered by the number of 4 .NET C#. The C# open source C, C++, VB, C#, and Java community is very large. It is not developers. quite the size of Java or C/C++, but it is global. 3 Cost of Development: Cost of Development: Yes. Grails is much cheaper to No. The cost of development is develop and deploy. It is basically free if Visual Studio 2011 conceivable that the cost of Express is considered sufficient development and deployment (Note: In this case Visual Studio is free since it can be done Professional is used). The cost of with open source tools and deployment is likely more than platforms. depends on the amount of data that is required to be stored and the number of users that would be connecting. 4 OS knowledge required or OS knowledge required or not ? not ? No. The .NET framework is Yes. Since Grails runs in a affected by system updates to the JVM, there is little to no Windows operating system. While relationship between the JVM it is possible to separate the .NET and the operating system. specific updates from the rest of the operating system updates, that is a hassle. Also, due to the success of the .NET framework for Microsoft over past ten years, it has become more intertwined with the operating system. As a result, it is not always clear where .NET begins and and the operating system ends. Therefore, at the very least, ASP.NET MVC 4 requires Windows operating system knowledge and research for each patch deployment...that is an ongoing cost that is arguably greater than that of maintaining a JVM.Reference:
  • 166. Spring vs ASP.NET MVCDifference between Spring and ASP.NET MVC S.No Spring ASP.NET MVC 1 Meaning: Meaning: The Spring Framework is an The ASP.NET MVC Framework is open source application a web application framework that framework and Inversion of implements the model-view- Control container for the Java controller (MVC) pattern. platform. Based on ASP.NET, it allows software developers to build a Web application as a composition of three roles: Model, View and Controller. A model represents the state of a particular aspect of the application. A controller handles interactions and updates the model to reflect a change in state of the application, and then passes information to the view. A view accepts necessary information from the controller and renders a user interface to display that. 2 Global Preference: Global Preference: 12% 67% 3 Official Website: Official Website: 4 License: License: Apache License,GPL2 Proprietary 5 Development Principles: Development Principles: Convention over configuration Convention over configuration,Test- driven development 6 Design pattern: Design pattern: Dependency injection Active-Record,Model-View- Controller,Dependency injection 7 Operating system: Operating system: Cross-platform Windows 8 Programming language: Programming language: Java C#, JavaScript,VB.NET,F# 9 Database: Database: MSSQL MSSQL
  • 167. MySQL MySQL PostgreSQL Oracle Oracle SQLite SQLite PostgreSQL IBM DB2 IBM DB2 JDBC Compatible MongoDB Microsoft SQL Server 2005 Teradata Cassandra 10 Template language: Template language: JSP RazorEngine JSTL ASPX HTML5 Velocity 11 Target audience: Target audience: Enterprise Enterprise,SMB 12 Difficulty level: Difficulty level: Intermediate Beginner Advanced Intermediate Advanced 13 Programming paradigm: Programming paradigm: Aspect-oriented programming Object-oriented 14 Scripting language support: Scripting language support: Groovy JavaScript JavaScript PHP Ruby 15 Object-Relational Mapping: Object-Relational Mapping: Hibernate, iBatis, more ORM-independent 16 Testing Framework(s): Testing Framework(s): Mock objects, unit tests Unit tests, Functional Tests, Integration Tests 17 DB Migration Framework(s): DB Migration Framework(s): N/A Entity Framework 18 Security Framework(s): Security Framework(s): Spring Security (formerly ASP.NET Forms Authentication Acegi) (Default), Pluggable 19 Form Validation Form Validation Framework(s): Framework(s): Commons Yes (client-side via plugins) validator, Bean ValidationReference:
  • 168. Ruby on Rails vs ASP.NET MVCDifference between Ruby on Rails and ASP.NET MVC S.No Ruby on Rails ASP.NET MVC 1 Meaning: Meaning: Ruby on Rails, often The ASP.NET MVC Framework is shortened to Rails, is an open a web application framework that source full-stack web implements the model-view- application framework for the controller (MVC) pattern. Ruby programming language. Rails is a full-stack framework, Based on ASP.NET, it allows meaning that it gives the web software developers to build a Web developer the ability to gather application as a composition of information from the web three roles: Model, View and server, talk to or query the Controller. database, and render A model represents the state of a templates out of the box. As a particular aspect of the application. result, Rails features a routing A controller handles interactions system that is independent of and updates the model to reflect a the web server. change in state of the application, Ruby on Rails emphasize the and then passes information to the use of well-known software view. A view accepts necessary engineering patterns and information from the controller and principles, as Active record renders a user interface to display pattern, Convention over that. Configuration, Dont Repeat Yourself and Model-View- Controller. Note: Ruby on Rails is not to be confused with Ruby, which is a general-purpose programming language, on which Ruby on Rails runs. Ruby itself existed for more than 10 years before the first release of Ruby on Rails. 2 Global Preference: Global Preference: 25% 67% 3 Official Website: Official Website: 4 License: License: MIT License Proprietary 6 Design pattern: Design pattern: Active-Record,Model-View- Active-Record,Model-View- Controller Controller,Dependency injection 7 Operating system: Operating system:
  • 169. Linux Windows Mac OS X Windows QNX 8 Programming language: Programming language: Ruby C#, JavaScript,VB.NET,F# 9 Database: Database: MSSQL MSSQL MongoDB MySQL MySQL Oracle PostgreSQL SQLite Drizzle PostgreSQL Oracle IBM DB2 Redis SQLite 10 Template language: Template language: ERB RazorEngine HAML ASPX Erubis Radius 11 Target audience: Target audience: Enterprise Enterprise,SMB Web Development 12 Difficulty level: Difficulty level: Beginner Beginner Intermediate Advanced 13 API: API: Basic Good 14 Scripting language support: Scripting language support: Ruby JavaScript JavaScript coffeescript 15 Object-Relational Mapping: Object-Relational Mapping: ActiveRecord ORM-independent 16 Security Framework(s): Security Framework(s): Plug-in ASP.NET Forms Authentication (Default), PluggableReference:
  • 170. OOPs Difference FAQs-1 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 overloads 2. What are the differences between const and readonly? S.No const readonly 1 It cannot be static It can be instance level or static 2 It is evaluated at design time It is evaluated at run time 3 It is initialized at declaration It is initialized at declaration or in constructor 4 It must be of integral type or In addition, it can have complex types enumeration with new keyword and enumerations are not allowed 3. What are the Differences between Abstract Class and Interface? S.No Abstract Class Interface 1 Default Implementation: Default Implementation: In Abstract Class we can provide Interface has only signature, we default implementation. cannot provide implementation in interface. 2 Inheritance/Implementation: Inheritance/Implementation: A class can inherit only one A Class can implement any number of abstract class Interfaces 3 When to use ? When to use ? We go for Abstract classes on We go for Interface on such situations such situations where we need to where we need to give common give common functionality for functionality for group of un-related group of related classes classes 4 Default Implementation Default Implementation Pros/Cons: Pros/Cons: If we add a new method, then we need If we add a new method, then we to change all the existing work can provide a default implementation and so no need to make any change to existing work 5 Constants type support: Constants type support: Static and Instance constants are Only Static constants are possible possible
  • 171. 6 Support for Automatic Support for Automatic Properties: Properties: Interface cannot have automatic Abstract class can have automatic properties. We need to implement all properties. the properties defined in interface into all it’s implementors. 7 Access Modifiers (public, Access Modifiers (public, private, private, protected, internal, protected, internal, protected protected internal): internal): Abstract Class can have access Interface does not have access modifiers for subs, functions, modifiers for subs, functions, properties properties. Everything defined inside the interface is assumed public modifier 8 Purpose: Purpose: Abstract Class suits to implement Interface suits to implement peripheral core requirements that is shared requirements. i.e. both person and among common type of objects. vehicle class can implement IRun i.e. Person abstract class can be interface. inherited by Manager, Supervisor, Clerk, Administrator… 9 Support for Data Fields: Support for Data Fields: Abstract class can have data Interface cannot contain data fields. fields. However in .NET we can have abstract properties in interface. However just like methods we need to implement those abstract properties inside the implementor class. 10 Performance: Performance: An abstract class is fast Interfaces require more time to find the actual method in the corresponding classes. Hence it is slower than abstract class.4. What are the differences between Structure and Class? S.No Structure Class 1 It is value type It is reference type 2 It is stored on stack It is stored on heap 3 It does not support inheritance It supports inheritance 4 It is suitable for small data It is suitable for complex data structure usually where structures where inheritance, inheritance, overriding is not overriding is required required or we need to create objects example: int a=100; example: DataSet,ArrayList can handle large data.
  • 172. 5 this pointer it will not work in this pointer will work only in class. structure. 6 Structure cannot be declared as Class can be declared public as well private or protected. as private. 7 Structure contains only data Class contains both data member and member member function 8 Default access specifier for Default access specifier for class is structure is public private 9 Structure does not require Class requires constructor constructor 10 Structures are Objects created from classes are not destroyed using GC. terminated using Garbage collector. 11 Faster in access. Not faster in access than structure. 12 Supports only interface Supports both implemenation and inheritance. interface inheritance. 13 They do not have destructors Classes have destructors 14 They do no have explicit They can have explicit parameterless parameterless constructors constructors 15 We cannot put sealed /abstract Sealed/abstract modifers can be put modifiers before the structures. before classes. 16 Easier memory management Comparitively Difficult memory management 17 examples: int, examples: short,long,DateTime, SqlConnection,DataView(predefined Point (predefined) classes)5. What are the differences between property and indexer? S.No Property Indexer 1 Identified by its name. Identified by its signature. 2 Accessed through a simple name Accessed through an element access. or a member access. 3 Can be a static or an instance Must be an instance member. member. 4 A get accessor of a property has A get accessor of an indexer has the no parameters. same formal parameter list as the indexer.
  • 173. 5 A set accessor of a property A set accessor of an indexer has the contains the implicit value same formal parameter list as the parameter. indexer, in addition to the value parameter.6. What are the differences between overloading and overriding? S.No Overloading Overriding 1 Same name in same / derived We need to provide different class but with different / type of implementation than base class parameter 2 Has different signature Has same signature 3 Otherwise called Compile-time Otherwise called Run-time Polymorphism 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.Reference type variable will hold object reference. 3 Life time of value type is Lifetime of reference type is managed determined by lifetime of variable by .net framework that contain them 4 Examples: All numeric data type, Examples: All arrays, String, Class Boolean, char, Date, Structure, types, Delegate enumerations 5 Value types do not accept null Reference type variables can hold null value. Value types can be made to values. accept null values by using null coalescence operator. 6 Value types cannot be inherited. Reference types can be inherited. 7 Value types other than structure Class and Interface of Reference types cannot implement interfaces. can implement interfaces. 8 Boxing is performed to convert You can directly assign a reference value type to an object and type to an object and an object to a unboxing is performed to convert reference type without boxing and an object into a value type. unboxing. 9 Value type is inherited from Reference type is inherited from System.ValueType namespace System.Object directly. which is inherited from System.Object.
  • 174. 10 When one value type variable is When one reference type variable is assigned to another, both value assigned to another, both reference type variables will contain same type variables will be referencing to the data but independent copy. same object. If one reference type Changing value of one value type changes value of the object then the variable will not impact value of other reference type variable will also the other value type variable. point to the modified object. 11 CLR (Common Language Memory management of reference Runtime) does not perform types is automatically done by CLR. memory management of value types. 12 Value types are primitive data Reference types are not primitive in types. nature. Reference types deal with objects. 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.Reference: Difference FAQs-2Difference between Events and DelegatesS.No Events Delegates1 Event can be used in an Delegate cannot be used in an interface definition interface definition2 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
  • 175. S.No Class Object1 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 Object is in the RAM and not code and resides in hard disk. visible in source code.3 Class is like a template or It is the real world blueprint of the object. It implementation of the class. implements Each object has its own copy of reusability,encapsulation, data. inheritance4 Example:Button is a class with Example: Button1, Button2 are properties like Text,BackColor, the objects of Button class. events like click, methods like Focus5 We can create subclasses We cannot create sub-objectsDifference between Private and Static ConstructorS.No Static constructor Private constructor1 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.Difference between properties and methodsS.No Properties Methods1 Properties are used to Methods are used to performs actions represent data2 Properties are created by using Methods create like public void getter and setter i.e., get{} and method1(parameter list here) set{}
  • 176. Difference between Singleton Pattern and static classS.No Singleton Pattern static class Singleton pattern maintains We cannot create instance for static single instance. class.2 A singleton can extend classes A static class cannot . and implement interfaces. Note: It can extend classes, but it does not inherit their instance members.3 A singleton can be initialized A static class is generally initialized lazily 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 when Class object instantiated have no instance but multiple between server and client, such a references. 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 also provides sort of a not accomodate any future design mechanism to control object changes as by design static classes creation based on various are rigid and cannot be extended. requirements. They can be extended as well if need arises. In other words we are not always tied to a particular implementation. With Singleton we have the flexibility to make changes as when situation demands.Reference:
  • 177. OOPs Difference FAQs-31.Difference between Abstraction and Encapsulation S.No Abstraction Encapsulation 1 Abstraction solves the problem Encapsulation solves the problem in the design level. in the implementation level. 2 Abstraction is used for hiding Encapsulation means hiding the the unwanted data and giving code and data into a single unit to relevant data. protect the data from outside world. 3 Abstraction allows us to focus Encapsulation means hiding the on what the object does internal details or mechanism of instead of how it does it how an object does something. 4 Abstraction- Outer layout, Encapsulation- Inner layout, used used in terms of design. in terms of implementation. For Example:- For Example:- Inner Outer Look of a Mobile Phone, Implementation detail of a Mobile like it has a display screen and Phone, how keypad button and keypad buttons to dial a Display Screen are connected with number. each other using circuits2.Difference between Composition and Aggregation S.No Composition Aggregation 1 Defines a strongly-coupled Defines a weakly-coupled relationship between two relationship between two entities, entities, where the one entity is where one entity could be part of part of another, and both need another, but either can exist without each other for their existence. the other, independantly. 2 e.g. Human body and the e.g.School and teacher. Heart. 3 Composition implies real Aggregation does not necessarily ownership of its components own any of its aggregates. 4 Composition has a stronger Aggregation has weaker or looser bond of its components. bonds with its aggregates. 5 Composition has components Aggregation has aggregates that that exist at the inner level. live at the outer level.3.Difference between Private Class and Sealed Class S.No Private Class Sealed Class 1 A Private class can only be A Sealed class can be accessed by
  • 178. accessed by the class it is defined any class.Private Constructor of a and contain within - it is Private Class = Sealed Class. completely inaccessible to outside classes. 2 In private Class,we can create a In Sealed class we can not create a constructor and therefore we can constructor of that class, so no create an instance of that class. instance of that class is possible. 3 The main use of Private class is The sealed classes are mainly used to to create a user-defined type, prevent inheritance features of object which we want to be accessible to oriented programming. that class only.Note: Private class(i.e private constructor) is also used to implement singletonclasses(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."Example for Private Class:public class A { private class B { } B b = new B(); }public class C { A.B b = new A.B(); // ERROR }Example for Sealed Class:public sealed class A { }public class B : A //ERROR { }4.Difference between Static Class and Sealed Class S.No Static Class Sealed Class 1 We can neither create their We can create their instances, but instances, nor inherit them cannot inherit them 2 They can have static members They can contain static as well as only. nonstatic members. 3 Static classes are used when a The sealed classes are mainly
  • 179. class provides functionality that used to prevent inheritance is not specific to any unique features of object oriented instance. programming.Example for Static Class:static class Program{}Example for Sealed Class:sealed class demo{}class abc:demo{--Wrong}5.Difference between Virtual method and Abstract method S.No Virtual method Abstract method 1 Overriding : Overriding : Virtual method may or may not An abstract method should be override by inherited class. overriden by inherited class. i.e.,Virtual method provide the i.e.,Abstract method forces the derived class with the option of derived class to override it. overriding it. Virtual = = Overridable abstract == MustOverride 2 Implementation: Implementation: Virtual method has an Abstract method does not provide an implementation. implementation. 3 Necessity to Implement: Necessity to Implement: Virtual methods allow subclasses Abstract methods in a class contain to provide their own no method body, and are implicitly implementation of that method virtual using the override keyword 4 Scope : Scope : Virtual methods scope to Abstract methods scope to members members only. and classes 5 Instancing : Instancing :
  • 180. Virtual methods - Not applicable, Abstract method - directly NO, but as we cant create instance for other way,Yes.We can create an members, it is possible only with instance of a class that derives from classes. an abstract class. And we can declare a type Abstract class and instantiate that as a derived class.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"); } }6.Difference between Class and Static Class S.No Class Static Class 1 Class has Instance Members Static class does not have Instance Members 2 In Class, Constructor has Access In Static Class, Constructor does not Specifier. have Access Specifier. 3 In Class Constructor, initiation is In Static Class ,Constructor will be done every time when an object called only one time is created for the class 4 In Class, Class members can be In Static Class, members can be accessed through class object. accessed through its Class name only
  • 181. 7.Difference between Method Overloading and Method overriding in C# S.No Method Overloading Method Overriding 1 Method Overloading is passing Method Overriding is redifining parent same message for different class function to the child class functionality 2 Method Overloading is between Method Overriding is between the the same function name with the same method. different signature 3 Method Overloading does not Method Overriding checks the return check for the return type. type. 4 Method Overloading takes place Method Overriding takes place in the same class. between parent and child classes 5 Method Overloading is static Method Overriding is a dynamic binding binding.Reference: Difference FAQs-41.Difference between String and StringBuilder S.No String StringBuilder 1 String class belongs to the StringBuilder class belongs to the namespace System. namespace System.Text. 2 String class is immutable. StringBuilder class is mutable. Immutable means that the Consider the following example: string cannot be changed. class sampleClass { Consider the following public static void Main() { example: StringBuilder sampleSB = new class sampleClass { StringBuilder("Hai",10); public static void Main() { sampleSB = new string sampleStr = "Hai"; StringBuilder("Hello"); sampleStr = "Hello"; Console.WriteLine(sampleSB); Console.WriteLine(sampleStr); } } } } Output of this code will be: Output of this code will be: Hello Hello In this example, you are doing the In this example, you have same thing. But the string "Hai" will created a string called be overwritten as "Hello" and no sampleStr. You have initially new strings will be created in the assigned the value "Hai". And memory.
  • 182. then you try to overwrite its value with "Hello". You get the overwritten value as output. But the problem lies in the number of strings that get created in memory. When you create the string as "Hai", this string gets created in the memory. When you try to change the value to "Hello", instead of overwriting the existing "Hai" string it will create a new string in the memory and assign this new string "Hello" to sampleStr.3 You can directly assign a string You cannot directly assign a string to string class instance. For to StringBuilder instance. For example, example, String sampleStr = "Hai" is StringBuilder sampleSB = "Hai" will valid. lead to the following error: "cannot implicitly convert type string to System.Text.StringBuilder " You can assign a string to StringBuilder using the following statement: StringBuilder sampleSB = new StringBuilder("Hai");4 String concatenation is done String concatenation is done using using + operator. Here is an Append method. Here is an example: example: class sampleClass { class sampleClass { public static void Main() { public static void Main() { string sampleStr = "Hello!"; StringBuilder sampleSB = new sampleStr += " Good Day!"; StringBuilder("Hello!"); Console.WriteLine(sampleStr); sampleSB.Append("Good } Day!"); } Console.WriteLine(sampleSB); Output of this code will be: } Hello! Good Day! } Here you have used += Output of this code will be: operator to perform both Hello! Good Day! concatenation and assignment using single operator. You can also use + and = separately as shown below: sampleStr = sampleStr + " Good Day!";
  • 183. 5 During string concatenation, During string concatenation, additional memory will be additional memory will be allocated allocated. if and only if the string buffers capacity is reached. 6 During string concatenation, If the number of concatenations to additional memory will be be done is random or not known, allocated if and only if the then it is recommended to use string buffers capacity is stringBuilder reached. 7 You cannot set a limit You can set a limit to StringBuilder (specifying how many strings using the member called capacity can be concatenated) to a which will by default have the value string object using string class. 16. You can override it to any number. The maximum value acceptable is equivalent to MaxValue of Int32. If you feel that you do not want to reserve 16 as the capacity then you can very well redefine it. However the capacity will dynamically grow based on the number of strings that you append. Here is an example demonstrating the usage of capacity: class sampleClass { public static void Main() { StringBuilder sampleSB = new StringBuilder(); Console.WriteLine( sampleSB.Capacity); sampleSB.Capacity = 1; Console.WriteLine( sampleSB.Capacity); sampleSB.Append("str1"); sampleSB.Append("str2"); Console.WriteLine( sampleSB.Capacity); } } Output of this code will be: 16 1 82.Difference between Delegate and Interface S.No Delegate Interface 1 Delegates can only be Interface can include both methods. Here is an example: properties and methods.
  • 184. delegate void Here is an example for an sampleDelegate(); interface: interface ItestInterface { int paraml { get; set; } void sampleMethod(); }2 Delegate can be applied to When a class implements an only one method at a time interface, it can implement all the methods associated with it3 You can use a delegate that is You can use an interface only visible in your scope when your class or struct implements it4 Within a class, you can Within a class, you can implement implement the same delegate an interface method only once. In any number of times. Assume Example2, interface ITestInterface that either sampleClass1 or has a method called sampleClass2 of Examplel sampleMethod(). When includes a method called sampleClass1 implements sampleMethod2( ) with the ITestInterface it implements same signature as that of sampleMethod() only once. If not, delegate, then the same then it will end up in error. delegate can be used to access both sampleMethod() as well as sampleMethod2( )5 Delegate can implement any When an interface method is method that shares the same implemented, same method name signature as that of the and signature has to be overridden delegate6 Delegate is mainly used for Interfaces are not used for handling handling events events7 You need not bother about the When a class implements an other methods available in the interface, though the class requires class.You are concerned about only one method it has to only the method that matches implement all the methods of the delegate signature. interface8 To access a method using To access the method, you need delegate, you need not require an instance of the class which any access to the instance of implements the interface or you the class where the method is need an interface reference defined pointing to the method implemented by the class9 You can access anonymous You cannot access anonymous methods using delegates methods.Only named methods declared in interface can be
  • 185. accessed by the implementing class. 10 When you call a method using When you are calling a method a delegate, all the method using interface reference, you are pointers associated with the directly accessing the method of delegate will be scanned the class that implements the through before the method interface. This is a direct method execution. This is not a direct call and it doesnt have any method call as you assume. It overhead. has a considerable performance overhead. 11 Delegates can wrap methods Accessing sealed types is not of sealed classes.Sealed permissible in interface. classes are those which cannot be inherited. 12 Delegates can wrap any Class can implement any number method matching its signature of interfaces and it should override irrespective of which ever class only the methods belonging to the method belongs to those interfaces 13 Delegates can wrap static This provision is not available with methods. Examplel discussed interfaces . above has used the delegate to wrap a static method called sampleMethod() 14 Delegate cannot involve in Interface can inherit other inheritance. interfaces. When a class implements that interface, it has to implement all the methods belonging to the interface and its inherited interfaces as well. Here is an example of an interface inheriting from other interfaces: interface IInterface: IInterface,1 IInterface2 { void sampleMethod1(); void sampleMethod2(); s}Example1: Using Delegatedelegate void sampleDelegate( );class sampleClass1{static void sampleMethod( ) {Console.WriteLine(“Executing sampleMethod of sampleClass1”);}}
  • 186. class sampleClass2 {static void Main( ) {sampleDelegate dele1 = new sampleDelegate(sampleClass1.sampleMethod);dele1();}}Example2: Using Interfaceinterface ITestInterface{void sampleMethod( );}class sampleClass1 : ITestInterface {void sampleMethod( ) {Console.WriteLine(“Executing sampleMethod of sampleClass1”);}}class sampleClass2 {static void Main( ) {sampleClass1 obj1 = new sampleClass1( );obj1.sampleMethod( );}}3.Difference between Virtual and Abstract keywords in .NET S.No Virtual Abstract 1 If you feel that the derived But if you want to enforce that class may or may not override derived class must override the the base class method, then base class method then you will you will define the base class define the base class method as method as virtual. Consider the abstract. following example: namespace Application1 { namespace Application1 { public abstract class abstractClass public class virtualClass { { public virtual void public abstract void virtualMethod(){ abstractMethod(); Console.WriteLine("Virtual } Method.."); public class } derivedClass:abstractClass{ } public override void public class abstractMethod(){ derivedClass:virtualClass{ Console.WriteLine("Overridden.."); public override void } virtualMethod(){ } Console.WriteLine("Overridden public class testClass { .."); public static void Main() { } derivedClass obj = new } derivedClass(); public class testClass { obj.abstractMethod(); public static void Main() { } virtualClass obj = new }
  • 187. virtualClass(); } obj.virtualMethod(); Output of this code will be: derivedClass dObj = new Overridden.. derivedClass(); dObj.virtualMethod(); } } } Output of this code will be: Virtual Method.. Overridden..2 Virtual methods need not be Abstract methods should compulsorily overridden. In the compulsorily be overridden by the above example if the derived derived class. In the above class does not override the example, if the derivedClass does method virtualMethod, then not override abstractMethod, then again the code will work. during compilation you will get the following error: Application1.derivedClass does not implement inherited abstract member Application1.abstractClass.abstrac tMethod()3 To define a base class method If you want to define a method as to be virtual, you need not abstract in the base class then the include any new definition for base class should also be marked the base class. In the earlier as abstract. Consider the following example, you can see that the example: class virtualClass just includes namespace Application1 { an access modifier followed by public class abstractClass { the class name. No other public abstract void additional modifiers are abstractMethod(); required. } } In this example, abstractClass has an abstract method. Hence the class in itself has to be marked abstract. But it is not done in the above example. Therefore during compilation, you will end up in the following error: Application1.abstractClass.abstrac tMethod() is abstract but it is contained in nonabstract class Application1.abstractClass4 Virtual method can have a Abstract methods have only the method body. In the earlier signature. It cannot have method example, virtualMethod of body. However the abstract class virtualClass has method can include non-abstract methods
  • 188. definition like any of the other and these methods can have methods that you define and it method body defined. Consider the is perfectly legal. following example: namespace Application1 { public abstract class abstractClass { public abstract void abstractMethod(){ Console.WriteLine("Abstract method.."); } } } Here you are trying to include method body for an abstract method. This is not permissible. Hence during compilation you will end up in the following error: "Application1.abstractClass.abstra ctMethod() cannot declare a body because it is marked abstract"5 Class containing virtual Class containing abstract method method can be instantiated. cannot be instantiated. It can only Here is an example: be inherited. Consider the following namespace Application1 { example: public class virtualClass { namespace Application1 { public virtual void public abstract class abstractClass virtualMethod(){ { Console.WriteLine("Virtual public abstract void Method.."); abstractMethod(); } } } public class testClass { Public class testClass { public static void Main() { public static void Main() { abstractClass obj = new virtualClass obj = new abstractClass(); virtualClass(); } obj.virtualMethod(); } } } } Here you are trying to create an } instance of abstract class. This is Output of this code will be: not possible. Hence during Virtual Method… compilation you will end up in the following error: "cannot create an instance of the abstract class or interface Application1.abstractClass"6 Not just methods, virtual Apart from class and method, the modifier can also be used with modifer abstract can be associated properties. with properties, events and indexers.
  • 189. 7 There is a restriction when Abstract modifiers also have a using virtual modifer. You restriction. They cannot be used cannot use this modifer along along with static or virtual or with static or abstract or override modifiers. override modifiers.Reference: vs MethodsDifference between Functions and Methods S.No Functions Methods 1 Functions do not have any Methods are called by reference reference variables variables 2 All data that is passed to a It is implicitly passed the object for function is explicitly passed which it was called 3 It does not have access It has access controlling controlling i.e.,Function(other i.e.,Method should declare and than static functions) declares define in the class only and defines anywhere in the code 4 Function applies to both object Method is only applicable to object oriented and non-object oriented programming language oriented language(procedural like C++, C#, Java etc C, Scripting language eg; JavaScript etc)Summary:A function is just a part of code that executes code and can return something.A method is, in OOP, a function that is bound to a class. As in C# there are no stand-alonefunctions, every function in C# is a methodReference: between Class and ModuleDifference between Class and Module S.No Class Module 1 Meaning: Meaning: A class is a plan which is used A module is a loose grouping to construct objects (instances construct used to group functions of the class). and procedures.
  • 190. 2 Instance Creation: Instance Creation: Instances can be created from Instances cannot be created from a a class in the form of objects module in the form of objects 3 Scope of Class Members: Scope of Module Members: The scope of the members of a The scope of the members of a class is only for the lifetime of module exist for the life of the the object program. 4 Effect on Compilation: Effect on Compilation: Class is compiled into a dll Module is compiled into an exe. 5 Starting Point of Project: Starting Point of Project: Class explicitly need to Module implicitly can be the main mention a starting point of the starting point in a project throughReference: between Method Parameters and Method ArgumentsDifference between Method Parameters and Method Arguments S.No Method Parameters Method Arguments 1 Method parameters get their Method arguments are itself having actual values from the a value. arguments that are specified i.e.,"arguments" refer to values when the method is invoked. bound to those names. i.e.,"parameters" refer to namesExample:using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace Sample{class Program{public static void Main(){int N1 = 10;int N2 = 20;//N1 and N2 are method argumentsint Total = Sum(N1, N2);Console.WriteLine(Total);}
  • 191. //FNum and SNum are method parameterspublic static int Sum(int FNum, int SNum){int Sum = FNum + SNum;return Sum;}}}Note: The arguments must be compatible with the parameter type but the argument nameused in the calling code does not have to be the same as the parameter named defined inthe method which is clear in the above exampleWhere,FNum and SNum are method parameters, andN1 and N2 are method arguments.Reference:
  • 192. Sharepoint Difference FAQs-11.Difference between .NET and Sharepoint S.No .NET Sharepoint 1 Functionality Creation: Functionality Creation: Code need to be written even Lots of pre-defined web parts and to achieve simple functionality elements available.No need to write the code. 2 Coding Effort: Coding Effort: Takes time to create the code Very less time required and test 3 Skilled Professionals: Skilled Professionals: Skilled professionals are Even novice professionals can do required to create the so easily functionality 4 License Requirement: License Requirement: Not required at the time of Free versions available, but in case deployment of solution of extensive requirements License is required2.Difference between Site Template and Site Definition S.No Site Templates Site Definitions 1 Site template approach for Site Definitions are the foundations SharePoint Site Creation is on which all sites and user easier, and just requires the templates are built. Site Definition use of the Web interface and is collection ox XML and .aspx file. occasionally Microsoft Site Definitions are predefined FrontPage. Content can be components needs to be included saved with site template when a site was created in SharePoint server. Site Definition contains information of Web Part , Lists, Features and navigation bars to be included in the site 2 Files are in content database, Files are on disk, better less efficient. performance. 3 Not easily extensible (users Highly customizable and extensible are limited by what UI offers) (XML and .NET code is much more flexible than UI) 4 Can only provide one web Can provide multiple webs
  • 193. 3.Difference between SharePoint 2010 and MOSS 2007 S.No SharePoint 2010 MOSS 2007 1 Look and feel: Look and feel: In SP 2010 look and feel In MOSS 2007 there is no ribbon perspective there will be a ribbon where we can have a look and feel like Office 2010 2 Deployment of Web parts : Deployment of Web parts : In SharePoint 2010 deploying In MOSS 2007 you need to drag custom web part is pretty the dll either to bin or GAC simple i.e. just right click on the solution and click Deploy 3 Silverlight Application: Silverlight Application: In SP 2010 we can create a In MOSS 2007 we have to create a Silverlight application directly web part to host Silverlight from Visual Studio 2010 application 4 Shared Database & Service Shared Database & Service Application: Application: In SP 2010 there is no SSP but In MOSS 2007 we have SSP there is a concept of Service where we can work around with Application like BCS as one BI,Search Settings, User Profile service application, Excel Import, Excel Services, Info path Services as another service In Database also we use to have application, User Profile as separate area for SSP stuff separate service application. General idea is that you have an application for each service, rather than one application with lots of service crammed into it Own database rather than shared database in SP 2010 5 Easy exports/imports Easy exports/imports between between the forms : the forms : In SP 2010 we can update In MOSS 2007 through we can just existing information read the information and we cant update the existing services 6 Improvement in Improvement in Deployment : Deployment :
  • 194. In MOSS 2007 there is no such In SP 2010 we can Deploy option through Farm based and solution based solution in SP 20107 Alerts: Alerts: In SP 2010 alerts were sent In MOSS 2007 alerts were sent only through emails and send only through emails. alerts to mobile device as SMS message. A New property delivery channel is introduced to indicate, whether the alerts is delivered as Email or an SMS message.8 Improvements of events : Improvements of events : New events for list creation No List and web events in MOSS and web creation 20079 Getting Items from the list : Getting Items from the list : In SP 2010 through object In MOSS 2007 we can fetch only model we can fetch multiple list through object model data by LINQ query and object model10 Rating : Rating : In SP 2010 we can have rating In MOSS 2007 we should install column by default the feature that is available in codeplex to have rating11 Key Word Suggestions : Key Word Suggestions : In SP 2010 we can have In MOSS 2007 we don’t have any keyword suggestions keyword suggestions12 Taxonomy : Taxonomy : In SP 2010 we can create In MOSS 2007 we don’t have Taxonomy by using Managed taxonomy Metadata service13 Other Features : Other Features : In SP 2010 we have Power In MOSS 2007 we don’t have Shell Scripting, JavaScript Power Shell Scripting, JavaScript object model, Chart Web Parts object model, Chart Web Parts
  • 195. 14 Running stsadm command : Running stsadm command : In SP 2010 we have to go 14 In MOSS 2007 we have to go 12 hive path to run stsadm hive path to run stsadm command commandReference: 2010 vs SharePoint 2013Difference between SharePoint 2010 and SharePoint 2013 S.No Sharepoint 2010 Sharepoint 2013 1 What is SharePoint 2010 -It is What is SharePoint 2013 a previous or I should say (Preview) - current version of SharePoint A new version of Microsoft famous that was released in year Collaboration portal called 2010. SharePoint. The version adds few new exciting features such as Social Feed,SharePoint Apps and cross-site publishing. 2 Development Changes – Development Changes – • SharePoint 2010 • In SharePoint 2013 Introduced Sandbox Microsoft Introduced a new solutions to help Cloud App Model for developers deploy code designing Apps for that did not effect the SharePoint. Apps for whole farm. SharePoint are self- • In SharePoint 2010 you contained pieces of could use Server Object functionality that extend the model and Client Object capabilities of a SharePoint model (.Net Managed, website. You can use HTML, ECMASCRIPT and CSS, JavaScript and silverlight) to extract protocols like the Open Data data from SharePoint. protocol (OData), and OAuth • In SharePoint 2010 to communicate with developers were also SharePoint using Apps. developing Farm • Tools – SharePoint 2013 has solutions as they did Introduced new Tools for with the previous App development. Visual SharePoint 2007 Studio 2012 now lets you version. develop apps for SharePoint and apps for Office. In addition a new web-based tools called “Napa” Office 365 Development Tools
  • 196. were introduced for developing apps. • No more Sandbox solutions. SharePoint 2013 sandboxed solutions are deprecated. So all we got is the New App model and the Old SharePoint Farm solutions.3 Social and Collaboration Social and Collaboration features -SharePoint 2010 features – had very few social Microsoft in SharePoint 2013 capabilities. Introduced new Social capabilities for better collaboration in the • My sites company.New Features added are • Tags and Tag profile pages • Interactive feed • Notes • Community Site • Follow people • Follow Sites4 Search –SharePoint 2010 had Search -SharePoint 2013 includes Introduced Integrated FAST several enhancements, custom search as an Enterprise content processing with the search. In addition to this build- Content Enrichment web service, in SharePoint search is still and a new framework for widely used in companies. presenting search result types. Some of the features added are – • Consolidated Search Results • Rich Results Framework • keyword query language (KQL) enhancements5 Enterprise Content Enterprise Content Management Management (ECM) (ECM) - -SharePoint 2010 on the other SharePoint 2013 added some of hand had Introduced Managed the best capabilities of an ECM metadata and taxonomy as a software. The newly added stuff is part of new ECM benefits for SP 2010. This version did not • Design Manager had Managed Navigation and • Managed Navigation Cross-site Publishing. • Cross-site Publishing SharePoint designer was a
  • 197. primary tool to modify Master • EDiscovery pages instead of the new Design Manager.Reference: vs Farm SolutionsDifference between Apps and Farm Solutions in SharePoint 2013 S.No Apps Farm Solutions 1 What are apps - What are Farm solutions - Farm An app for SharePoint is a solutions are pieces of functionality small, easy-to-use, stand- that extend the capabilities of a alone app that solves a SharePoint website. They are specific end-user or business Installed to the solution store of a need. farm by a farm administrator. 2 Where does it run – The code Where does it run – They are for an app runs in different Installed to the solution store of a places, depending on where farm by a farm administrator. They your app is hosted.They never run from the sharepoint server. run in the context of SharePoint Server, but they will run in the context of the browser or in the context of the hosted platform. • SharePoint-hosted apps • Provider-hosted and autohosted apps – In the cloud • Apps that have a mix of components in SharePoint and in the cloud 3 How Does It run - When you How Does It run - deploy a SharePoint-hosted when you deploy a Farm solution, app, SharePoint creates a new It gets deployed to one or more website called the app web. web apps (any existing or new You can think of it as a one). You can use it in any site dynamically created safe collection of the web app where
  • 198. space for your app. Besides you deployed it. allowing you to store pages, lists, and libraries, the app web is also an isolated endpoint that your app can securely call client side by using JavaScript.4 Authentication options - Authentication options - The Before you can call SharePoint components in the solution can, APIs from your app, you need and usually do, run in full trust to authenticate to SharePoint. Which authentication mechanism you use depends upon where the code of your app is running. * Inside SharePoint: You have to use HTML and JavaScript, and authentication is already taken care for you. * In the cloud: You have two choices: Use client-side code along with the cross-domain library. User server-side code along with OAuth. *REST APIs5 Resource Allocation - Resource Allocation - No Site collection administrators resource usage restrictions are and tenant administrators can placed on them monitor apps and change the resources allocated to them.6 What Can be Created as What Can be Created as Farm Apps - soltuion - You can deploy almost all the components as Farm • Custom Web Parts solution. (remote pages that contain custom Web Parts) • Event receivers and Feature receivers(remote event receivers) • Custom field (column) types () • Custom web services built on the SharePoint Service Application Framework • Application pages
  • 199. Cannot be created as Apps - • Apps cannot call SharePoint server side code • Apps cannot access SharePoint components that are not on the same site • Apps cannot communicate with each other • Custom site definitions • Custom themes • Custom action groups and custom action hiding • User controls (.ascx files) • Delegate controlsReference: between Asynchronous Event Handler and Synchronous Event Handlerin SharepointDifference between Asynchronous Event Handler and Synchronous Event Handlerin Sharepoint S.No Asynchronous Event Synchronous Event Handler(AEH) Handler(SEH) 1 When it fires: When it fires: AEH will fire after the event is SEH will work before the event is completed. completed 2 Event Cancellation: Event Cancellation: It is not possible to cancel the SEH are mostly used to stop the event from AEH. event from completion in order to validate few things. It means we can cancel the event using SEH 3 Method Names Method Names Identification: Identification: SEH methods has their method AEH method names will end names ending with -ing. with -ed. e.g. ItemAdding, ItemUpdating are e.g.ItemAdded, ItemUpdated SEH methods are AEH methods.
  • 200. 4 To add/modify list fields To add/modify list fields values: values: Possible Not Possible as it fires after the completion of event.Reference: vs OnlineDifference between SharePoint onPremise and SharePoint Online in Sharepoint2010Features Sharepoint Sharepoint OnPremise Online Composites CompositesDeveloper Yes NoDashboardSharePoint Timer Yes NoJobsBusiness Data Yes NoIntegration withthe Office ClientBusiness Yes NoConnectivityServices ProfilePage Content ContentRecords Center Yes NoAudit Opening Yes NoandDownloadingWord Automation Yes NoServices SharePoint SharePoint Insights InsightsBusiness Yes NoIntelligenceCenter
  • 201. Chart Web Parts Yes NoData Connection Yes NoLibraryPerformancePoint Yes No™ServicesDashboards Yes NoDecomposition Yes NoTreeExcel Services Yes NoandPowerPivot forSharePoint SharePoint SharePoint Search SearchAdvanced Yes NoContentProcessingTunable Yes NoRelevance withMultiple RankProfilesBusiness Yes NoIntelligenceIndexingConnectorSharePoint 2010 Yes NoSearch ConnectorFrameworkContextual Yes NoSearchDeep Refinement Yes NoFederated Search Yes NoQuery Yes NoSuggestions, "DidYouMean?” andRelated QueriesRelevancy Tuning Yes No
  • 202. Rich Web Yes NoIndexingEnterprise Scale Yes NoSearchWindows 7 Yes NoSearchSimilar Results Yes NoThumbnails and Yes NoPreviewsVisual Best Bets Yes No SharePoint Sites SharePoint SitesWeb Analytics Yes NoPublic Website Yes Yes (One per site owner)Office Web Apps Yes Yes (Pre-integration configured)Secure Store Yes Yes (Per siteService owner)Reference: vs Farm SolutionsDifference between Sandboxed and Farm Solutions in Sharepoint 2010 S.No Farm Solution Sandboxed Solution 1 Where assemblies are kept ? Where assemblies are kept ? Any assemblies associated with a Assemblies are placed in the solution are extracted, kept in GAC or in the Bin directory of a memory, and executed within a SharePoint web application. special worker process called Assemblies placed in the GAC SPUCWorkerProcess.exe. This are fully trusted,whereas isolates assemblies placed in the bin the execution of sandboxed directoryof a web application solutions from the Operations of can be partially trusted. the underlying web process. Assembly execution takes place in the web Server
  • 203. process (w3wp.exe). 2 Who has authority to install Who has authority to install and and deploy solutions ? deploy solutions ? Solutions must be installed and Solutions can be installed and deployed by a farm deployed by a site administrator . administrator. 3 Is there any limitation on Is there any limitation on Sharepoint classes and Sharepoint classes and objects objects when developing when developing Farm Farm Solution ? Solution ? There are no limitations on Developers must leverage a subset which SharePoint classes and of the SharePoint API when objects can be used in farm developing sandboxed Solutions. solution Assemblies. 4 Throttling of server Throttling of server resources resources can be done or can be done or not ? not ? Farm administrators have the Solutions will use however ability to throttle the server many server resources are resources used by a given solution. necessary.Reference:
  • 204. Silverlight difference faqs-11.Difference between ASP.NET and Silverlight S.No ASP.NET Silverlight 1 ASP.NET is Microsofts Silverlight is Microsoft technology technology for developing for developing Rich Internet dynamic web application Applications. It is a browser plug-in using .NET languages like that allows code from .NET VB.NET or C#. The code is languages to be run in the user’s executed on the web server browsers making it easier to and the results are sent to the develop graphically rich user’s browser. This is applications without having to comparable to the way a web constantly go back and forth site would be done with the between the browser and the PHP language. server. This is comparable to Adobes Flash technology. 2 ASP.NET uses AJAX to Unlike ASP.NET, the bulk of improve performance in the Silverlight processing occurs on the browser by making post backs client machine thus decreasing and calls between the browser server resource utilization and and server asynchronously. improving the Web experience on ASP.NET AJAX uses new built- the client. in types and controls and JavaScript. There is no concept of “Post back” in Silverlight. 3 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 Silverlight is a client-side framework for building dynamic framework geared at providing a web applications. In rich user experience and/or other most processing happens from capabilities such as video the server side. streaming. In Silverlight 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 encompasses a subset of upon the ASP.NET page event functionality from the .NET life cycle, are tightly coupled to Framework and WPF.Silverlight the server. runs in the browser as a "sandbox" - a secure zone installed into the
  • 205. browser that accommodates Silverlight functionality while completely protecting the host platform from any possibly adverse actions performed by Silverlight 6 can be hosted in IIS. Silverlight can be hosted in IIS & Apache. 7 ASP.NET is Microsofts Silverlight is Microsofts competitor competitor to JSP/JSF and the to Adobe Flash and Flex. Basically, successor to classic ASP a 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 Silverlight is prominent for creating creating desktop applications. web based applications. 2 WPF extends support for The advanced features of Windows advanced features of Windows OS namely 3D, complete OS. Few among those features documentation support and are: 3D, complete hardware acceleration are not documentation support and supported in Silverlight. hardware acceleration. 3 WPF includes extensive Silverlight does not support many collection of data binding data binding properties that are properties. 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 Silverlight. through the markup extension support x:type. 5 In WPF, the items that are In Silverlight, the items that are added to the control named added to the control named TabControl will be wrapped TabControl will not be wrapped automatically within the automatically within the TabItem. TabItem. 6 WPF provides routed Silverlight does not provide routed commands and all its controls commands or Command property.
  • 206. are linked to commands using Silverlight provides only an the property called Command. interface 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 Silverlight does not offer input support. binding support.3.Difference between HTML 5 and Silverlight S.No HTML 5 Silverlight 1 HTML5 needs to integrate On the other hand, Silverlight can CSS3 and JavaScript to add its be programmed without getting effects to web pages. error 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 friendly. This is the primary that it consumes a lot of hardware reason which Apple has given resources of our device for 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 older versions of Silverlight in order newer versions of different to get the proper functioning. browsers. 4 HTML5 uses multiple codecs Silver light always needs a plug-in to run videos on the browsers for any case and would not even that are not considered in the run on iPhone and iPad. Apple’s bloc. 5 HTML5 video quality is not that Silverlight offers good video quality crisp as other competitors and and also provide video content of its lack of ability to provide various quality levels on various video content of various quality bandwidths to the user. levels 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 We can simply add the functionality the browsers. to for any browser. 7 While HTML5 being more tilted Silverlight application is not easy to
  • 207. towards open source is a decode relatively 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 provide direct support for these and web cam and thus renders a devices. However there are number of rich interactive some difficult ways to get applications. around this in HTML5. 9 HTML5, like its predecessors Silverlight is not popular in the SEO facilitates search engines to community. At present the content crawl through its content and of Silverlight is not indexed by get maximum exposure for the search website.Therefore,HTML5 is engines.Therefore,Silverlight is not suitable for online business suitable for online business websites or those sites which websites or those sites which require traffic through search require traffic through search engines. 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 binary shape records.In order text based and can be output using to write shape definitions, you a simple XML object. will 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
  • 208. projects, and download that information with the downloader object.5 Only Action Script can be used Rich set of development languages as programming tool in Flash. are available for Silverlight. Developer can use JavaScript as well as managed code VB.Net, C# for Silverlight development6 ActionScript is an imperative XAML is declarative while language, which brings itself ActionScript is imperative. the pitfalls of imperative Using imperative languages to languages build UIs goes back to the early when compared with days of DOS and Windows, when declarative languages. 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 provided by Flash Silverlight Streaming8 Flash is not spread as across Additional Support for mobile the vast majority of both devices with desktop and desktop desktops and mobiles browsers:Silverlight is supported by platforms, as compared to Windows mobile device as part of a Silverlight. Flash requires new service that the NBL have Flash Lite preinstalled on built. Silverlight applications and mobile devices. 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 Silverlight supports scalable video scalable video formats from formats from HD to mobile. HD to mobile11 Flash does not support Silverlight supports Hardware- Hardware-assisted editing and assisted editing and encoding encoding solutions. solutions.12 Flash does not have XAML Silverlight has XAML based based presentation layer for presentation layer for SEO. SEO.
  • 209. 13 Flash does not provide End-to- Silverlight provides End-to-end end server and application server and application platform. platform.14 Media server licensing is Media server licensing is cheaper costlier than Silverlight. than flash.15 Flash does not support Silverlight supports Scalable full Scalable full screen video. screen video.16 This limitation doesn’t exist Silverlight is missing Linux support, with 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 WMV file format.Using the WMV media with far more potential video format essentially makes than any Silverlight useless for the vast other solution that is .flv, no majority of video websites such as doubt Flash has also limitation YouTube. It cannot play .avi and to play other video file. For that .mov file. Flash required codex for that player installed on Client machine.18 Even flash is also lacking this Silverlight has no support for area. Flash can read data binding to models,binding to data, source in terms of XML or text or even connecting to network from some URL and can use it. resources to obtain data. Same thing silverlight also can read.19 Flash has rich set of control Silverlight doesnt even have library. support 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.
  • 210. 22 Flash allows creating XML Socket programming is not Socket object. possible. 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 Silverlight 25 Inbuilt Upload/download Built in file upload/download support is there. support is not available. 26 Flash has a long history that Silverlight is new in market and spans more than ten years, required time to get acceptance in and already got acceptance in market. market and being the most successful browser plug- in ,it is installed on over 90 percent of the world’s web browsers 27 Size of flash component is Size of Silverlight component is smaller. larger. 28 Flash ships in single It has found in practical component that is implementation of image .swf.Images/video/sounds also animation, at some extent flickering incorporated in single occurs on image. .swf package.Reference: Difference FAQs-21.Difference between Custom Control and User Control in Silverlight S.No Custom Control User Control 1 A loosely coupled control w.r.t A tightly coupled control w.r.t code code and UI and UI 2 Derives from Control Derives from UserControl 3 Defines UI in the Defines UI as a normal XAML ResourceDictionary 4 UI can be skinable Child controls can skinable only 5 Has Dynamic layout Has static layout 6 UI can be changed in different UI is fixed and cant have different
  • 211. project look in every project 7 Has full toolbox support Cant be added to the toolbox 8 Defines a single control Defines a set of controls 9 More flexible Not much flexible like Custom Control 10 Requires in depth knowledge Does not require depth knowledge of Silverlight UI Model of UI Model2.Difference between DataContext and ItemsSource property in Silverlight S.No DataContext property ItemSource property 1 DataContext expects an object ItemsSource expects IEnumerable type type objects 2 DataContext is a dependency ItemsSource is defined by the property is exposed by ItemsControl class. All the FrameworkElement base class descendants of FrameworkElement can utilize the DataContext property and set an object to its value. Note: But we can only set a type of IEnumerable(or instance of class that derives from). 3 DataContext does not In terms of ItemsSource property, it generate template, it only used is mainly used to generate to hold common data for other template regardless of you set it in controls to bind. XAML or in the code behind. 4 DataContext is mainly used to But for ItemsSource, it is not used hold common data that other to share data in the visual tree. It is child want to share. Thus it can only valid for the element that be inherited by other child defined. There is still one thing to elements without problem. be noted is that the child element can override the DataContext of the perent DataContext no mater directly or indirectly.Example(s):Suppose we have a Person Class which has a property Name. Now in Xaml we can saylike:
  • 212. If you run this code in the ListBox you will get to see values depending on List object. But ifwe change the ItemsSource to DataContext then you will be not able to see anythingbecause DataContext doesnt generate templates in any cases. If you set datacontext stillyou have to set the ItemsSource property like this:Summary:In a word, if we have several child elements that will share a common data source, we canset DataContext property for the parent elements. And we use ItemsSource forItemsSource in most cased to generate template. Like:3.Difference between Silverlight and Flex S.No Silverlight Flex 1 Execution Mechanism: Execution Mechanism: Power of Native execution of Slow execution for iterative CLR instead of Flashs Action executions Script Interpretator 2 Editing facility: Editing facility: Expression Blend is really cool Flex Builder is not that much good and more advanced editor then editor when compare with Flex Builder Expression Blend 3 Multilanguages Support: Multilanguages Support: Power of other languages, No generics, No other languages, provides Generics and Linq etc No linq. 4 Threading and Threading and Asynchronous Asynchronous Tasks: Tasks: Available Unavailable 5 Form layouting and binding: Form layouting and binding: Binding in Silverlight is way Better in Adobe Flex.The most more cumbersome.Binding easy way to create new requires component naming components, you can have mxml and does not support instance derive from any control and extend expressions like flex does, them with extensive binding. though two way binding is good in silverlight but you have to write long codes for multiple bindings for one math expression. 6 Where primarily used: Where primarily used:
  • 213. Silverlight is used for extremely We use flex for data applications, rich graphics and animation those are simple form processing applications7 Search Engine Friendly: Search Engine Friendly: XAML is Search Engine MXML markup language is not Friendly Search Engine Friendly8 Client / Server Technology: Client / Server Technology: Silverlight can be developed Flex is a client based application for a server or client tool environment.9 Release Date: Release Date: Before it was called Silverlight, Adobe Flex was originally released it was known as Windows in 2004 by Macromedia. The third Presentation version (Flex Builder 3) became Foundation/Everywhere available in 2008. (WPF/E) and was first released in 2007. Silverlight 2 became available in October 2008. Silverlight 3 was released in July 2009.10 Language Differences: Language Differences: Alternatively, Microsoft Adobe Flex uses MXML markup Silverlight uses the XAML language and actionscript to build language as a placeholder for layout/graphic user interfaces. To media files, shapes and create components, it works with images. It works with all .NET ActionScript (the object oriented languages and JavaScript for Flash language). After the code is interactive and component completed, it needs to be compiled features. Completed code is by the Flex Application Server. compiled with the .NET assemblies and compressed into a ZIP file.11 Data Transfer: Data Transfer: No such format for data Data transfer via the proprietary transfer. Will have to stick to AMF using WebORB, Fluorine, etc SOAP and REST web is faster than traditional web services(for now). services.12 Debugging: Debugging: Debugging using Visual Studio Debugging is a bit of a hassle. is very easy.
  • 214. 13 Webservice Access: Webservice Access: Accessing web services is very Accessing web services requires easy. Just add a reference to manual creation of ActionScript the WebService in Visual proxy classes. We can automate Studio and lookup reference.cs this by using FlexTense though. for the good stuff 14 Componenet Size: Component Size: Size of the Silverlight Size of the compiled SWF file is component is larger. smaller than that of the uncompressed Silverlight component.Reference: vs SilverlightDifference between AJAX and Silverlight S.No AJAX Silverlight 1 Meaning: Meaning: Ajax (also AJAX, an acronym Microsoft Silverlight is an for Asynchronous JavaScript application framework for writing and XML) is a group of and running rich Internet interrelated web development applications, with features and techniques used on the client- purposes similar to those of Adobe side to create asynchronous Flash. The run-time environment web applications. With Ajax, for Silverlight is available as a plug- web applications can send in for web browsers running under data to, and retrieve data from, Microsoft Windows and Mac OS X. a server asynchronously (in While early versions of Silverlight the background) without focused on streaming media, interfering with the display and current versions support behavior of the existing page. multimedia, graphics and Data can be retrieved using animation, and give developers the XMLHttpRequest object. support for CLI languages and development tools. Silverlight is also one of the two application development platforms for Windows Phone, but Silverlight enabled web pages cannot run on Internet Explorer for Windows Phone as there is no plugin. 2 Technologied Involved: Technologied Involved: In the article that coined the Silverlight 1 is purely AJAX and term Ajax,Jesse James Garrett JavaScript based. All the code has explained that the following to be written in JavaScript and
  • 215. technologies are incorporated: XAML. • HTML (or XHTML) and With version 2, the programming CSS for presentation logic can be written in any .NET • The Document Object language, including some Model (DOM) for derivatives of common dynamic dynamic display of and programming languages like interaction with data IronRuby and IronPython . • XML for the interchange of data, and XSLT for its manipulation • The XMLHttpRequest object for asynchronous communication • JavaScript to bring these technologies together3 When was AJAX coined / When was Silverlight coined / developed ? developed ? Nobody invented AJAX. Microsoft released its first version But,the computer scientist Jess of Silverlight in 2007. James Garret first coined the term "Ajax" in 2005. Note: The key technology: XMLHttpRequest used in AJAX was developed by Microsoft for its Internet Explorer 5.0 for Windows as an ActiveX object in 1999.4 AJAX mainly relies on what Silverlight mainly relies on what technology / framework? technology / framework ? Ajax relies on the Unlike Ajax, which relies on the XMLHttpRequest object.Using XMLHttpRequest object, Silverlight it, Ajax typically retrieves data relies on the .NET framework. This from servers and can do so framework provides the common asynchronously. This means language runtime (CLR) run-time Ajax can retrieve data without environment, enabling Silverlight disrupting the behaviors and for running code and providing displays of existing WebPages. services that simplify the developmental process. Specifically, Silverlights .NET framework and CLR environment allow developers to execute the same compiled code on servers as well as clients.5 What is the main purpose of What is the main purpose of AJAX ? Silverlight?
  • 216. Developers typically use Ajax In comparison, developers typically for creating interactive website use Silverlight for creating image- features that end-users can and video-based social media access through Web browsers. content that end-users can stream -- or download in real-time. Developers can also extend the functionality or richness of their Ajax features by using Silverlight, but not vice-versa. 6 Whether AJAX needs to be Whether Silverlight needs to be installed in .NET ? installed in the system? From ASP.Net 3.5 onwards, Silverlight plugin needs to be AJAX has been integrated into installed in our system for better the .NET Framework. Hence, browsing experience. there is no need to install in .NET. 7 When to use AJAX ? When to use Silverlight ? Ajax can be used to make web Silverlight can be used when we applications perform better (if need rich UI (like adobe flex) and used in right manner) and to do not have heavy server provide better user experience dependency. than conventional websites by avoiding full page refreshes. 8 Development Benefits: Development Benefits: Ajax provides developers with Silverlight improves work-flow by access to JavaScript libraries, separating the visual, user- such as MootTools and jQuery. interface aspects of website These libraries help development from the back-end, developers create sleek and business-logic aspects of highly interactive website development. applications without having to pay for integrated development environments (IDEs). However, despite being lower in cost, Ajax is not easier to use than Silverlight. 9 Whether AJAX provides Whether Silverlight provides Cross-platform support ? Cross-platform support ? Ajax is a cross-platform Silverlight is not fully platform technique that can be used on independent tool. It only supports wide range of different Windows OS, Linux OS using operating systems, computer Moonlight and Mac OS. architectures.Reference:
  • 217. Difference between SQL Server 2008 and SQL Server 2012Difference between SQL Server 2008 and SQL Server 2012 S.No SQL Server 2008 SQL Server 2012 1 Maximum number of Maximum number of concurrent concurrent connections: connections: The Maximum number of SQL server 2012 has unlimited concurrent connections to SQL concurrent connections. Server 2008 is 32767. 2 Precision used for spatial Precision used for spatial calculations: calculations: The SQL Server 2008 uses 27 The SQL Server 2012 uses 48 bit bit bit precision for spatial precision for spatial calculations calculations. 3 TRY_CONVERT() and TRY_CONVERT() and FORMAT() FORMAT() functions: functions: TRY_CONVERT() and TRY_CONVERT() and FORMAT() FORMAT() functions are not functions are newly included in available in SQL Server 2008 SQL Server 2012 4 ORDER BY Clause with ORDER BY Clause with OFFSET / FETCH options: OFFSET / FETCH options: ORDER BY Clause does not ORDER BY Clause now have have OFFSET / FETCH OFFSET / FETCH options to use options as in SQL Server 2012 paging to show required rows per page in applications and allow the user to scroll through each page of results rather than download the entire set In the sample query below, SQL Server would return 10 records beginning with record 11. The OFFSET command provides a starting point for the SELECT statement in terms of paging, and the FETCH command provides how many records to return at a time. SELECT BusinessEntityID, FirstName, LastName FROM Person.Person ORDER BY BusinessEntityID OFFSET 10 ROWS FETCH NEXT 10 ROWS ONLY;
  • 218. 5 Code Name: Code Name: SQL Server 2008 is code SQL Server 2012 is code named named as Katmai. as Denali In SQL Server 2008, audit is In SQL Server 2012,support for an Enterprise-only feature. server auditing is expanded to Only available in Enterprise, include all editions of SQL Server. Evaluation, and Developer Edition.7 Sequence Object: Sequence Object: Sequence is not available in Sequence is included in SQL SQL Server 2008 Server 2012.Sequence is a user defined object that generates a sequence of a number. Here is an example using Sequence. /****** Create Sequence Object ******/ CREATE SEQUENCE MySequence START WITH 1 INCREMENT BY 1; /****** Create Temp Table ******/ DECLARE @Person TABLE ( ID int NOT NULL PRIMARY KEY, FullName nvarchar(100) NOT NULL ); /****** Insert Some Data ******/ INSERT @Person (ID, FullName) VALUES (NEXT VALUE FOR MySequence, Umar Ali), (NEXT VALUE FOR MySequence, John Peter), (NEXT VALUE FOR MySequence, Mohamed Iqbal); /****** Show the Data ******/ SELECT * FROM @Person; The results would look like this: ID FullName 1 Umar Ali 2 John Peter 3 Mohamed Iqbal
  • 219. 8 Full Text Search Capability: Full Text Search Capability: The Full Text Search in SQL The Full Text Search in SQL Server Server 2008 does not allow us 2012 has been enhanced by to search and index data allowing us to search and index stored in extended properties data stored in extended properties or metadata. or metadata. Consider a PDF document that has "properties" filled in like Name, Type, Folder path, Size, Date Created, etc. In the newest release of SQL Server, this data could be indexes and searched along with the data in the document itself. The data does have to be exposed to work, but its possible now. 9 BISM Model: BISM Model: Analysis Services in SQL Analysis Services will include a Server does not have BI new BI Semantic Model (BISM). Semantic Model (BISM) BISM is a 3-layer model that concept. includes: Data Model Business Logic Data Access BISM will enhance Microsofts front end analysis experiencing including Excel, Reporting Services and SharePoint Insights. Microsoft has said that BISM is not a replacement for the current BI Models but more of an alternative model. In simple terms, BISM is a relation model that includes BI artifact such as KPIs and hierarchies.Reference:
  • 220. SQL Server Difference FAQs-1 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 Removes one row at a time and deallocating the data pages records an entry in the transaction and logs the deallocation. log for each deleted row. 6 Cannot be rolled back Can be rolled back 2. What are the differences between Primary key and Unique key? S.No Primary Key Unique Key 1 Creates Clustered index Creates Non-Clustered index 2 Null values are not allowed Allows only one null value 3. What are the Differences between Clustered Indexes and Non-Clustered Indexes? S.No Clustered Indexes Non-Clustered Indexes 1 It reorders the physical storage It sorts and maintain a separate of records in the table storage 2 There can be only one We can have 249 non-clustered Clustered index per table indexes in a table 3 The leaf nodes contain data The leaf node contains pointer to data 4 To create clustered index Sql To create non-clustered index Sql server required more memory server requires less memory because the leaf pages in the because the leaf pages will contain tree structure will maintain pointers to actual data actual data . 5 By using clustered index By using non-clustered index retrieving data is more retrieving data is slower than faster,when we compare with clustered index. non-clustered index. 4. What are the differences between Stored Procedures and User Defined Functions?
  • 221. S.No Stored Procedures User Defined Functions 1 Stored Procedure cannot be User Defined Function can be used used in a Select statement in a Select statement 2 Stored procedure supports User Defined Function does not Deferred Name Resolution support Deferred Name Resolution 3 Stored Procedures are User Defined Functions are generally used for performing generally used for Computations Business Logic 4 Stored Procedure need not User Defined Functions should return a value return a value 5 Stored Procedures can return User Defined Functions cannot any datatype return Image 6 Stored Procedures can accept User Defined Functions accept more number of input lesser number of input parameters parameters than User Defined than Stored Procedures. UDF can Functions. Stored Procedures have upto 1023 input parameters can have upto 21000 input parameters 7 Stored Procedures can use Temporary Tables cannot be used in Temporary Tables a User Defined Function 8 Stored Procedures can execute User Defined Functions cannot Dynamic SQL execute Dynamic SQL 9 Stored Procedure supports User Defined Function does not error handling support error handling. RAISEERROR or @@ERROR are not allowed in UDFs 10 Non-deterministic functions can Non-deterministic functions cannot be used in Stored Procedures. be used in User Defined Functions (UDFs). For example, GETDATE() cannot be used in User Defined Functions(UDFs)5. What are the differences between Where and Having clauses? S.No Where clause Having clause 1 It applies to individual rows It applies to a group as a whole 2 It selects rows before grouping It selects rows after grouping 3 It cannot contain aggregate It can contain aggregate functions functions 4 It can be used in select, delete It is used only in select clause
  • 222. ,insert etc. 6. What are the differences between Union and UnionAll? S.No Union UnionAll 1 This is used to eliminate It will not eliminate duplicate rows duplicate rows 2 This selects only distinct rows It selects all the values 3 It can be used to combine any It can be used to combine maximum number of queries of 2 queries 4 It cannot contain aggregate It can contain aggregate functions functions 5 Union is slower than UnionAll UnionAll is faster than Union 6 Output is in sorted order Output is not in sorted order Example : Example : SELECT Col SELECT Col FROM @Table1 FROM @Table1 UNION UNION ALL SELECT Col SELECT Col FROM @Table2 FROM @Table2 Result: Result: 1 1 2 2 3 3 5 2 5 7. What is the difference between normal Select statement and a Cursor? S.No Select statement Cursor 1 Select statements are used for Cursors are used for row-level table-level processing processingReference: Server Difference FAQs-2 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
  • 223. INSTEAD OF trigger for each triggers for each triggering action. triggering action (UPDATE, DELETE, and INSERT) 2 INSTEAD OF triggers fire in place AFTER triggers fire after the triggering of the triggering action and before action (INSERT, UPDATE, or constraints are processed. 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 6 We cannot schedule a trigger. Stored procedures can be scheduled through a job to execute on a predefined time 7 We cannot use the print We can use the Print commands command inside a trigger. inside the stored procedure for debugging purpose 8 We cannot call a trigger from We can call a stored procedure from these files. front end (.asp files, .aspx files, .ascx files etc.)Reference:
  • 224. SQL Server Difference FAQs-31.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 insert and then get new ID. ID directly. Example : Example : Insert into [test_Identity] SELECT NEXT VALUE Values (‘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 identity column. Meaning, we add one property to make it a
  • 225. cannot restart the counter after cycle. a particular interval. Example : ALTER SEQUENCE [dbo]. [Sequence_ID] CYCLE;5 We cannot cache Identity Sequence can be easily cached by column property. just setting cache property of sequence. It also improves the performance. Example : ALTER SEQUENCE [dbo]. [Sequence_ID] CACHE 3;6 We cannot remove the identity The sequence is not table column from the table directly. dependent so we can easily remove it Example : Create table dbo.[test_Sequence] ( [ID] int, [Product Name] varchar(50) ) GO –First Insert With Sequence object INSERT INTO dbo.test_Sequence ([ID],[Product Name]) VALUES (NEXT VALUE FOR [Ticket] , ‘MICROSOFT SQL SERVER 2008′) GO –Second Insert without Sequence INSERT INTO dbo.test_Sequence
  • 226. ([ID],[Product Name]) VALUES (2 , ‘MICROSOFT SQL SERVER 2012′) 7 We cannot define the Here we can set up its maximum maximum value in identity value. column it is based on the data type limit. Example : ALTER SEQUENCE [dbo]. [Sequence_ID] MAXVALUE 2000; 8 We can reseed it but cannot We can reseed as well as change change the step size. the 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 We can generate a range of from identity. sequence 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 But the table variable involves the and back up data. effort when we usually create the normal tables. 2 Temp table result can be used But the table variable can be used by multiple users. by 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 traffic. When we have large data, then later when the size data in the temp table then it increases it will be moved to the has to work across the tempdb. database. A Performance issue will exist.
  • 227. 4 Temp table can do all the DDL Whereas table variable wont allow operations. It allows creating doing the DDL operations. But the the indexes, dropping, altering, table variable allows us to create etc.., the clustered index only. 5 Temp table can be used for the But the table variable can be used current session or global. So up to that program. (Stored that a multiple user session procedure) can utilize the results in the table. 6 Temp variable cannot use the But we cannot do it for table transactions. When we do the variable. 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 variable. More over we cannot the table variable. But using the do the DML operation in the table variable we can do that. functions . 8 The stored procedure will do Whereas the table variable wont the recompilation (cant use do like that. same execution plan) when we use the temp variable for every sub sequent calls.Another Good Reference: between RAISERROR and THROW statements S.No RAISERROR Statement THROW Statement 1 If a msg_id is passed to The error_number parameter does RAISERROR, the ID must be not have to be defined in defined in sys.messages. 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 There is no severity parameter. specifies the severity of the The exception severity is always exception. set to 16.4.Difference between Local temporary table and Global temporary table
  • 228. 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 only. They are cleared as soon once created. They are deleted as the current connection when all users referencing the closes. table disconnect from SQL Server . 3 Cannot be shared between Can be shared between multiple multiple users. users.Reference: Server Difference FAQs-41.Difference between Correlated subquery and Nested subquery S.No Correlated subquery Nested subquery 1 Correlated subquery runs once Nested subquery runs only once for each row selected by the for the entire nesting (outer) query. outer query. It contains a It does not contain any reference to reference to a value from the the outer query row. row selected by the outer query. 2 Correlated subquery follows Nested subquery follows top-down down to top approach i.e., approach i.e., child query is main query is executed executed first and then parent . first(even though parenthesis are present) and then child We can also say:In a subquery query. Outer query condition is used in the the inner query. We can also say: in a Correlated subquery,Inner query condition is used in the outer query 4 Example: Example: select e1.empname, select empname, basicsal, deptno e1.basicsal, e1.deptno from from emp emp e1 where (deptno, basicsal) in (select where e1.basicsal = (select deptno, max(basicsal) from emp max(basicsal) from emp e2 group by deptno) where e2.deptno = e1.deptno)
  • 229. 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 set. a weak entity set. 2 Member of a weak entity set is Member of a strong entity set is a a subordinate entity. dominant entity. 3 Example: Example: Specific Set of all Person,Company,Event,Plant Persons,Companies,Trees,Holiday s3.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 Use Varchar when the data entries entries in a column are in a column are expected to vary expected to be the same size considerably in size like address like phone number 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.
  • 230. 3 Datetime is used for both date Date and time are seperately used and time. for 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.Reference: Server Difference FAQs- 51.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 It comprises standard SQL Tables schema-less entities. No with indexes and referential referential integrity between integrity. the tables, and no custom indexes. 3 It can scale massive amounts It may not scale as far as Azure of data due to the partition key. Table storage.
  • 231. 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 Stands for Relational DataBase Management System Management System 2 In dbms no relationship It is used to establish the concept 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 It supports minimum 6 rules of E.F.CODD out off 12 rules E.F.CODD 6 It requires low Software and It requires High software and 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 constraint for the purpose of regard to data manipulation holding ACID PROPERTY 9 In DBMS Normalization In RDBMS, normalization process 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 supported by both DBMS and compulsorily in DBMS RDBMS 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.
  • 232. 3 We can create maximum of We can create 2(pow(20))-1 65,535 databases. databases. 4 Exception Handling Exception Handling mechanism is mechanism is not available available 5 There is no Varchar(Max) data Varchar(Max) data type is type is not available introduced. 6 DDL Triggers is not available DDL Triggers is introduced 7 DataBase Mirroring facility is DataBase Mirroring facility is not available introduced 8 RowNumber function for RowNumber function for paging is paging is not available introduced 9 Table fragmentation facility is Table fragmentation facility is not available introduced 10 Full Text Search facility is not Full Text Search facility is available introduced 11 Bulk Copy Update facility is not Bulk Copy Update facility is available introduced 12 Data Encryption concept is not .Cannot encrypt the entire introduced database 13 Cannot compress the tables Can Compress tables and indexes. and indexes. (Introduced in 2005 SP2) 14 No varchar(max) or Varchar(max) and varbinary(max) varbinary(max) is available. is used. 15 Data Transformation SQL Server Integration Services(DTS) is used as ETL Services(SSIS) is started using tool from this SQL Server version and which is used as ETL toolReference:
  • 233. SQL Server Difference FAQs-61.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 Query plan read from left to right left 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 A combination of both left and right specified. outer joins. 2 Results in pairs of rows. Results in every row from both of the tables , at least once.
  • 234. 3 Results in Cartesian product of Assigns NULL for unmatched two tables. fields.3.Difference between SQL Server and Oracle S.No SQL Server Oracle 1 SQL History: Oracle History: IBM introduced structured Oracle Corp is the leading supplier Query Language (SQL) as the for S/w products, headquartered in language to interface with its Redwood shores, California, USA. prototype relational database It was founded by Larry Ellison, management system; System Bob Miner and Ed Oates in 1977. R. Oracle Corporation Now they have 43,000 Employees introduced the first in 150 countries. Oracle first commercially available SQL commercial RDBMS was built in relational database 1979, and it is the first to support management system in 1979. the SQL. Oracle is the first S/w Today, SQL has become an company to develop and deploy industry standard, and Oracle 100 % Internet-enabled enterprise Corporation clearly leads the Software. world in RDBMS technology. 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 create applications in MS windows. some information from any DB It provides the ability to store and file, he can issue a query. access data. Whether you are Structured query language experienced or new to windows in (SQL), pronounced “Sequel”, is programming, Oracle provides you the set of commands that all with the complete set of tools to programs and users must use simplify rapid application to access data within the development. The Oracle refers to Oracle. SQL is a high the method used to create the performance fault tolerant data graphical user inter face. There is base management system. no need to write numerous lines of The database is mostly code to describe the appearance maintained by SQL language, and location of inter face elements. which is conceded as the heart
  • 235. 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 structure (these files define the Language): Create, Alter, Drop, operating system that make up the Rename, Truncate. DB, each Oracle DB is made by three types of files, data-files, redo DML (Data Manipulate logs file-controls file) and the other Language): Select, Update and is called Logical structure (these Delete, Insert, Into. files define the logical areas of storage like schema, table spaces, DCL (Data Control Language): segments and extents). Grant, Revoke TCL (Transaction Control Language): Commit, Rollback.4 Advantages: Advantages: • Provides easy access to • Data consistency all data. • Integration of data • Flexibility in data • Easy file generation molding. • Increased security • Reduced data storage • Easy updating of records and 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 common PC file formats expenditures that can be imported • Searching of particular data into other application is easy (like Ms-Excel). • Dispose of heavy files and • SQL is not case register work 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:
  • 236. • 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 • Oracle is the combination of is worked for Oracle DB different S/w products, as a command prompt where they work together for shell (SQL is the designing DB. command prompt shell, • Oracle works with different where we can front and back end communicate with any products/tools (like SQL). DB).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 Cannot be used as a building block block in large query. in large query. 3 Can contain only one single Can contain several statement like Select query. if, else, loop etc. 4 Cannot perform modification to Can perform modification to one or any table. several tables. 5 Can be used (sometimes) as Cannot be used as the target for the target for Insert, update, Insert, update, delete queries. delete queries.5.Difference between IN and EXISTS S.No IN EXISTS 1 Returns true if specified value Return true if sub query contain matches any value in the sub any rows. query or a list. 2 The sub query will run first and The Outer query will ran first and then only outer query. then only sub query. 3 IN is slower than EXISTS. The Exists is faster than IN.The Outer IN is used in the widely For query will run first and then only Static variables for eg: select inner query.So it will reduce the
  • 237. name from table where ID in over head. The Exists is useful (Select ID from table2). mostly in IF 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 FROM dbo.tableb) FROM dbo.tableb WHERE id2 = Server Difference FAQs-71.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 It is lazy, Sql server manages by its sp_confige -recovery interval own. option 5 Does not check the memory Monitor the memory pressure and pressure try 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 Works on Least recent used pages
  • 238. configuration setting, we can and removed unused plans first, no control. 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 Multiple stand by servers can be mirror possible. 2 Generally good to have 10 No limit DB’s for one server 3 No data loss and can be used May be some data loss as per as high availability like schedule. And secondary server Clustering takes some manual work and time to be primary 4 Read log read and transfer the Transfer the log back up and committed transaction through restored 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 Secondary server can be reporting accessed using snapshot DB server (read-only) 8 Principle and Mirror server Primary and secondary server should have same edition should be compatible server for restore. 9 Require FULL recovery model Require FULL or Bulk-Logged recovery model 10 Requires Sql Server 2005 SP1 Enterprise edition for Sql Server or higher – Enterprise or 2000 and even Standard edition for Developer Editions 2005 can works
  • 239. 11 Immediate data moved Can control the flow of data by depending on SEND and WAIT scheduling jobs queue 12 As Immediate data moves, As delay in data transfer can user error reflects at mirrored avoided user error. DB3.Difference between Change Track and Change Data Capture – CDC in SQL Server2008 S.No Change Track Change Data Capture 1 It is about fact: It captures It is about the Data: Change data only the fact as the tracking capture provides historical change table has changed. It does information for a user table by NOT capture the data. capturing both the fact that DML Therefore, change tracking is changes were made and the actual more limited in the historical 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 2 Storage: Storage: Internal tables are placed on When change data capture is the same filegroup as the enabled for a database, a few parent entity. You could use things are added to the database, the sys.internal_tables including a new schema (called catalog view to show all the cdc), some metadata tables, and a internal tables and parent trigger to capture Data Definition entities. For example: select Language (DDL) events. name, object_name(parent_id) as parent_object from The two function names are, sys.internal_tables respectively, 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” Prevents Log truncation. recovery model also. Forces full logging of some bulk It is recommended that you operations.
  • 240. use snapshot isolation when change tracking is enabled. One major point to note here is that Snapshot isolation itself can once change data capture is add significant workload enabled, the transaction log overhead and requires much behaves just as it does with more careful management of transactional replication—the log tempdb. 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 mechanism. the asynchronous process that once a database is enabled for reads the 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 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
  • 241. 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 Index Reorganize physically existing Index and Recreates reorganizes the leaf nodes of the the index from scratch. index. 2 Rebuild the Index when an Reorganize the Index when an index is over 30% fragmented. index is between 10% and 30% fragmented. 3 Rebuilding takes more server Always prefer to do Reorganize the resources and uses locks Index. unless you use the ONLINE option available in 2005 Enterprise and Development editions. 4 T-SQL for Rebuilding all T-SQL for Reorganize all Indexes Indexes of a particular table. of a particular table. USE AdventureWorks; USE AdventureWorks; GO GO ALTER INDEX ALL ON ALTER INDEX ALL ON HumanResources.Employee HumanResources.Employee REBUILD REORGANIZE GO GONote: 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 System defined sp are available in SP in one database i.e master DB.These sp’s can be available to only that database directly called from any DB directly.i.e we cannot call it from some other DB’s directly
  • 242. 2 UDSP will be used to fulfill the SDSP will be used for managing user requirements sql serverReference: Server Difference FAQs-81.Difference between Constraints and Triggers S.No Constraints Triggers 1 Once we define some It will be stored as separate object constraint in 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 Constraints will be fired after Constraints is fired,then only Triggers will be fired 4 Performance wise Constraints Performance wise triggers will give will not give best performance best performance because table to because memory location to table comparison is faster than table comparison is slower memory than table to table comparison. location to table comparison. 5 Constraints cannot start a Triggers are used to carry out tasks chain reaction as like triggers - which cant be done using for instance each delete, constraints. update action etc. can trigger For eg:-A change in the "sal" off another function column of a table should change the "tax" 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 business rules in which all the rule for which user is responsible organizations follow this for logic for business rule constraints without any modification. 8 Constraints are used to Triggers are basically stored maintain the integrity and procedures which automatically
  • 243. atomicity of database .In other fired when any insert,update or words it can be said they are delete is issued on table used to prevent invalid data entry . the main 5 constraints are NOT NULL,PRIMARY KEY,FOREIGN KEY,UNIQUE KEY and CHECK2.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 Convert can be used to convert a to specific format datetime to specific format 4 Usage of CAST: Usage of CONVERT: USE Sample USE Sample GO GO SELECT SUBSTRING(Name, SELECT SUBSTRING(Name, 1, 1, 30) AS ProductName, 30) AS ProductName, ListPrice ListPrice FROM Production.Product FROM Production.Product WHERE CAST(int, ListPrice) LIKE WHERE CAST(ListPrice AS 3%; int) LIKE 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 applied to all aggregation statistical and summarized functions to return cross information from result sets. It tabular result sets. creates groupings and then applies aggregation functions on them. 2 Produces all possible Produces only some possible combinations of subtotals subtotal combinations specified in GROUP BY clause
  • 244. and a Grand Total.Reference: Server Difference FAQs-91.Difference between VARCHAR and NVARCHAR in SQL Server S.No Varchar[(n)] NVarchar[(n)] 1 Basic Definition: Basic Definition: Non-Unicode Variable Length UNicode Variable Length character character data type. data type. It can store both non- Unicode and Unicode (i.e. Example: Japanese, Korean etc) characters. DECLARE @FirstName AS VARCHAR(50) = ‘UMAR’ Example: SELECT @FirstName DECLARE @FirstName AS NVARCHAR(50)= ‘UMAR’ SELECT @FirstName 2 No. of Bytes required for No. of Bytes required for each each character: character: It takes 2 bytes per Unicode/Non- It takes 1 byte per character Unicode character. Example: Example: DECLARE @FirstName AS DECLARE @FirstName AS VARCHAR(50) = ‘UMAR’ NVARCHAR(50)= ‘UMAR’ SELECT @FirstName AS SELECT @FirstName AS FirstName,DATALENGTH(@Fi FirstName,DATALENGTH(@FirstN rstName) AS Length ame) AS Length Result: Result: FirstName Length FirstName Length UMAR 4 UMAR 8 3 Optional Parameter n range: Optional Parameter n range: Optional Parameter n value Optional Parameter n value can be can be from 1 to 8000.Can from 1 to 4000.Can store maximum store maximum 8000 Non- 4000 Unicode/Non-Unicode Unicode characters. characters 4 If Optional Parameter n is If Optional Parameter n is not not specified in the variable specified in the variable declaration or column declaration or column definition: definition:
  • 245. If Optional parameter value n is not If Optional parameter value is specified in the variable declaration not specified in the variable or column definition then it is declaration or column definition considered as 2 then it is considered as 1. Example: Example: DECLARE @firstName DECLARE @firstName NVARCHAR =‘UMAR’ VARCHAR =‘UMAR’ SELECT @firstName SELECT @firstName FirstName,DATALENGTH(@firstNa FirstName,DATALENGTH(@fir me) Length stName) Length Result: Result: FirstName Length FirstName Length U2 U15 If Optional Parameter n is If Optional Parameter n is not not specified in while using specified in while using CAST/CONVERT functions: CAST/CONVERT functions: When this optional parameter When this optional parameter n is n is not specified while using not specified while using the CAST the CAST/CONVERT CONVERT functions, then it is functions, then it is considered considered as 30. as 30. Example: Example: DECLARE @firstName DECLARE @firstName NVARCHAR(35) =‘UMAR ASIA VARCHAR(35) =‘UMAR ASIA INDIA TAMIL NADU CUDDALORE’ INDIA TAMIL NADU SELECT CAST(@firstName AS CUDDALORE’ NVARCHAR) SELECT CAST(@firstName FirstName,DATALENGTH(CAST( AS VARCHAR) @firstName AS NVARCHAR)) FirstName,DATALENGTH(CAS Length T(@firstName AS VARCHAR)) Length Result: FirstName Length Result: UMAR ASIA INDIA TAMIL NADU FirstName Length CUD 60 UMAR ASIA INDIA TAMIL NADU CUD 307 Which one to use? Which one to use? If we know that data to be If we know that data to be stored in stored in the column or the column or variable can have variable doesn’t have any Unicode characters. Unicode characters.
  • 246. 8 Storage Size: Storage Size: Takes no. of bytes equal to the Takes no. of bytes equal to twice no. of Characters entered plus the no. of Characters entered plus two bytes extra for defining two bytes extra for defining offset. offset.2.Difference between SQL Server and MySQL S.No SQL Server MySQL 1 Current Date and Time: Current Date and Time: SELECT GETDATE() SELECT NOW() Optionally: Use CURDATE() for the date only. 2 Limiting Results: Limiting Results: SELECT * FROM table WHERE id SELECT TOP 10 * FROM = 1 LIMIT 10 table WHERE id = 1 3 Date Field Default Value: Date Field Default Value: DATETIME DEFAULT DATETIME fields cannot have a GETDATE() default value, i.e. "GETDATE()" We must use your INSERT statement to specify CURDATE() for the field. Optionally: Use datatype TIMESTAMP DEFAULT CURRENT_TIMESTAMP 4 Character Length: Character Length: LEN() CHARACTER_LENGTH() Aliases: CHAR_LENGTH(), LENGTH() 5 Character Replace: Character Replace: REPLACE() works case REPLACE() works case sensitively insensitively 6 Trim Functions: Trim Functions: LTRIM() and RTRIM() TRIM()
  • 247. 7 String Concatenation: String Concatenation: CONCATENATION USING + CONCAT(string, string), which (Does not automatically cast accepts two or more arguments. operands to compatible types) (Automatically casts values into types which can be concatenated)8 Auto Increment Field Auto Increment Field Definition: Definition: tablename_id INTEGER tablename_id INT IDENTITY AUTO_INCREMENT PRIMARY PRIMARY KEY KEY9 Get a List of Tables: Get a List of Tables: SP_TABLES SHOW TABLES10 Get Table Properties: Get Table Properties: HELP tablename DESCRIBE tablename11 Get Database Version: Get Database Version: SELECT @@VERSION SELECT VERSION()12 Recordset Paging: Recordset Paging: Recordset paging done by Add to end of SQL: "LIMIT " & client side-ADO (very involved) ((intCurrentPage- 1)*intRecsPerPage) & ", " & intRecsPerPage LIMIT: The first argument specifies the offset of the first row to return, and the second specifies the maximum number of rows to return. The offset of the initial row is 0 (not 1).13 Get ID of Newest Inserted Get ID of Newest Inserted Record: Record: SET NOCOUNT ON; INSERT Two step process: INTO...; SELECT 1. Execute your statement: id=@@IDENTITY; SET objConn.Execute("INSERT NOCOUNT OFF; INTO...") 2. Set objRS = objConn.Execute("SELECT LAST_INSERT_ID() AS ID")14 Get a Random Record: Get a Random Record: SELECT TOP 1 * FROM Users SELECT * FROM Users ORDER ORDER BY NEWID() BY RAND() LIMIT 1
  • 248. 15 Generate a Unique GUID: Generate a Unique GUID: SELECT NEWID() SELECT UUID()16 Licensing: Licensing: SQL Server is not an open MySQL is available for free since source and payment has to be MySQL is an open source. made to use SQL Server.17 View Support: View Support: SQL Server offers indexed MySQL offers only updateable views which are much more views. powerful, performance wise.18 XML Support: XML Support: SQL Server supports XML. MySQL does not support XML.19 Security: Security: SQL Server provides column MySQL provides only table level level security. security.20 Certiication for Security: Certiication for Security: SQL Server has C2 compliant MySQL does not offer any certification. Database security certification for security. is verified by third party.21 Support for Triggers: Support for Triggers: SQL Server provides triggers. Earlier versionsof MySQL does not support triggers. Only MySQL 5.0 supports triggers.22 Support for UDF: Support for UDF: User defined functions are User defined functions are not supported in SQL Server. supported in MySQL.23 Support for Cursors: Support for Cursors: Cursor feature is available in Cursor feature is not available in SQL Server. MySQL.24 Support for SPs and Joins: Support for SPs and Joins: Stored procedures and full join Stored procedures and full join facility is not offered in MySQL. facility are offered in SQL Server.25 Support for Import/Export Support for Import/Export Functions: Functions: Import and export are Import and Export functions have extensively supported in very limited support in MySQL. MySQL.26 Support for Transaction: Support for Transaction: Transaction support is Transaction support is very much extensively and fully offered in limited in MySQL. SQL Server.
  • 249. 27 Support for Replication: Support for Replication: Replication support is Replication support is very much extensively and fully offered in limited in MySQL. SQL Server. 28 Support for auto tuning: Support for auto tuning: Auto tuning is supported in Auto tuning is not supported in SQL Server. MySQL. 29 Support for job scheduling Support for job scheduling and and profiling: profiling: Job scheduling and profiling Job scheduling and profiling are are available in SQL Server. not available in MySQL. 30 Support for online backup Support for online backup and and clustering: clustering: Online backup support and Online backup support and clustering support is extensive clustering support is limited in and complete in SQL Server. MySQL. 31 Support for Log shipping Support for Log shipping and and SAN: SAN: Log Shipping and Storage Log Shipping and Storage Area Area Network support is Network support is not available in available in SQL Server. MySQL. 32 Support for OLAP Services, Support for OLAP Services, Data Data Reporting and Data Reporting and Data Mining: Mining: OLAP Services, Data Reporting OLAP Services, Data and Data Mining are not supported Reporting and Data Mining are in MySQL. supported in SQL Server.3.Difference between SET QUOTED_IDENTIFIER ON and SET QUOTED_IDENTIFIEROFF in SQL Server S.No SET QUOTED_IDENTIFIER SET QUOTED_IDENTIFIER OFF ON 1 Characters Enclosed within Characters Enclosed within double quotes: double quotes: is treated as Identifier is treated as Literal 2 Try using Characters Try using Characters Enclosed Enclosed within double within double quotes as quotes as identifier: identifier: Works Fails Example: Below statement to Example: Below statement to
  • 250. create a table with table name create a table with table name “Table” succeeds. “Table” Fails. SET QUOTED_IDENTIFIER SET QUOTED_IDENTIFIER OFF ON GO GO CREATE TABLE dbo.”Table” CREATE TABLE dbo.”Table” (id int,”Function” (id int,”Function” VARCHAR(20)) VARCHAR(20)) GO GO Error Message: Msg 102, Level 15, State 1, Line 1 Incorrect syntax near ‘Table’.3 Try using Characters Try using Characters Enclosed Enclosed within double within double quotes as Literal: quotes as Literal: Works Fails Example: Below Statement Works. Example: Below statement SET QUOTED_IDENTIFIER OFF fails. GO SET QUOTED_IDENTIFIER SELECT “UMAR” ON GO SELECT “BIRADAR” Error Message: Msg 207, Level 16, State 1, Line 1 Invalid column name ‘UMAR’.4 Characters Enclosed within Characters Enclosed within single quotes: single quotes: is treated as Literal is treated as Literal Example: Example: SET QUOTED_IDENTIFIER SET QUOTED_IDENTIFIER ON ON GO GO SELECT ‘UMAR’ SELECT ‘UMAR’5 How to find all the objects How to find all the objects which which are created with SET are created with SET QUTOED_IDENTIFIER QUTOED_IDENTIFIER ON/OFF: ON/OFF: Below Statement can be used to Below Statement can be used find all the objects created with to find all the objects created SET QUTOED_IDENTIFIER with SET setting as OFF: QUTOED_IDENTIFIER setting as ON: SELECT OBJECT_NAME (object_id) FROM sys.sql_modules SELECT OBJECT_NAME WHERE uses_quoted_identifier = (object_id) FROM 0 sys.sql_modules WHERE
  • 251. uses_quoted_identifier = 14.Difference between DateTime and DateTime2 DataType S.No DateTime DateTime2[(n)] 1 Min Value: 1753-01-01 Min Value: 0001-01-01 00:00:00 00:00:00 2 Max Value: Max Value: 9999-12-31 23:59:59.997 9999-12-31 23:59:59.9999999 3 Storage Size: Storage Size: 8 Bytes 6 to 8 bytes Note: Parameter n is optional and if it is not specified then fractional seconds precision is 7 digit and it can be from 0 to 7 digit. For fractional seconds precision <3 6="6" bytes="bytes" font="font" takes="takes"> For fractional seconds precision 3 or 4 it will take 7 bytes For fractional seconds precision >4 it will take 8 bytes 4 Usage: Usage: Declare @now datetime Declare @now datetime2(7) 5 Current Date and Time Current Date and Time function: function: SYSDATETIME()- It returns DB GetDate() – It returns DB Current Date and Time of Current Date and Time of DateTime2 Data Type DateTime Data Type Example: SELECT Example: SELECT SYSDATETIME() GETDATE() Result: 2011-09-16 Result: 2011-09-16 13:23:18.7676720 13:23:18.767 6 +/- days: +/- days: WORKS FAILS – Need to use only DateAdd Example: DECLARE function @nowDateTime DATETIME = Example: DECLARE GETDATE() @nowDateTime2 DATETIME2=
  • 252. SELECT @nowDateTime + 1 SYSDATETIME() Result: 2011-09-17 SELECT @nowDateTime2+1 13:44:31.247 Result: Msg 206, Level 16, State 2, Line 2 Operand type clash: datetime2 is incompatible with int 7 Compliance: Compliance: Is not an ANSI/ISO compliant Is an ANSI/ISO compliantReference: Between Crystal Reports and SSRSDifference Between Crystal Reports and SSRS(OR)Difference Between Crystal Reports and SQL Server Reporting Services S.No Crystal Reports SSRS 1 Ease of hosting reports: Ease of hosting reports: Using the URL technology in In SSRS, in order to host reports RS we can host reports more we need to make a UI for the easily than in crystal report . same. 2 Supporting platforms: Supporting platforms: Crystal Reports can run on SSRS can run only on windows windows, IBM and sun environment. 3 Client tools: Client tools: In crystal Reports, we have In reporting services we have Report designer. Business intelligence ( BI ) and development studio. 4 Caching: Caching: This achieved in Crystal In SSRS,it is stored as snapshots Reports by using cache server. in Reportserver database. 5 Export formats: Export formats: In Crystal Reports we have In SSRS, we have all the formats HTML,PDF,Excel,XML,Word , above it also gives capability to PDF , RTF , CSV, text files. extend custom reporting formats.
  • 253. 6 Data sources: Data sources: Crystal Reports support more SSRS only supports Microsoft and data sources which incudes oracle data sources,namely,SQL ADO, COM, Database excel Server, Oracle, ODBC, OLEDB and Access, Exchange, NT, Xbase, we can also extend additional data JDBC, File system and sources which does not exists in Paradox. crystal reports. 7 Version issues: Version issues: One of the main issues faced SSRS comes with SQL Server in crystal reports is it have minimizing the version issue. different versions which makes it difficult to use 8 Web server support: Web server support: Crystal Reports can run on IIS SSRS works only with IIS 5.0 and 5/6, Apache, lotus etc above.Reference: Server Difference FAQs-101.Difference between OLTP and OLAP S.No OLTP OLAP 1 Abbreviation: Abbreviation: OLTP stands for Online OLAP stands for Online analytical transactional processing . processing . 2 Meaning: Meaning: OLTP is designed to efficiently OLAP is designed for analysis and process high volumes of decision support, allowing transactions, instantly exploration of often hidden recording business events relationships in large amounts of (such as a sales invoice data by providing unlimited views payment) and reflecting of multiple relationships at any changes as they occur. cross-section of defined business dimensions. 3 Used in: Used in: ERP, TX system, Client Server Data warehouse application - Architecture, Desktop MOLAP, ROLAP, HOLAP application
  • 254. 4 Data Provision: Data Provision: Current data Current and historical data5 Type of Database Type of Database Transactions: Transactions: Long database transactions Short database transactions6 Type of update/insert/delete: Type of update/insert/delete: Online update/insert/delete Batch update/insert/delete7 Normalization/Denomalizatio Normalization/Denomalization: n: Denormalization is promoted Normalization is promoted (1st (Dimension and Fact design). normal form, second normal form and third normal form).8 Volume of Transactions: Volume of Transactions: High volume of transactions Low volume of transactions9 Transaction Recovery Transaction Recovery Needed: Needed: Transaction recovery is not Transaction recovery is necessary necessary10 Amount of Index Amount of Index Requirement: Requirement: More Index Less Index11 Amount of Join Amount of Join Requirement: Requirement: Less Joins More Joins12 Model: Model: Adopts an entity Adopts star, snowflake or fact relationship(ER) model constellation model and a subject- oriented database design13 Orientation: Orientation: Customer-oriented, used for Market-oriented, used for data data analysis and querying by analysis by knowledge clerks, clients and IT workers( managers, executives, professionals analysis)14 Source: Source:
  • 255. Daily transactions. OLTP 15 Motive: Motive: Faster insert, updates, deletes Faster analysis and search by and improve data quality by combining tables. reducing redundancy. 16 SQL complexity: SQL complexity: Simple and Medium. Highly complex due to analysis and forecasting.2.Difference between DTS and SSIS S.No DTS SSIS 1 DTS stands for Data SSIS stands for Sql Server Transformation Services Integration Services 2 DTS is a set of objects using SSIS is an ETL tool provided by an ETS tool to extract, Microsoft to extra data from transform, and load information different sources. to or from a database 3 DTS was originally part of the SSIS is a component of the Microsoft SQL Server 2000 Microsoft SQL Server 2005 4 Uses Activex Script Uses Scripting Language 5 No Deployment wizard is Deployment wizard is available available 6 Limited Set of Transformation Huge of Transformations available available 7 Does not support BI Completely supports end to end Functionality process of BI 8 Single Task at a time Multi Tasks run parallely 9 It is Unmanaged script It is managed by CLR 10 DTS can develop through SSIS can develop through Enterprise manager Business Intelligence Development Studio (BIDS, nothing but new version of VS IDE) 11 We can deploy only at local It can be deployed using multiple server server using BIDS 12 Designer contains Single Pane SSIS designer contains 4 design panes:
  • 256. a) Control Flow b) Data Flow c) Event Handlers & d) Package Explorer. 13 No Event Hander Event Handler Available 14 No Solution Explorer Solution Explorer is available, with packages, connections and Data Source Views (DSV) 15 Connection and other values It can be controlled dynamically are static, not controlled at using configuration runtime.Reference: between Count(*) and Count(column_name) in SQL ServerDifference between Count(*) and Count(column_name) in SQL Server S.No Count(*) Count(column_name) 1 Will count all the rows in the Returns the number of rows which specified table have a value (NULL values will not be counted)Reference: between Check Constraint and RuleDifference between Check Constraint and Rule S.No Check Constraint Rule 1 Check constraint is associated Rules are defined with in a with columns in a Table. So database and can be applied to these cannot be re-used. any number of columnsExample for Constraint:alter table Emp add constraint ck_op Check (Salary between 15000 and 45000)Example for Rule (Creation & Binding):Creating Rule:CREATE RULE SAL_RANGEas@Sal > 15000 and @Sal > 45000Binding Rule to a Column:SP_BINDRULE SAL_RANGE,Emp.Salary
  • 257. Summary:The major difference between rule and Check is re usabilityReference: between MSDE and SQL Server 2000Difference between MSDE and SQL Server 2000 S.No MSDE SQL Server 2000 1 Size: Size: In MSDE database size limited In SQL Server database size to 2GB. limited to 1,048,516 TB1(1 Billion GB). 2 Performance: Performance: Performance of MSDE In SQL SERVER 2000, possible degrades when maximum number of concurrent connections number of concurrent are 32,767. operations greater then or equal to 8. Performance degradation is implemented with the help of SQL SERVER 2000 workload governor. 3 OLAP and Data OLAP and Data warehousing: warehousing: MSDE provides OLAP and Data MSDE does not provide OLAP warehousing capabilities and Data warehousing capabilities 4 Mail: Mail: MSDE does not have support MSDE supports facility for SQL facility for SQL mail. mail. 5 Administrative Tools: Administrative Tools: MSDE doesnt have its own SQL Server have administrative administrative tools. There are tools such as enterprise manager, many third party tools, which Query analyzer or Profiler. provide administrative capability GUI.Note: MSDE(Microsoft Desktop Engine) is a cut down version of the SQL SERVERdatabase and free, redistributable software.Reference:
  • 258. sql-server_23.htmlDifference between MSDE and SQL Server Express 2005Difference between MSDE and SQL Server Express 2005 S.No MSDE SQL Server Express 2005 1 MSDE (Micosoft Data Engine) SQL SERVER Express edition is a is a cut down version of SQL cut down version of SQL SERVER Server 2000 2005 and the next evolution of MSDE 2 MSDE maximum database SQL SERVER Express has around size is 2GB 4GB. 3 In terms of programming SQLSERVER Express has TSQL language support MSDE has and .NET. only TSQL 4 MSDE had and was controlled SQL SERVER Express does not through the Workload governer have connection limitation 5 There was no XCOPY support SQL SERVER Express has it. for MSDE 6 MSDE has DTS DTS is not present in SQL SERVER express 7 MSDE does not have reporting SQL SERVER Express has services reporting services 8 MSDE does not have native SQL SERVER Express has native XML support XML supportReference: between STUFF and REPLACE in SQL ServerDifference between STUFF and REPLACE in SQL Server S.No STUFF REPLACE 1 STUFF is used to replace the REPLACE is used to replace all part of string with some other the occurances of the given pattern string. in a string. 2 Syntax: Syntax: STUFF (stringexpression, REPLACE ( string_expression , start, length, string_pattern , replacementcharacters) string_replacement ) Example: Example:
  • 259. SELECT STUFF(Umars Blog select Replace(Umar,U,A) is USEFUL,8,4,DATABASE) Output: Amar Output: Umars DATABASE is USEFULReference: between rdl and rdlcDifference between rdl and rdlc S.No rdl rdlc 1 It stands for Report Definition It stands for Report Definition Language Language, Client Side 2 Created by Sql server with Created by Visual studio reporting services 3 Runs on server side Runs on client side 4 Requires values for all Does not require to have values for elements such as query text all elements such as query text 5 Takes less time to produce Takes more time to produce large large data in reports data in reports 6 As runs in server license of the As runs in local license of the reporting services not needed reporting services not neededReference: between Windows Authentication and SQL Server Authentication in SQLServerDifference between Windows Authentication and SQL Server Authentication in SQLServer S.No Windows Authentication SQL Server Authentication 1 Windows Authentication is SQL Server authentication is trusted because the user name untrusted , since SQL Server is the and password are checked only verifier participating in the with the Active Directory transaction 2 Single User can only login Multi user can loginReference:
  • 260. Difference between SQL Server 2008 R2 and SQL Server 2012Difference between SQL Server 2008 R2 and SQL Server 2012(OR)Difference between SQL Server 10.5 and SQL Server 11.0 S.No SQL Server 2008 R2 SQL Server 2012 1 SQL Server 2008 R2 is SQL Server 2012 is codenamed as codenamed as Kilimanjaro Denali 2 In SQL Server 2008 R2 , In SQL Server 2012, server down rebooting is requisite for OS time is reduced by 50% , hence OS patching , hence server down patching is not rebooting n times. time is high 3 SQL Server 2008 R2 does not In SQL Server 2012, high have this feature of availability availability and disaster recovery groups, hence fast recovery is factor has been introduced which not possible. duplicates the data and rapidly recovers the loss. 4 SQL Server 2008 R2 is slow In SQL Server 2012, the compared to SQL Server 2012. performance is 10 times faster than the predecessor. 5 However buffer rate is less Buffer rate is high in SQL Server because there is no data 2012 because of data redundancy in SQL Server compression. 2008 R2 6 Data visualization is not Data visualization tool is available supported in SQL Server 2008 in SQL Server 2012.This allows R2 snapshots of data. 7 Spatial features are not Support for persistent computed supported more in SQL Server columns and extra geographical 2008 R2. Instead a traditional approach is possible with spatial way for geographical elements features in SQL Server 2012. have been set in SQL Server 2008 R2.Reference: between a table scan and an index scan in SQL Server DatabaseDifference between a table scan and an index scan in SQL Server Database
  • 261. S.No Table Scan Index Scan 1 Here, row by row scanning is Here in the first, index is created in done to get the data. In case, the table. It then uses the index to there are huge number of data get to the data that we wanted. It in a table, it becomes an increases the performance. overhead.Reference: between SQL and T-SQL in SQL ServerDifference between SQL and T-SQL in SQL Server S.No SQL T-SQL 1 SQL stands for Structured T-SQL stands for Transact SQL Query Language 2 ANSI/ISO(American National This is implementing in SQL Standards Institute) standard SERVER. T-SQL can have one or database query language more queries. 3 Set of queries submitted It is a batch program, and submit to individually to the server. the server in a single shot. We can run all the programs at any time. 4 It is developed by IBM. T-Sql is implemetation of SQL in Microsoft SQL Server.Reference: vs SELECT in SQL ServerDifference between SET and SELECT in SQL Server S.No SET SELECT 1 Is it ANSI Standard ? Is it ANSI Standard ? SET is ANSI Standard for SELECT is Non-ANSI Standard for value assignment to variables. value assignment to variables. 2 Variable Assignment: Variable Assignment: SET can be used to assign SELECT can be used to assign value to one variable at a time. values to multiple variables in a single SELECT statement. DECLARE @i INT, @j INT, The below query using SELECT is
  • 262. @k INT valid: SET @i = 10,@j = 20,@k = 30 1 2 It gives error: 3 4 Msg 102, Level 15, State 1, 5 Line 5 DECLARE @i INT, Incorrect syntax near ‘,’. @j INT, @k INT SELECT @i = 10,@j = 20,@k = 30 Output: Command(s) completed successfully. The below query using SET is not valid: 1 2 3 4 53 Behaviour of SET when Behaviour of SELECT when query returns more then one query returns more then one value: value: When assigning from a query When assigning from a query that that returns more than one returns more than one value, value, SET will fail with an SELECT will assign the last value error. returned by the query and hide the fact that the query returned The below query using set will more than one row. fail: 1 The below query using select will 2 execute successfully: 3 1 DECLARE @i INT 2 SET @i = (SELECT n FROM 3 (VALUES (10),(20),(30)) AS 4 List(n)) 5 DECLARE @i INT Error: SELECT @i = n FROM (VALUES (10),(20),(30)) AS List(n) Msg 512, Level 16, State 1, SELECT @i Line 5 Subquery returned more than Output: 1 value. This is not permitted when the subquery follows =, ! 30 =, <, <= , >, >= or when the subquery is used as an (1 row(s) affected) expression.
  • 263. 4 Behaviour of SET when Behaviour of SELECT when query does not return any query does not return any rows: rows: If the variable is initially assigned a If the variable is initially value following is the behavior of assigned a value following is variable assignment for SELECT, the behavior of variable assignment for SET, Retains the initially assigned value and does not assign null if the Assigns null if the query does query does not return any rows. not return any rows. The output of the below statement The output of the below will be 1 statement will be NULL 1 1 2 2 3 3 4 4 5 5 6 6 7 7 DECLARE @i INT DECLARE @i INT SET @i = 1 SET @i = 1 SELECT @i = n FROM (VALUES SET @i = (SELECT n FROM (10),(20),(30)) AS List(n) WHERE (VALUES (10),(20),(30)) AS 1=2 List(n) WHERE 1=2) SELECT @i SELECT @i Output: Output: 1 NULL (1 row(s) affected) (1 row(s) affected)5 Performance: Performance: Set does not provide better Select has better performance over performance over select when set when used for assigning values used for assigning values to to multiple variables at the same multiple variables at the same time. time. Assigning values to multiple Assigning values to multiple variables using Select: variables using SET: 1 1 2 2 3 3 4 4 5 5 DECLARE @i INT, 6 @j INT, 7 @k INT DECLARE @i INT, SELECT @i = 10,@j = 20,@k = 30 @j INT, @k INT
  • 264. SET @i = 10 SET @j = 20 SET @k = 30 6 When to use ? When to use ? Following are few scenarios for Using SELECT is efficient and using SET flexible in the following few cases. 1. If we are required to assign 1. Multiple variables are being a single value directly to populated by assigning values variable and no query is directly involved to fetch value. 2. Multiple variables are being 2. NULL assignments are populated by single source (table , expected (NULL returned in view) result set) 3. Less coding for assigning 3. Standards are meant to be multiple variables follow for any planned 4. Use this if we need to get migration @@ROWCOUNT and @ERROR 4. Non scalar results are for last statement executed expected and are required to be handledReference: By vs Order By in SQL ServerDifference between Group By and Order By in SQL Server
  • 265. S.No Group By Order By1 Meaning: Meaning: Group By performs grouping Order By performs sorting operation i.e., it provides a way operation i.e., it provides a way to to sub-total SQL Query sort SQL Query results like results,or perform some other ascending or descending . It does aggregate functions not affect what shows up in the (GROUPING SETS, CUBE, result set,only what order it is ROLLUP, WITH CUBE, or displayed. WITH ROLLUP) on them.2 Used for: Used for: Controlling the presentation of Controlling the presentation of the the rows for the results of the columns for the results of the SELECT statement. SELECT statement.3 Change in order of columns: Change in order of columns: Order of columns make no Order of Columns makes difference in the GROUP BY difference in ORDER BY Clause. Clause. For Example, For Example, ORDER BY A, B, C GROUP BY A, B, C and and ORDER BY C,A,B GROUP BY C,A,B Both returns the same number of Both returns the same results. Records. But Row order will be different.4 Allowed in Create View Allowed in Create View Statement or not: Statement or not: GROUP BY clause can be ORDER BY clause is not allowed used in the CREATE VIEW in the CREATE VIEW statement. statement to sort data.5 Execution Sequence: Execution Sequence: The GROUP BY clause is The ORDER BY clause is always always placed before the placed after the GROUP BY clause ORDER BY clause in the in the SELECT statement. SELECT statement.6 Impact on performance: Impact on performance: As we know that Group By As we now that Order By sorts the clubs all the similar rows and data either in ascending order or in display only the distinct data. descending order as specified in So here clubbing and the query. So here Sorting the data displaying distinct data is an is an overhead. overhead.
  • 266. Example-1 for Group By:select * from employee group by emp_name.this gives the output data in the group of the emp_name.Example-2 for Group By:SELECT department, sum(salary)FROM tblEmployeeGROUP BY department;will give us salary totals by department, whereas the sum statement by itself would justgive us the grand total of all salaries in tblEmployee.Example-3 for Group By:Group By helps us to display any aggregate of any column based on a field what hasrepeated names.use AdventureWorksDW2008R2goselect Title,SUM(BaseRate) as Rate from dbo.DimEmployee group by Title Title Rate 1 The Accountant 52.88 2 Accounts Manager 34.74 3 Accounts Payable 38 Specialist 4 Accounts Receivable 57 Specialist 5 Application Specialist 109.62 6 Assistant to the Chief 13.46 Financial Officer 7 Benefits Specialist 16.59 8 Buyer 164.42 9 Chief Executive Officer 125.5 10 Chief Financial Officer 120.19 11 Control Specialist 33.65 12 Database Administrator 76.92
  • 267. Example-1 for Order By:select * from employee order by emp_name desc,emp_no asc;this query gives the output in the ascending order of the emp_no and descending order ofthe emp_name.Example-2 for Order By:SELECT *FROM tblEmployeeORDER BY lastname;will give us all tblEmployee data, in order of last name. If we want the results indescending (reversed) order, simply add DESC to the end of the clause: ORDER BYlastname DESC;Example-3 for Order By:Order By clause helps us to display any table based on the values present on thatparticular column.use AdventureWorksDW2008R2goselect FirstName,Title from dbo.DimEmployee order by FirstName First Title Name 1 A. Scott The Master Scheduler 2 Alan Scheduling Assistant 3 Alejandro Production Technician - WC40 4 Alex Production Technician - WC45 5 Alice Production Technician - WC50 6 Amy European Sales Manager 7 Andreas Quality Assurance Technician 8 Andrew Production Supervisor -WC10 9 Andrew Production Technician - WC45
  • 268. 10 Andy Production Technician - WC30 11 Angela Production Technician - WC50 12 Anibal Production Technician - WC20Summary: 1. All non-aggregate columns selected must be listed in the GROUP BY clause. 2. Integers cannot be used in the GROUP BY to represent columns after the SELECT keyword, similar to using the ORDER BY clause. 3. The GROUP BY clause is generally not necessary unless using aggregate functions. 4. If we GROUP, the results are not necessarily sorted; although in many cases they may come out in an intuitive order, thats not guaranteed by the GROUP clause. If we want our groups sorted, always use an explicity ORDER BY after the GROUP BY. – Dave Costa 5. Processing of "group by" or "order by" clause often requires creation of Temporary tables to process the results of the query. Which depending of the result set can be very expensive.Reference: vs SchemaDifference between Database and Schema S.No Database Schema 1 Database is a collection of Database schema describes the organized data structure and organization of data in a database system 2 The database holds the Schema contains Databases and records, fields and cells of data describes how these database fields and cells are structured and organized and what types of relationships are mapped between these entitiesReference:
  • 269. Control Flow vs Data Flow in SSISDifference between Control Flow and Data Flow in SSIS S.No Control Flow Data Flow 1 The smallest unit in Control The smallest unit in Data Flow is Flow is called task. called component. 2 In Control Flow , tasks require In Data Flow , one component will completion (success, failure or not wait for other component to completion) before moving to finish, all of them will work together next task. in processing and managing data in streaming way.Reference: vs UNIQUEIDENTIFIERDifference between TIMESTAMP and UNIQUEIDENTIFIER in SQL Server S.No Timestamp UniqueIdentifier 1 Size of TIMESTAMP value is 8 Size of UNIQUEIDENTIFIER is 16 bytes. bytes. 2 TIMESTAMP is not based on UNIQUEIDENTIFIER value is system date or time. based on the computers MAC addresses and system date time. 3 The purpose to TIMESTAMP is The purpose of to track the operation in tables UNIQUEIDENTIFIER is to have a on the database level. unique value assigned to a row (maybe as primary key). It remains unique in any system in the world.Reference: vs NULLIF in SQL ServerDifference between COALESCE and NULLIF in SQL Server S.No COALESCE NULLIF 1 This function works same as “if This function works as “if”
  • 270. else” statement and it takes statement and it takes two multiple arguments and it arguments and compares the 2 checks Null values for each if argument, if both are same then first argument is null then it returns “Null” else returns the first considers the second value, if argument. the both first and second arguments are nulls then it considers third argument. 2 Syntax: Syntax: COALESCE(argument1, NULLIF(argument1, argument2) argument2, argument3[, argument4, argument6, argument7…]) 3 It Accepts N Parameters, It It Accepts 2 Parameters, if both are returns first Not Null Values not equal then it will return first value. For Example:- SELECT For Example:- COALESCE(NULL,2,NULL,3) SELECT NULLIF(1,2) Output :- 2 Output :- 1 First argument can be NULL, but both argument can not NULL value 4 First argument can be NULL, First argument can not be NULL but both argument can not input NULL value 5 If Both argument are equal, If Both argument are equal, then it then it will return first value. will return NULL value. For Example:- For Example:- SELECT COALESCE(2,2) SELECT NULLIF(2,2) Output :- 2 Output :- NULLReference: Schema vs Snowflake SchemaDifference Between Star Schema and Snowflake Schema S.N Star Schema Snowflake Schema o 1 Data Structure: Data Structure: De-Normalized Data Structure Normalized Data Structure 2 Dimension: Dimension: Category wise Single Dimension table split into many Dimension Table pieces
  • 271. 3 Data dependency & Data dependency & redundancy: redundancy: Less data dependency and No More data dependency and redundancy redundancy 4 Join: Join: No need to use complicated Complicated Join join 5 Query Result: Query Result: Query Results Faster Some delay in Query Processing 6 Parent Table: Parent Table: No Parent Table It may contain Parent Table 7 DB Structure: DB Structure: Simple DB Structure Complicated DB Structure 8 Sample: Sample: http://blog- http://blog- /06/bi-dimensional-model-star- bi-dimensional-model-snowflake- schema.html schema.htmlReference: Models vs PowerPivotDifference between Tabular Models and PowerPivot in SQL Server 2012 S.No Tabular Models PowerPivot 1 Scalability: Scalability: i.No specified upper size limit i. 2 GB Excel file size limit (for ii.Partitions to process large uploading to SharePoint) volumes of data ii. No partitioning iii.Supports Direct Query and iii. VertiPaq only VertiPaq 2 Manageability: Manageability: SSMS, AMO, ADOMD, XMLA, Excel / SharePoint Deployment Wizard, PowerShell, Integration Services 3 Securability: Securability: Row level and dynamic Excel workbook file security security 4 Deveolopment Tool: Deveolopment Tool: Visual Studio Excel
  • 272. Reference: DB vs ReportServerTempDBDifference between ReportServer Database and ReportServerTempDB in SSRS S.No ReportServer Database ReportServerTempDB 1 What it stores ? What it stores ? It Stores information about the It stores only the cached copy of report schema, report property, the report data. data sources, parameters, stores the folder hierarchy, report Execution log. 2 How long it exists ? How long it exists ? It always exists until changes It expires based on Expiry settings. on the RDL Schema. 3 How it helps ? How it helps ? It helps to access the It helps to improve the structure. performance of report execution as it is loading data from cache. 4 Whether data will exist Whether data will exist during / during / after service after service restart ? restart ? Services restarts will clear the Data always exists during Temp Data. SSRS service restarts.Reference: vs Calculated MeasureDifference between Derived Measure and Calculated Measure in SSAS S.No Derived Measure Calculated Measure 1 When it is calculated ? When it is calculated ? This is calculated before the This is Calculated after aggregation are created . aggregations are created . 2 Whether Derived Measure Whether Calculated Measure value is stored in Cube or value is stored in Cube or not ? not ? This values are not stored in the The values of this measure is Cube .
  • 273. stored in the Cube.Reference: vs Union All transformationsDifferences between Merge and Union All transformations in SSIS S.No Merge Union All 1 Number of inputs allowed: Number of inputs allowed: Merge transformation can Union all can take more than two accept only two inputs. inputs. 2 Data to be sorted or not Data to be sorted or not before before Merge Union All transformation: transformation: Union all does not have any Data has to be sorted before condition like Merge. Merge Transformation.For illustration, please visit @ Both of them essentially takes outputs from more than one sources andcombines them into a single result set.Reference: vs ROLAP vs HOLAPDifference between MOLAP, ROLAP and HOLAP in SSAS MOLAP ROLAP HOLAP MOLAP stands for ROLAP stands for HOLAP stands for Hybrid Multidimensional Online Relational Online Online Analytical Analytical Processing Analytical Processing Processing The MOLAP storage The ROLAP storage mode The HOLAP storage mode causes the causes the aggregations mode combines attributes aggregations of the of the partition to be stored of both MOLAP and partition and a copy of its in indexed views in the ROLAP. Like MOLAP, source data to be stored relational database that HOLAP causes the
  • 274. in a multidimensional was specified in the aggregations of thestructure in Analysis partition’s data source. partition to be stored in aServices when the multidimensional structurepartition is processed. in an SQL Server Analysis Services instance.This MOLAP structure is Unlike the MOLAP storage HOLAP does not cause ahighly optimized to mode, ROLAP does not copy of the source data tomaximize query cause a copy of the source be stored. For queriesperformance. The data to be stored in the that access only summarystorage location can be Analysis Services data data in the aggregationson the computer where folders. Instead, when of a partition, HOLAP isthe partition is defined or results cannot be derived the equivalent of MOLAP.on another computer from the query cache, therunning Analysis indexed views in the dataServices. Because a source are accessed tocopy of the source data answer queries.resides in themultidimensionalstructure, queries can beresolved withoutaccessing the partition’ssource data.Query response times Query response is Queries that accesscan be decreased generally slower with source data—forsubstantially by using ROLAP storage than with example, if you want toaggregations. The data in the MOLAP or HOLAP drill down to an atomicthe partition’s MOLAP storage modes. cube cell for which therestructure is only as Processing time is also is no aggregation data—current as the most typically slower with must retrieve data fromrecent processing of the ROLAP. However, ROLAP the relational databasepartition. enables users to view data and will not be as fast as in real time and can save they would be if the storage space when you source data were stored are working with large in the MOLAP structure. datasets that are With HOLAP storage infrequently queried, such mode, users will typically as purely historical data. experience substantial differences in query times depending upon whether the query can be resolved from cache or aggregations versus from the source data itself.Pros Pros Pros • Provides • Ability to view the • HOLAP balances maximum query data in near real- the disk space performance, time. requirement, as it because all the • Since ROLAP does only stores the
  • 275. required data (a not make another aggregate data on copy of the detail copy of data as in the OLAP server data and case of MOLAP, it and the detail data calculated has less storage remains in the aggregate data) requirements. This relational are stored in the is very database. So no OLAP server itself advantageous for duplicate copy of and there is no large datasets the detail data is need to refer to the which are queried maintained. underlying infrequently such as • Since HOLAP does relational historical data. not store detail database. • In ROLAP mode, data on the OLAP• All the calculations the detail data is server, the cube are pre-generated stored on the and partitions when the cube is underlying relational would be smaller in processed and database, so there size than MOLAP stored locally on is no limitation on cubes and the OLAP server data size that partitions. hence even the ROLAP can support • Performance is complex or limited by the better than ROLAP calculations, as a data size of as in HOLAP the part the query relational database. summary data are result, will be In nutshell, it can stored on the performed quickly. even handle huge OLAP server and• MOLAP uses volumes of data. queries can be compression to satisfied from this store the data on summary data. the OLAP server • HOLAP would be and so has less optimal in the storage scenario where requirements than query response is relational required and query databases for results are based same amount of on aggregations on data. large volumes of• MOLAP does not data. need to have a permanent connection to the underlying relational database (only at the time of processing) as it stores the detail and aggregate data in the OLAP server so the data can be viewed even when there is connection to the relational
  • 276. database.Cons Cons Cons • With MOLAP • Compared to • Query performance mode, you need MOLAP or HOLAP (response time) frequent the query response degrades if it has processing to pull is generally slower to drill through the refreshed data because everything detail data from after last is stored on relational data processing relational database store, in this case resulting in drain and not locally on HOLAP performs on system the OLAP server. very much like resources. • A permanent ROLAP. • Latency; just after connection to the the processing if underlying database there is any must be maintained changes in the to view the cube relational database data. it will not be reflected on the OLAP server unless re- processing is performed. • MOLAP stores a copy of the relational data at OLAP server and so requires additional investment for storage. • If the data volume is high, the cube processing can take longer, though you can use incremental processing to overcome this.Reference:
  • 277. Compact Edition vs Express EditionDifference Between SQL Server Compact Edition and SQL Server Express Edition S.No SQL Server Compact Edition SQL Server Express Edition 1 Privately installed, Privately installed, embedded, embedded, with the with the application: application: No Yes 2 Non-admin installation Non-admin installation option: option: No Yes 3 Runs on Windows Mobile Runs on Windows Mobile platform: platform: Yes No 4 Runs in-process with Runs in-process with application: application: Yes No 5 Runs as a service: Runs as a service: No Yes 6 File format: File format: Single File Multiple Files 7 Data file storage on a Data file storage on a network network share: share: Yes No 8 Support for different file Support for different file extensions: extensions: Yes No 9 Procedural T-SQLSelect Procedural T-SQLSelect Case, If, Case, If, features: features: No Yes 10 Remote Data Access (RDA): Remote Data Access (RDA): Yes No 11 Distributed transactions: Distributed transactions: No Yes 12 Stored procedures, views, Stored procedures, views, triggers :No triggers : Yes
  • 278. 13 Role-based security: No Role-based security: Yes 14 Number of concurrent Number of concurrent connections: connections: 256 UnlimitedReference: vs COALESCE FunctionsDifferences Between ISNULL and COALESCE Functions in SQL Server S.N ISNULL COALESCE o 1 Meaning: Meaning: This function works like “if” This function works same as “if condition which we use in else” statement and it takes other program languages. It multiple arguments and it checks takes only two arguments, if Null values for each if first first argument is Null then it argument is null then it considers returns second and one more the second value, if the both first thing is that the second and second arguments are nulls argument should be of same then it considers third argument. size that means if first argument has varchar(2) and second has varchar(4) then it truncates last characters. 2 Syntax: Syntax: ISNULL(argument1, COALESCE(argument1, argument2) argument2, argument3[, argument4, argument6, argument7…]) 3 Creating Computed Creating Computed Columns: Columns: With COALESCE() we can not With ISNULL() we can create create non-persisted computed both persisted & non-persisted column, but only persisted column. computed columns. 4 Number of Parameters: Number of Parameters: Takes only 2 parameters. Takes a variable number of parameters. Note: If we use more than two parameters with the ISNULL function then we must use nested ISNULL functions. 5 ANSI standard or not: ANSI standard or not:
  • 279. A proprietary T-SQL function. ANSI SQL standard.6 Returned Data Type: Returned Data Type: Data type returned is the data Data type returned is the type of the first parameter. expression with the highest data type precedence. If all expressions are non-nullable, the result is typed as non-nullable.7 Whether translating to CASE Whether translating to CASE Expression possible ? Expression possible ? No Can be translated to a CASE expression: For Example, COALESCE (exp_1, exp_2, … exp_n) Can be translated to CASE WHEN exp_1 IS NOT NULL THEN exp_1 WHEN exp_2 IS NOT NULL THEN exp_2 … ELSE exp_n END8 What happens when What happens when parameters parameters datatypes are datatypes are not determined ? not determined ? At least one of the NULL values If the data types of both must be a typed NULL. If the data parameters are not types of all parameters are not determined, the data type determined, the COALESCE returned is int. function will throw an error: ISNULL(NULL, NULL) – COALESCE(NULL, NULL) – Returns int Throws an error COALESCE(CAST(NULL AS INT), NULL) – Returns int9 Truncating parameter value: Truncating parameter value: The ISNULL() function looks at COALESCE() does not have this the first value and the second restriction. parameter value is automatically limited to that Example: length . declare @test varchar(3) select coalesce(@test, ABCD) AS Example: coalesceResult
  • 280. declare @test varchar(3) Output: select isnull(@test, ABCD) AS coalesceResult ISNULLResult ABCD Output: ISNULLResult ABCReference: Triggers vs DDL TriggersDifference between DML Triggers and DDL Triggers S.No DML Triggers DDL Triggers 1 Where it operates ? Where it operates ? Operates on INSERT, UPDATE Operates on CREATE, DROP and and DELETE. ALTER. 2 Where it can be applied ? Where it can be applied ? Applied on Tables and views. Applied on Databases and servers. 3 Whether it can be used as Whether it can be used as INSTEAD OF TRIGGERS ? INSTEAD OF TRIGGERS ? Can be used as INSTEAD OF Cannot be used as INSTEAD OF TRIGGERS. TRIGGERS. 4 Whether Magic tables can be Whether Magic tables can be created ? created ? Creates INSERTED and Cannot create INSERTED and DELETED tables. DELETED tables. 5 When it runs ? When it runs ? DML triggers run either Before DDL triggers run only after a T-SQL or After a T-SQL statement is statement is completed . completed .Reference: vs SQL Server IndexesDifference between Oracle and SQL Server IndexesType of index SQL Server Oracle 11g
  • 281. 2008 R2B-tree indexes Yes (Non- Yes (Default) clustered)B+ tree indexes Yes (CI) Yes (IOT)Function Based Yes (Column has YesIndexes to exist in table)Hash cluster indexes No YesB-Tree cluster No YesindexesBitmap Indexes No YesHere,CI - Clustered IndexesIOT - Index Organized TablesNote: Both SQL Server 2008 R2 and Oracle 11g supports Filtered IndexesReference: vs DT_WSTR data typesDifference between DT_STR and DT_WSTR data types in SSIS S.No DT_STR DT_WSTR 1 Definition: Definition: A null-terminated ANSI/MBCS A null-terminated Unicode character string with a character string with a maximum maximum length of 8000 length of 4000 characters. (If a characters. (If a column value column value contains additional contains additional null null terminators, the string will be terminators, the string will be truncated at the occurrence of the truncated at the occurrence of first null.) the first null.) 2 When DT_STR can be used ? When DT_STR can be used ? When data is in ANSI code When data is in Unicode then SSIS then SSIS package takes the package takes the data type as data type as DT_STR. DT_WSTR. 3 How DT_STR can be mapped How DT_STR can be mapped in
  • 282. in SQL Server ? SQL Server ? DT_STR data type in SSIS can DT_WSTR data type in SSIS can be mapped to Char or VarChar be mapped to nChar or nVarChar data types in SQL Server. or Sql_Variant or image data types in SQL Server.Reference: Load vs Incremental LoadDifference between Full Load and Incremental Load S.No Full Load Incremental Load 1 Truncates all rows and loads New records and updated ones are from scratch. loaded. 2 Requires more time. Requires less time. 3 Can easily be guaranteed. Difficult. ETL must check for new/updated rows. 4 Can be lost. Retained.Reference:
  • 283. UML Difference FAQs-11.Difference between Sequence diagram and Component diagram S.No Sequence diagram Component diagram 1 A sequence diagram is an A component diagram represents interaction diagram which how the components are wired represents how the processes together to form a software system. operate with each other and their order of operation. 2 Sequence diagram keeps track A component diagram has a higher of the objects and classes level of abstraction than a Class involved and the sequence of Diagram - usually a component is messages exchanged between implemented by one or more the objects which are required classes at runtime. to carry out the functionality. 3 Sequence diagrams are not Component diagrams are used to intended for showing complex illustrate complex systems,they are procedural logic. building blocks so a component can eventually encompass a large portion of a system. 4 A sequence diagram is a Component diagram is a Structural Behavioral Modeling Diagram. Modeling Diagram2.Difference between Sequence diagram and Activity diagram S.No Sequence diagram Activity diagram 1 Sequence diagram models the Activity Diagram mainly represent sequential logic, ordering of process flows captured in system. messages with respect to time. 2 Sequence diagram mainly Activity diagrams are good at represent interaction between showing the general sequence of different objects.It is time actions for several objects and use ordered means exact cases. interactions between objects is represented step by step. 3 Sequence diagram describes Activity diagram is not dynamic the behavior of several objects diagram and it is used to see the in a single use case. workflow of the software. 4 Sequence diagram is lifeline of Activity diagram high-level the the object and it is dynamic business processes, including data modeling. flow, or to model the logic of complex logic within a system. 5 Sequence diagrams describe Activity diagrams illustrate the interactions among classes in dynamic nature of a system by
  • 284. terms of an exchange of modeling the flow of control from messages over time. activity to activity. An activity Sequence diagrams show a represents an operation on some detailed flow for a specific use class in the system that results in a case or even just part of a change in the state of the system. specific use case. They are Typically, activity diagrams are almost self explanatory; they used to model workflow or show the calls between the business processes and internal different objects in their operation. sequence and can show, at a detailed level, different calls to different objects.3.Difference between Sequence diagram and Collaboration diagram S.No Sequence diagram Collaboration diagram 1 In Sequence diagrams we can In Collaboration Diagram we can show Synchronous as well as only show Synchronous messages. Asynchronous messages. 2 Sequence Diagram shows Collaboration diagram shows how overall flow of System event/s objects interacts with each other or in a given use case. how intercommunication b/w objects for a give use case 3 It is difficult to fine the It is easy to detect the responsibilities of objects in responsibilities of objects in sequence diagram. collaboration diagram by just counting the number of arrows coming into the object. 4 Sequence Diagrams are less Collaboration Diagram are much spatial. spatial.Reference:
  • 285. WCF Difference FAQs-1Difference between basicHttpBinding and wsHttpBindingCriteria BasicHttpBinding WsHttpBindingSecurity This supports the old ASMX This exposes web services usingsupport style, i.e. WS-BasicProfile 1.1.WS-* specifications.Compatibilit This is aimed for clients who do As its built using WS-*y not have .NET 3.0 installed and specifications, it it does not support wider ranges of supports wider ranges of clients. client Many of the clients like and it cannot be consumed by older Windows .NET version less than 3 version. 2000 still do not run .NET 3.0. So older version of .NET can consume this service.Soap SOAP 1.1 SOAP 1.2 and WS-Addressingversion 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 hasoptions the WS-Security enabled by default. So client calls happen. In other the words, data is sent as plain text. data is not sent in plain text.Security None Noneoptions Windows – default Transport authentication Message Basic Transport with message credentials CertificateDifference between Message and Transport level security in WCFCriteria Transport Security Message SecurityScenarios When there are no When there are intermediatewhen we intermediate systems in systems like one more WCFshould be between this is the best service through which message isusing one of methodology. routed then message security is thethem way to go. If it’s an intranet type of solution this is most
  • 286. recommended methodology.Advantages Does not need any extra Provides end to end security as it’s coding as protocol inherent not dependent on protocol. Any security is used. intermediate hop in network does not affect the application. Performance is better as we can use hardware Supports wide set of security accelerators to enhance options as it is not dependent on performance. protocol. We can also implement custom security. There is lot of interoperability support and communicating clients do not need to understand WS security as it’s built in the protocol itself.Disadvantages As it’s a protocol Needs application refactoring to implemented security so it implement security. works only point to 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 WCFS.No Buffered Transfer Streamed Transfer1 Target can process the message Target can start processing the data once it is completely received. when it is partially received.2 Performance will be good when Performance will be good when message size is small message size is larger(more than 64K)3 Native channel shape is Native channels are IRequestChannel IDuplexSessionChannel and 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
  • 287. service 2 Programming [WebService] attribute [ServiceContract] attribute has to be added to the has to be added to the class class 3 Model [WebMethod] attribute [OperationContract] attribute represents the method represents the method exposed to client exposed to client 4 Operation One-way, Request- One-Way, Request- Response are the Response, Duplex are different operations different type of operations supported in web service supported in WCF 5 XML System.Xml.serialization System.Runtime.Serialization name space is used for namespace is used for serialization serialization 6 Encoding XML 1.0, XML 1.0, MTOM, Binary, MTOM(Message Custom Transmission Optimization Mechanism), DIME, Custom 7 Transports Can be accessed through Can be accessed through HTTP, TCP, Custom HTTP, TCP, Named pipes, MSMQ,P2P, Custom 8 Protocols Security Security, Reliable messaging, Transactions 9 State Web Services are WCF Services can manage Management stateless statesReference: Difference FAQs-21.Difference between Self Hosting and IIS Hosting S.No Self Hosting IIS Hosting 1 Coding Effort: Coding Effort: We need to add some extra No need to add extra code code to host the process Automatic hosting 2 Deployment: Deployment: Easy to deploy More difficult to deploy than Self-
  • 288. Hosting 3 Recycling: Recycling: Automatic process recycling is Automatic process recycling is not possible possible 4 Service Lifetime: Service Lifetime: Can control the service lifetime Lifetime cannot be controlled using Open and Close manually. methods 5 Host Process: Host Process: Host process should be IIS host runs automatically when a running before client makes a client makes a call to the service. call to the service.2.Difference between Behaviour and Contract(OR)Difference between Service Behaviour and Service Contract S.No Service Contract Service Behaviour 1 Behaviour: Behaviour: Affects the behavior of both Only affects the behavior of the client and server server 2 Applicability: Applicability: Can apply to both interface Only applicable to a class and class implementation 3 Impact on WSDL: Impact on WSDL: Affects the WSDL emitted Does not affect the WSDL3.Difference between proxy and channel factory S.No Proxy Channel Factory 1 Only requires URL where the We must have direct access to the service resides assembly that contains that service contract T for 2 Very simpler Not easier 3 Easy to understand Channels are complex, network- related 4 There is Visual Studio gives us When we share a common service
  • 289. add the reference contract dll between the client and the server, we will be using the ChannelFactory class 5 Proxies have several If we know that our entities will not restrictions like: change much and the client code is less, then a DLL would work better 1. Properties need to have than a proxy gets and sets 2. Contructors cannot be exposed 3. Methods other than the service contract cannot be exposed 6 By using SVCutil.exe we will When we are using DLL that refers create Proxy Service contract interface then use the channel factory class4.Difference between DataContractSerializer and XMLSerializer S.No DataContractSerializer XMLSerializer 1 A practical benefit of the XMLSerializer does not provide design of the better performance when compare DataContractSerializer is with DataContratSerializer because better performance over XMLSerializer does not indicate Xmlserializer. This is because which fields or properties of the DataContratSerializer explicitly type are serialized into XML shows the which fields or properties are serialized into XML. 2 The DataContractSerializer XMLSerializer cannot translate the can translate the HashTable HashTable into XML. into XML. 3 DataContractSerializer is XMLSerializer is used for complex basically for very small, simple schemas. subset of the XML infoset. 4 DataContractSerializer XmlSerializer cannot serialize serializes private members. private members 5 DataContractSerializer uses XmlSerializer uses opts-out the opts-in approach i.e, approach i.e., marking the selecting the members that members do not need to be needs to be serialized .This is serialized. This is called as opts- called as opts-in approach. out approach. 6 DataContractSerializer can XmlSerializer can serialize only
  • 290. serialize both private and public types. If we are trying to public types. serialize a class that is marked private by InvalidOperation Exception will be thrown by the serializer. 7 DataContractSerializer does For any types that needs to be not need any default serialized by XmlSerializer must constructor before serializing have a default constructor. any type. 8 DataContractSerializer does XmlSerializer gives more control not give more control over the 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. 9 DataContractSerializer can XmlSerializer cannot able to able to serialize types that serialize types that implements implements Idictionary. IDictionary, for ex. Dictionary type cannot be serialized. 10 We can serialize a type that Only the public members are marked with [Serializable] serialized not the private members. attribute with Suppose we do not need any of the DataContractSerializer. It member to be serialized we can serializes all the members use [XmlIgnore] attribute (private, public) even they are marked with [XmlIgnore]. 11 WCF uses Webservice uses XMLSerializer DataContractSerializer attribute attributeReference: Difference FAQs-31.Difference between WCF Data Services and WCF RIA Services S.No WCF Data Services WCF RIA Services 1 Supported Clients: Supported Clients: Resource-based API, supports Domain-based API, most tailored all clients via deep REST and for use with Silverlight, but OData support. supports other clients via SOAP, JSON, and OData. 2 Supported Data Access Supported Data Access Layers :
  • 291. Layers : Supports EF, LINQ to SQL, and Targets EF. Other DALs are POCO (custom persistence layer). supported, but greater effort is required. 3 Client Development : Client Development : Requires you to notify the Supports self-tracking entities, context for change tracking. synchronized client/server logic, and much more (particularly with Silverlight). 4 Service Development : Service Development : Instant, code-less, extensible Requires you to code CRUD REST services out of the box operations manually in domain (with EF); “free CRUD.” service classes.Another good reference: between Close and Abort in WCF Channels S.No Close Abort 1 Close performs graceful Abort shut downs Client channel shutdown of Client Channel immediately. 2 Close waits for in progress Abort ends in progress calls. calls to complete before closing 3 Close should not be called in Abort should be called in faulted faulted channels as it can channels. throw Communication or Timeout exception3.Difference between ASMX and SVC S.No ASMX SVC 1 Web service class inheritance There is no Web service class for ASMX is called WebService inheritance for SVC. 2 In ASMX,Web service class In SVC,Web service class attribute attribute is called as is called as WebServiceAttribute. ServiceContractAttribute. 3 In ASMX,Web service method In SVC,Web service method attribute is called as attribute is called as WebMethodAttribute. OperationContractAttribute.
  • 292. 4 In ASMX,Data class attribute is In SVC,Data class attribute is called as XmlRootAttribute called as DataContractAttribute. 5 In ASMX,Data class field In SVC,Data class field attribute is attribute is called as called as DataMemberAttribute. XmlElementAttribute 6 In ASMX,HTTP endpoint In SVC,HTTP endpoint resource is resource is called as .ASMX. called as .SVC 7 In ASMX, Serialization attribute In SVC, Serialization attribute is is called as XMLSerializer called as DataContractSerializer attribute. attribute.Reference: between reliable messaging and reliable sessions in WCFDifference between reliable messaging and reliable sessions in WCF S.No Reliable messaging Reliable sessions 1 Reliable messaging is Reliable session provides a context concerned with ensuring that for sending and receiving a series messages are delivered of reliable messages. exactly once.Summary:Reliable sessions have a dependency on reliable messaging.We have to use reliable messaging to provide an end-to-end reliable session between aclient application and a service.So finally, both are different but related concepts.Reference: between a regular WCF Services and a Silverlight-Enabled WCFServicesDifferences between a regular WCF Services and a Silverlight-Enabled WCFServices S.No WCF Service Silverlight-Enabled WCF Service 1 Utilizes the Utilizes ‘basicHttpBinding’ as its default binding ‘wsHttpBinding’ as its default binding 2 Are generated with an Have no interface generated when they are
  • 293. Interface created and the following is added to the class [AspNetCompatibilityRequirements(Requirements Mode = AspNetCompatibilityRequirementsMode.Allowed)] the following element is added to theReference: vs wcf sessionDifference between and wcf session S.No ASP.NET Session WCF Session 1 ASP.NET sessions are initiated WCF sessions are initiated by by server only. WCF Client. 2 ASP.NET sessions data can be In WCF, session Messages accessed in unordered way. delivered during a session are processed in the order in which they are received. 3 ASP.NET has a general data In WCF, there is no such data storage mechanism for session storage mechanism available for session.Reference:
  • 294. Difference between ASP.Net Web services and .NET Remoting 1. What are the differences between ASP.Net Web services and .NET Remoting? S.No Features ASP.Net Web services .NET Remoting 1 Protocol It can be accessed only It can be accessed over HTTP over any protocol (including TCP, HTTP, SMTP and so on) 2 State Management Web services work in a It provides support for stateless environment both stateful and stateless environments through Singleton and SingleCall objects 3 Type System Web services support Using binary only the datatypes communication, .NET defined in the XSD type Remoting can provide system, limiting the support for rich type number of objects that system can be serialized. 4 Interoperability Web services support .NET remoting requires interoperability across the client be built using platforms, and are ideal .NET, enforcing for heterogeneous homogenous environments environment. 5 Reliability Highly reliable due to Can also take the fact that Web advantage of IIS for services are always fault isolation. If IIS is hosted in IIS not used, application needs to provide plumbing for ensuring the reliability of the application 6 Extensibility Provides extensibility by Very extensible by allowing us to intercept allowing us to the SOAP messages customize the different during the serialization components of the and deserialization .NET remoting stages. framework. 7 Ease-of-Programming Easy-to-create and Complex to program. deploy.
  • 295. Reference: between API and WebServices S.No API WebServices 1 API returns the output in the Web Services gives the output in form of void,scalar or generic the form of XML or JSON type 2 We need to add references for We need to add web references for API web-servicesReference: Between SOAP and RESTful webservicesDifference between SOAP and RESTful webservices(OR)Difference between SOAP and REST S.No SOAP REST 1 Developer View: Developer View: Object oriented Resource Oriented 2 Standards Based: Standards Based: Yes . No SOAP web services are based on SOAP and WS-* specifications For acquiring security tokens,it uses WS-Trust. For conveying security tokens, it uses WS-Security For defining policy, it uses WS- Policy For suppoting distributed ACID transactions, it uses WS- AtomicTransaction and WS- Coordination
  • 296. For acquiring interface definitions, it uses WS- MetadataExchange For providing end-to-end reliability, it uses WS- ReliableMessaging For establishing security context, it uses WS- SecureConversation3 Security: Security: SSL, WS-Security . SSL WS-Security provides end-to- end security covering message integrity and authentication4 Transactions : Transactions : WS-AtomicTransaction No5 Reliability : Reliability : WS-ReliableMessaging Application specific6 Performance: Performance: Good Better Caching and lower message payload makes RESTful web services performance efficient and scalable7 Caching : Caching : No GET operations can be cached8 Message Size : Message Size : Heavy, has SOAP and WS-* Lightweight, no extra xml markup specific markup9 Message Communication Message Communication protocol : protocol : XML XML, JSON, other valid MIME type . This flexibility of REST makes its
  • 297. extremely useful in providing consumer need specific message payloads10 Message Encoding : Message Encoding : Yes No SOAP Web Services support RESTful encoding is limited to text text and binary encoding11 Service Description : Service Description : WSDL No formal contract definition In REST, no formal way to describe a service interface means more dependence on written documentation12 Human intelligible Payload : Human intelligible Payload : No Yes13 Developer Tooling : Developer Tooling : Yes Minimal or none Complexity of SOAP Web REST on the other hand due to its Services dictates the need for simplicity can be developed without using frameworks to facilitate any framework rapid application development.14 Orientation : Orientation : Wraps business logic Accesses resources/data15 Abbreviation: Abbreviation: SOAP stands for Simple REST stands for Representational Object Access Protocol State Transfer16 Who is using SOAP? Who is using REST? Google seams to be consistent All of Yahoos web services use in implementing their web REST, including Flickr, services to use SOAP, with the API uses it, pubsub, bloglines, exception of Blogger, which technorati, and both eBay, and uses XML-RPC. You will find Amazon have web services for SOAP web services in lots of both REST and SOAP. enterprise software as well.
  • 298. 17 Simplicity: Simplicity: No Yes 18 Transport protocol support: Transport p