Welcome To Latest Dot Net Interview Questions and Answer.

In this Blog you can find all to Dot Net Interview Question and Answer. you can find Scenario based ASP.Net, VB.Net, C# and SQL Server Interview Questions and answers. Dot Net Jobs, Dot Net Books. SQL Server Books, Dot Net Based Company. Dot Net and SQL Server Training Institute.

Visual Studio.Net advanced Interview Questions, SQL Server advanced Interview Questions, Latest Interview Questions,ASP.NET, SQL Server, VB.Net, C#.Net and ADO.NET Interview Questions.Scenario Based Interview Questions. Visual Studio.Net Books and SQL Server Books. Technical Interview Questions, HR Interview Questions

In this Blog You can Find ASP.NET Web Application Projects Idea , C# Windows Application Projects Idea. VB.Net Windows Application Projects Idea, SQL Server Data Base Concept.

Dot Net Inteview Questions -V

I have  added Few Asp.Net Interview Questions and Answer



Q81. What technique is used to figure out that the page request is a postback?
Ans. The IsPostBack property of the page object may be used to check whether the page request is a postback or not. IsPostBack property is of the type Boolean.

Q82. Which event of the ASP.NET page life cycle completely loads all the controls on the web page?
Ans. The Page_load event of the ASP.NET page life cycle assures that all controls are completely loaded. Even though the controls are also accessible in Page_Init event but here, the viewstate is incomplete.

Q83. How is ViewState information persisted across postbacks in an ASP.NET webpage?
Ans. Using HTML Hidden Fields, ASP.NET creates a hidden field with an ID="__VIEWSTATE" and the value of the page's viewstate is encoded (hashed) for security.


Q84. What is the ValidationSummary control in ASP.NET used for?
Ans. The ValidationSummary control in ASP.NET displays summary of all the current validation errors.

Q85. What is AutoPostBack feature in ASP.NET?
Ans. In case it is required for a server side control to postback when any of its event is triggered, then the AutoPostBack property of this control is set to true.

Q86. What is the difference between Web.config and Machine.Config in .NET?
Ans. Web.config file is used to make the settings to a web application, whereas Machine.config file is used to make settings to all ASP.NET applications on a server(the server machine).

Q87. What is the difference between a session object and an application object?
Ans. A session object can persist information between HTTP requests for a particular user, whereas an application object can be used globally for all the users.

Q88. Which control has a faster performance, Repeater or Datalist?
Ans. Repeater.


Q89. Which control has a faster performance, Datagrid or Datalist?
Ans. Datalist.

Q90. How to we add customized columns in a Gridview in ASP.NET?
Ans. Make use of the TemplateField column.


Q91. Is it possible to stop the clientside validation of an entire page?
Ans. Set Page.Validate = false;

Q92. Is it possible to disable client side script in validators?
Ans. Yes. simply EnableClientScript = false.

Q93. How do we enable tracing in .NET applications?
Ans. <%@ Page Trace="true" %>


Q94. How to kill a user session in ASP.NET?
Ans. Use the Session.abandon() method.

Q95. Is it possible to perform forms authentication with cookies disabled on a browser?
Ans. Yes, it is possible.

Q96. What are the steps to use a checkbox in a gridview?
Ans.



Q97. What are design patterns in .NET?
Ans. A Design pattern is a repeatitive solution to a repeatitive problem in the design of a software architecture.

Q98. What is difference between dataset and datareader in ADO.NET?
Ans. A DataReader provides a forward-only and read-only access to data, while the DataSet object can carry more than one table and at the same time hold the relationships between the tables. Also note that a DataReader is used in a connected architecture whereas a Dataset is used in a disconnected architecture.


Q99. Can connection strings be stored in web.config?
Ans. Yes, in fact this is the best place to store the connection string information.


Q100. Whats the difference between web.config and app.config?
Ans. Web.config is used for web based asp.net applications whereas app.config is used for windows based applications.
 if you want any interview question, post your comments, we will send you.

You can refer following link .Net Interview Question. 


Dot Net Inteview Questions -I


Dot Net Inteview Questions -II


Dot Net Inteview Questions -III
 

Dot Net Inteview Questions -IV


Dot Net Inteview Questions -V

If you have any questions or suggestion, Post your Comments. 

Dot Net Inteview Questions -IV

Q61. Is a delegate a type-safe functions pointer?
Ans. Yes

Q62. What is the return type of an event in .NET?
Ans. There is No return type of an event in .NET.

Q63. Is it possible to specify an access specifier to an event in .NET?
Ans. Yes, though they are public by default.

Q64. Is it possible to create a shared event in .NET?
Ans. Yes, but shared events may only be raised by shared methods.

Q65. How to prevent overriding of a class in .NET?
Ans. Use the keyword NotOverridable in VB.NET and sealed in C#.

Q66. How to prevent inheritance of a class in .NET?
Ans. Use the keyword NotInheritable in VB.NET and sealed in C#.

Q67. What is the purpose of the MustInherit keyword in VB.NET?
Ans. MustInherit keyword in VB.NET is used to create an abstract class.


Q68. What is the access modifier of a member function of in an Interface created in .NET?
Ans. It is always public, we cant use any other modifier other than the public modifier for the member functions of an Interface.

Q69. What does the virtual keyword in C# mean?
Ans. The virtual keyword signifies that the method and property may be overridden.


Q70. How to create a new unique ID for a control?
Ans. ControlName.ID = "ControlName" + Guid.NewGuid().ToString(); //Make use of the Guid class

Q71A. What is a HashTable in .NET?
Ans. A Hashtable is an object that implements the IDictionary interface, and can be used to store key value pairs. The key may be used as the index to access the values for that index.

Q71B. What is an ArrayList in .NET?
Ans. Arraylist object is used to store a list of values in the form of a list, such that the size of the arraylist can be increased and decreased dynamically, and moreover, it may hold items of different types. Items in an arraylist may be accessed using an index.

Q72. What is the value of the first item in an Enum? 0 or 1?
Ans. 0

Q73. Can we achieve operator overloading in VB.NET?
Ans. Yes, it is supported in the .NET 2.0 version, the "operator" keyword is used.

Q74. What is the use of Finalize method in .NET?
Ans. .NET Garbage collector performs all the clean up activity of the managed objects, and so the finalize method is usually used to free up the unmanaged objects like File objects, Windows API objects, Database connection objects, COM objects etc.

Q75. How do you save all the data in a dataset in .NET?
Ans. Use the AcceptChanges method which commits all the changes made to the dataset since last time Acceptchanges was performed.


Q76. Is there a way to suppress the finalize process inside the garbage collector forcibly in .NET?
Ans. Use the GC.SuppressFinalize() method.

Q77. What is the use of the dispose() method in .NET?
Ans. The Dispose method in .NET belongs to IDisposable interface and it is best used to release unmanaged objects like File objects, Windows API objects, Database connection objects, COM objects etc from the memory. Its performance is better than the finalize() method.


Q78. Is it possible to have have different access modifiers on the get and set methods of a property in .NET?
Ans. No we can not have different modifiers of a common property, which means that if the access modifier of a property's get method is protected, and it must be protected for the set method as well.

Q79. In .NET, is it possible for two catch blocks to be executed in one go?
Ans. This is NOT possible because once the correct catch block is executed then the code flow goes to the finally block.

Q80. Is there any difference between System.String and System.StringBuilder classes?
Ans. System.String is immutable by nature whereas System.StringBuilder can have a mutable string in which plenty of processes may be performed.
You can refer following link .Net Interview Question. 


Dot Net Inteview Questions -I


Dot Net Inteview Questions -II


Dot Net Inteview Questions -III
 

Dot Net Inteview Questions -IV


Dot Net Inteview Questions -V

Dot Net Inteview Questions -III

Q41. How to instruct the garbage collector to collect unreferenced data?
Ans. We may call the garbage collector to collect unreferenced data by executing the System.GC.Collect() method.

Q42. How can we set the Focus on a control in ASP.NET?
Ans. txtBox123.Focus(); OR Page.SetFocus(NameOfControl);

Q43. What are Partial Classes in Asp.Net 2.0?
Ans. In .NET 2.0, a class definition may be split into multiple physical files but partial classes do not make any difference to the compiler as during compile time, the compiler groups all the partial classes and treats them as a single class.

Q44. How to set the default button on a Web Form?
Ans.

Q45.Can we force the garbage collector to run?
Ans. Yes, using the System.GC.Collect(), the garbage collector is forced to run in case required to do so.

Q46. What is Boxing and Unboxing?
Ans. Boxing is the process where any value type can be implicitly converted to a reference type object while Unboxing is the opposite of boxing process where the reference type is converted to a value type.

Q47. What is Code Access security? What is CAS in .NET?
Ans. CAS is the feature of the .NET security model that determines whether an application or a piece of code is permitted to run and decide the resources it can use while running.

Q48. What is Multi-tasking?
Ans. It is a feature of operating systems through which multiple programs may run on the operating system at the same time, just like a scenario where a Notepad, a Calculator and the Control Panel are open at the same time.

Q49. What is Multi-threading?
Ans. When an application performs different tasks at the same time, the application is said to exhibit multithreading as several threads of a process are running.2

Q50. What is a Thread?
Ans. A thread is an activity started by a process and its the basic unit to which an operating system allocates processor resources.

Q51. What does AddressOf in VB.NET operator do?
Ans. The AddressOf operator is used in VB.NET to create a delegate object to a method in order to point to it.

Q52. How to refer to the current thread of a method in .NET?
Ans. In order to refer to the current thread in .NET, the Thread.CurrentThread method can be used. It is a public static property.

Q53. How to pause the execution of a thread in .NET?
Ans. The thread execution can be paused by invoking the Thread.Sleep(IntegerValue) method where IntegerValue is an integer that determines the milliseconds time frame for which the thread in context has to sleep.

Q54. How can we force a thread to sleep for an infinite period?
Ans. Call the Thread.Interupt() method.

Q55. What is Suspend and Resume in .NET Threading?

Ans. Just like a song may be paused and played using a music player, a thread may be paused using Thread.Suspend method and may be started again using the Thread.Resume method. Note that sleep method immediately forces the thread to sleep whereas the suspend method waits for the thread to be in a persistable position before pausing its activity.

Q56. How can we prevent a deadlock in .Net threading?
Ans. Using methods like Monitoring, Interlocked classes, Wait handles, Event raising from between threads, using the ThreadState property.

Q57. What is Ajax?
Ans. Asyncronous Javascript and XML - Ajax is a combination of client side technologies that sets up asynchronous communication between the user interface and the web server so that partial page rendering occur instead of complete page postbacks.

Q58. What is XmlHttpRequest in Ajax?
Ans. It is an object in Javascript that allows the browser to communicate to a web server asynchronously without making a postback.

Q59. What are the different modes of storing an ASP.NET session?
Ans. InProc (the session state is stored in the memory space of the Aspnet_wp.exe process but the session information is lost when IIS reboots), StateServer (the Session state is serialized and stored in a separate process call Viewstate is an object in .NET that automatically persists control setting values across the multiple requests for the same page and it is internally maintained as a hidden field on the web page though its hashed for security reasons.

Q60. What is a delegate in .NET?
Ans. A delegate in .NET is a class that can have a reference to a method, and this class has a signature that can refer only those methods that have a signature which complies with the class.


You can refer following link .Net Interview Question. 


Dot Net Inteview Questions -I


Dot Net Inteview Questions -II


Dot Net Inteview Questions -III
 

Dot Net Inteview Questions -IV


Dot Net Inteview Questions -V

Dot Net Inteview Questions -Object Oriented Programming Concept

Interview Question Object Oriented Programming Concept Like Encapsulation, Overriding, Class, Abstraction,Overloading and Inheritance.

Q21. What is encapsulation?
Ans. Encapsulation is the Basic OOPs concept of binding the attributes and behaviors in a class, hiding the implementation of the class and exposing the functionality.

Encapsulation is  used to hide the its data and method and only expose the data and method that is need.


Q22. What is Overloading?
Ans. When we add a new method with the same name in a same/derived class but with different number/types of parameters, the concept is called overload and this ultimately implements Polymorphism.

Q23. What is Overriding?
Ans. When we need to provide different implementation in a child class than the one provided by base class, we define the same method with same signatures in the child class and this is called overriding.

Q24. What is a Delegate?
Ans. A delegate is a strongly typed function pointer object that encapsulates a reference to a method, and so the function that needs to be invoked may be called at runtime.

Q25. Is String a Reference Type or Value Type in .NET?
Ans. String is a Reference Type object.

Q26. What is a Satellite Assembly?
Ans. Satellite assemblies contain resource files corresponding to a locale (Culture + Language) and these assemblies are used in deploying an application globally for different languages.

Q27. What are the different types of assemblies and what is their use?
Ans. Private, Public(also called shared) and Satellite Assemblies.

Q28. Are MSIL and CIL the same thing?
Ans. Yes, CIL is the new name for MSIL.

Q29. What is the base class of all web forms?
Ans. System.Web.UI.Page

Q30. How to add a client side event to a server control?
Ans. Example... BtnSubmit.Attributes.Add("onclick","javascript:fnSomeFunctionInJavascript()");

Q31. How to register a client side script from code-behind?
Ans. Use the Page.RegisterClientScriptBlock method in the server side code to register the script that may be built using a StringBuilder.

Q32. Can a single .NET DLL contain multiple classes?
Ans. Yes, a single .NET DLL may contain any number of classes within it.

Q33. What is DLL Hell?
Ans. DLL Hell is the name given to the problem of old unmanaged DLL's due to which there was a possibility of version conflict among the DLLs.

Q34. can we put a break statement in a finally block?
Ans. The finally block cannot have the break, continue, return and goto statements.

Q35. What is a CompositeControl in .NET?
Ans. CompositeControl is an abstract class in .NET that is inherited by those web controls that contain child controls within them.


Q36. Which control in asp.net is used to display data from an xml file and then displayed using XSLT?
Ans. Use the asp:XML control and set its DocumentSource property for associating an XML file, and set its TransformSource property to set the XML control's XSL file for the XSLT transformation.


Q37. Can we run ASP.NET 1.1 application and ASP.NET 2.0 application on the same computer?
Ans. Yes, though changes in the IIS in the properties for the site have to be made during deployment of each.

Q38. What are the new features in .NET 2.0?
Ans. Plenty of new controls, Generics, anonymous methods, partial classes, iterators, property visibility (separate visibility for get and set) and static classes.

Q39. Can we pop a MessageBox in a web application?
Ans. Yes, though this is done client side using an alert, prompt or confirm or by opening a new web page that looks like a messagebox.

Q40. What is managed data?
Ans. The data for which the memory management is taken care by .Net run time garbage collector, and this includes tasks for allocation de-allocation.

We have Hundreds of  Latest Dot Net Interview Questions.

Dot Net Inteview Questions -I
Dot Net Inteview Questions -II
Dot Net Inteview Questions -III

Dot Net Inteview Questions -IV
Dot Net Inteview Questions -V

.Net Remoting Interview Question and answer

1.  What’s a Windows process?
It’s an application that’s running and had been allocated memory.

2.  What’s typical about a Windows process in regards to memory allocation?
Each process is allocated its own block of available RAM space, no process can access another process’ code or data. If the process crashes, it dies alone without taking the entire OS or a bunch of other applications down.

3.  Explain what relationship is between a Process, Application Domain, and Application?
A process is an instance of a running application. An application is an executable on the hard drive or network. There can be numerous processes launched of the same application (5 copies of Word running), but 1 process can run just 1 application.

4. What are possible implementations of distributed applications in .NET?
.NET Remoting and ASP.NET Web Services. If we talk about the Framework Class Library, noteworthy classes are in System.Runtime.Remoting and System.Web.Services.

5. What are the consideration in deciding to use .NET Remoting or ASP.NET Web Services?
Remoting is a more efficient communication exchange when you can control both ends of the application involved in the communication process. Web Services provide an open-protocol-based exchange of informaion. Web Services are best when you need to communicate with an external organization or another (non-.NET) technology.

6.  What’s a proxy of the server object in .NET Remoting?
It’s a fake copy of the server object that resides on the client side and behaves as if it was the server. It handles the communication between real server object and the client object. This process is also known as marshaling.

7. What are remotable objects in .NET Remoting?
Remotable objects are the objects that can be marshaled across the application domains. You can marshal by value, where a deep copy of the object is created and then passed to the receiver. You can also marshal by reference, where just a reference to an existing object is passed.

8. What are channels in .NET Remoting?
Channels represent the objects that transfer the other serialized objects from one application domain to another and from one computer to another, as well as one process to another on the same box. A channel must exist before an object can be transferred.


9. What security measures exist for .NET Remoting in System.Runtime.Remoting?
None. Security should be taken care of at the application level. Cryptography and other security techniques can be applied at application or server level.

10.  What is a formatter?
A formatter is an object that is responsible for encoding and serializing data into messages on one end, and deserializing and decoding messages into data on the other end.

11. Choosing between HTTP and TCP for protocols and Binary and SOAP for formatters, what are the trade-offs?
Binary over TCP is the most effiecient, SOAP over HTTP is the most interoperable.

12. What’s SingleCall activation mode used for?
If the server object is instantiated for responding to just one single request, the request should be made in SingleCall mode.

13.  What’s Singleton activation mode?
A single object is instantiated regardless of the number of clients accessing it. Lifetime of this object is determined by lifetime lease.


14. How do you define the lease of the object?
By implementing ILease interface when writing the class code.


15.  Can you configure a .NET Remoting object via XML file?
Yes, via machine.config and application level .config file (or web.config in ASP.NET). Application-level XML settings take precedence over machine.config.


16. How can you automatically generate interface for the remotable object in .NET with Microsoft tools?
Use the Soapsuds tool.

Dot Net Inteview Questions -I

.NET Interview Questions


Q1. Explain the differences between Server-side and Client-side code?
Ans. Server side code will execute at server (where the website is hosted) end, & all the business logic will execute at server end where as client side code will execute at client side (usually written in javascript, vbscript, jscript) at browser end.

Q2. What type of code (server or client) is found in a Code-Behind class?
Ans. Server side code.

Q3. How to make sure that value is entered in an asp:Textbox control?
Ans. Use a RequiredFieldValidator control.

Q4. Which property of a validation control is used to associate it with a server control on that page?
Ans. ControlToValidate property.


Q5. How would you implement inheritance using VB.NET & C#?
Ans. C# Derived Class : Baseclass
VB.NEt : Derived Class Inherits Baseclass

Q6. Which method is invoked on the DataAdapter control to load the generated dataset with data?
Ans. Fill() method.

Q7. What method is used to explicitly kill a user's session?
Ans. Session.Abandon()

Q8. What property within the asp:gridview control is changed to bind columns manually?
Ans. Autogenerated columns is set to false

Q9. Which method is used to redirect the user to another page without performing a round trip to the client?
Ans. Server.Transfer method.


Q10. How do we use different versions of private assemblies in same application without re-build?
Ans.Inside the Assemblyinfo.cs or Assemblyinfo.vb file, we need to specify assembly version.
assembly: AssemblyVersion

Q11. Is it possible to debug java-script in .NET IDE? If yes, how?
Ans. Yes, simply write "debugger" statement at the point where the breakpoint needs to be set within the javascript code and also enable javascript debugging in the browser property settings.

Q12. How many ways can we maintain the state of a page?
Ans. 1. Client Side - Query string, hidden variables, viewstate, cookies
2. Server side - application , cache, context, session, database

Q13. What is the use of a multicast delegate?
Ans. A multicast delegate may be used to call more than one method.

Q14. What is the use of a private constructor?
Ans. A private constructor may be used to prevent the creation of an instance for a class.

Q15. What is the use of Singleton pattern?
Ans. A Singleton pattern .is used to make sure that only one instance of a class exists.

Q16. When do we use a DOM parser and when do we use a SAX parser?
Ans. The DOM Approach is useful for small documents in which the program needs to process a large portion of the document whereas the SAX approach is useful for large documents in which the program only needs to process a small portion of the document.

Q17. Will the finally block be executed if an exception has not occurred?
Ans.Yes it will execute.


Q18. What is a Dataset?
Ans. A dataset is an in memory database kindof object that can hold database information in a disconnected environment.

Q19. Is XML a case-sensitive markup language?
Ans. Yes.

Q20. What is an .ashx file?
Ans. It is a web handler file that produces output to be consumed by an xml consumer client (rather than a browser).

You can refer following link .Net Interview Question. 


Dot Net Inteview Questions -I
Dot Net Inteview Questions -II
Dot Net Inteview Questions -III 

Dot Net Inteview Questions -IV
Dot Net Inteview Questions -V

Interview questions for .NET Framework

Here I am giving Some Basic Interview questions for .NET. 
1. What is a static class?
2. What is static member?
3. What is static function?
4. What is static constructor?
5. How can we inherit a static variable?
6. How can we inherit a static member?
7. Can we use a static function with a non-static variable?
8. How can we access static variable?
9. Why main function is static?

10. How will you load dynamic assembly? How will create assesblies at run time?
11. What is Reflection?
12. If I have more than one version of one assemblies, then how will I use old version (how/where to specify version number?) in my application?
13. How do you create threading in.NET? What is the namespace for that?
14. What do you mean by Serialize and MarshalByRef?
15. What is the difference between Array and LinkedList?
16. What is Asynchronous call and how it can be implemented using delegates?
17. How to create events for a control? What is custom events? How to create it?
18. If you want to write your own dot net language, what steps you will you take care?
19. Describe the diffeerence between inline and code behind - which is best in a loosely coupled solution?
20. How dot net compiled code will become platform independent?
21. Without modifying source code if we compile again, will it be generated MSIL again?
22. How does you handle this COM components developed in other programming languages in.NET?
23. How CCW (Com Callable Wrapper) and RCW (Runtime Callable Wrappers) works?
24. What are the new thee features of COM+ services, which are not there in COM (MTS)?
25. What are the differences between COM architecture and.NET architecture?
26. Can we copy a COM dll to GAC folder?
27. What is Shared and Repeatable Inheritance?
28. Can you explain what inheritance is and an example of when you might use it?
29. How can you write a class to restrict that only one object of this class can be created (Singleton class)?
30. What are virtual destructures?
31. What is close method? How its different from Finalize and Dispose?
32. What is Boxing and UnBoxing?
33. What is check/uncheck?
34. What is the use of base keyword? Tell me a practical example for base keyword’s usage?
35. What are the different.NET tools which you used in projects?
36. What will do to avoid prior case?
37. What happens when you try to update data in a dataset in.NET while the record is already deleted in SQL Server as backend?
38. What is concurrency? How will you avoid concurrency when dealing with dataset?
39. One user deleted one row after that another user through his dataset was trying to update same row. What will happen? How will you avoid this problem?
40. How do you merge two datasets into the third dataset in a simple manner?
41. If you are executing these statements in commandObject. “Select * from Table1; Select * from Table2? How you will deal result set?
42. How do you sort a dataset.
43. If a dataset contains 100 rows, how to fetch rows between 5 and 15 only?
44. What is the use of Parameter object?
45. How to generateXML from a dataset and vice versa?
46. How do you implement locking concept for dataset?
47. How will you do Redo and Undo in TextBox control?
48. How to implement DataGrid in.NET? How would you make a combo-box appear in one column of a DataGrid? What are the ways to show data grid inside a data grid for a master details type of tables? If we write any code for DataGrid methods. what is the access specifier used for that methods in the code behind file and why?
49. How can we create Tree control in asp.NET?
50. Write a program in C# to find the angle between the hours and minutes in a clock?
51. Write a program to create a user control with name and surname as data members and login as method and also the code to call it.
52. How can you read 3rd line from a text file?
53. Explain the code behind wors and contrast that using the inline style.
54. Explain different types of HTML, Web and server controls.
55. What are the differences between user control and server control?
56. How server form post-back works?
57. Can the action attribute of a server-side
tag be set to a value and if not how can you possibly pass data from a form page to a subsequent page?
58. How would ASP and ASP.NET apps run at the same time on the same server?
59. What are good ADO.NET object to replace to ADO Recordset object.
60. Explain the differences between Server-side code and Client-side code.
61. What type of code(server or client) is found in a Code-Behind class?
62. Should validation (did the user enter a real date) occur server-side or client-side? Why?
63. What does the “EnableViewState” property do? Why would I want it on or off?
64. What is the difference between Server.Transfer and response.Redirect? Why?
65. Can you give an example of when it would be appropriate to use a web service as opposed to a non-serviced.NET component?
66. Let’s say I have an existing application written using VB6 and this application utilizes Windows 2000 COM+ transaction services. How would you approach migrating this application to.NET?
67. If I am developing an application that must accomodate multiple security levels though secure login and my ASP.NET web application is spanned across three web-servers (using round-robin load balancing). What would be the best approach to maintain login-in state for the users?
68. What are ASP.NET web forms? How is this technology different than what is available though ASP(1.0-3.0)?
69. How does VB.NET achieve polymorphism?
70. How does C# achieve polymorphism?
71. Can you explain what is Inheritance and an example in VB.NET and C# of when you might use it?
72. Describe difference between inline and code-behind?
73. What is loosely coupled solution in.NET?
74. What is diffgram?
75. Where would you use an iHTTPModule and what are the limitations of any approach you might take in implementing one?
76. What are the Advantages and DisAdvantages of viewstate?
77. Describe session handling in a webform, how does it work and what are the limitations?
78. How would you get ASP.NET running in Apache web servers? Explain it’s limitations.
79. What is MSIL and why should my developers need an appreciation of it if at all?
80. Which methos do you invoke on the DataAdapter control to load your generated dataset with data?
81. Can you edit data in Repeater control? How?
82. Which template must you provide, in order to display data in a Repeater control?
83. How can you provide an alternating color scheme in a Repeater control?
84. What property must you set, and what method must you call in your code, in order to bind the data from some data source to the repeater control?
85. What base class do all web forms inherit from?
86. What method do you use to explicitly kill a user’s session? How?
87. How do you turn off cookies for one page in your site? Give an example.
88. Which two properties are on every validation control?
89. What tags do you need to add within the asp:datagrid tags to bind columns manually? Give an example.
90. How do you create a permanent cookie?
91. What tag do you use to add a hyperlink column to the dataGrid?
92. What is the standard you use to wrap up a call to a Web Service?
93. Which method do you use to redirect the user to another page without performing a round trip to the client? How?
94. What is the transport protocol you use to call a Seb Service SOAP?
95. What does WSDL stand for?
96. What property do you have to set to tell the grid which page to go to when using the Pager object?
97. Where on the Internet would you look for Web Services?
98. What tags do you need to add within the asp:datagrid tags to bind columns manually? How?
99. Which property on a Combo Box do you set with a column name, prior to setting the DataSource, to display data in the combo box?
100. How is a property designated as read-only?
101. Which control would you use if you needed to make sure the values in two different controls matched?

If you want add any question here, please your Question and Answer. Thanks for Reading My blog

Advanced C# questions

1. What's the advantage of using System.Text.StringBuilder over System.String?

StringBuilder is more efficient in the cases, where a lot of manipulation is done to the text. Strings are immutable, so each time it's being operated on, a new instance is created.

2. Can you store multiple data types in System.Array?

No.

3. What's the difference between the System.Array.CopyTo() and System.Array.Clone()?

The first one performs a deep copy of the array, the second one is shallow.

4. How can you sort the elements of the array in descending order?

By calling Sort() and then Reverse() methods.

5. What's the .NET datatype that allows the retrieval of data by a unique key?

HashTable.

6. What's class SortedList underneath?

A sorted HashTable.

7. Will finally block get executed if the exception had not occurred?

Yes.

8. What's the C# equivalent of C++ catch (…), which was a catch-all statement for any possible exception?

A catch block that catches the exception of type System.Exception. You can also omit the parameter data type in this case and just write catch {}.

9. Can multiple catch blocks be executed?

No, once the proper catch code fires off, the control is transferred to the finally block (if there are any), and then whatever follows the finally block.

10.Why is it a bad idea to throw your own exceptions?

Well, if at that point you know that an error has occurred, then why not write the proper code to handle that error instead of passing a new Exception object to the catch block? Throwing your own exceptions signifies some design flaws in the project.

11.What's a delegate?

A delegate object encapsulates a reference to a method. In C++ they were referred to as function pointers.

12.What's a multicast delegate?

It's a delegate that points to and eventually fires off several methods.

13.How's the DLL Hell problem solved in .NET?

Assembly versioning allows the application to specify not only the library it needs to run (which was available under Win32), but also the version of the assembly.

14.What are the ways to deploy an assembly?

An MSI installer, a CAB archive, and XCOPY command.

15.What's a satellite assembly?

When you write a multilingual or multi-cultural application in .NET, and want to distribute the core application separately from the localized modules, the localized assemblies that modify the core application are called satellite assemblies.

16.What namespaces are necessary to create a localized application?

System.Globalization, System.Resources.

17.What's the difference between // comments, /* */ comments and /// comments?

Single-line, multi-line and XML documentation comments.

18.How do you generate documentation from the C# file commented properly with a command-line compiler?

Compile it with a /doc switch.

19.What's the difference between and XML documentation tag?


Single line code example and multiple-line code example.

20.Is XML case-sensitive?

Yes, so and are different elements.

21.What debugging tools come with the .NET SDK?

CorDBG – command-line debugger, and DbgCLR – graphic debugger. Visual Studio .NET uses the DbgCLR. To use CorDbg, you must compile the original C# file using the /debug switch.

22.What does the This window show in the debugger?

It points to the object that's pointed to by this reference. Object's instance data is shown.

23.What does assert() do?

In debug compilation, assert takes in a Boolean condition as a parameter, and shows the error dialog if the condition is false. The program proceeds without any interruption if the condition is true.

24.What's the difference between the Debug class and Trace class?


Documentation looks the same. Use Debug class for debug builds, use Trace class for both debug and release builds.

25.Why are there five tracing levels in System.Diagnostics.TraceSwitcher?


The tracing dumps can be quite verbose and for some applications that are constantly running you run the risk of overloading the machine and the hard drive there. Five levels range from None to Verbose, allowing to fine-tune the tracing activities.

26.Where is the output of TextWriterTraceListener redirected?


To the Console or a text file depending on the parameter passed to the constructor.

27.How do you debug an ASP.NET Web application?


Attach the aspnet_wp.exe process to the DbgClr debugger.

28.What are three test cases you should go through in unit testing?

Positive test cases (correct data, correct output), negative test cases (broken or missing data, proper handling), exception test cases (exceptions are thrown and caught properly).

29.Can you change the value of a variable while debugging a C# application?

Yes, if you are debugging via Visual Studio.NET, you can change the value of variables by using the command window. Type IMMED in the command window prompt to switch to immediate mode which will get rid of the \">\". TO manipulate a variable in the command window, type strCustomerName.Value = \"TechInterview INC\” or txtComments.innerText = \"New String value\” and it will override the old value in strCustomerName with the new value.

30.Explain the three services model (three-tier application).


Presentation (UI), business (logic and underlying code) and data (from storage or other sources).

31.What are advantages and disadvantages of Microsoft-provided data provider classes in ADO.NET?

SQLServer.NET data provider is high-speed and robust, but requires SQL Server license purchased from Microsoft. OLE-DB.NET is universal for accessing other sources, like Oracle, DB2, Microsoft Access and Informix, but it's a .NET layer on top of OLE layer, so not the fastest thing in the world. ODBC.NET is a deprecated layer provided for backward compatibility to ODBC engines.

32.What's the role of the DataReader class in ADO.NET connections?


It returns a read-only dataset from the data source when the command is executed.

33.What is the wildcard character in SQL?Let's say you want to query database with LIKE for all employees whose name starts with La.


The wildcard character is %, the proper query with LIKE would involve 'La%'.

34.Explain ACID rule of thumb for transactions.

Transaction must be Atomic (it is one unit of work and does not dependent on previous and following transactions), Consistent (data is either committed or roll back, no “in-between” case where something has been updated and something hasn’t), Isolated (no transaction sees the intermediate results of the current transaction), Durable (the values persist if the data had been committed even if the system crashes right after).

35.What connections does Microsoft SQL Server support?

Windows Authentication (via Active Directory) and SQL Server authentication (via Microsoft SQL Server username and passwords).

36.Which one is trusted and which one is untrusted?

Windows Authentication is trusted because the username and password are checked with the Active Directory, the SQL Server authentication is untrusted, since SQL Server is the only verifier participating in the transaction.

37.Why would you use untrusted verificaion?

Web Services might use it, as well as non-Windows applications.

38.What does the parameter Initial Catalog define inside Connection String?

The database name to connect to.

39.What's the data provider name to connect to Access database?

Microsoft.Access.

40.What does Dispose method do with the connection object?

Deletes it from the memory.

41.What is a pre-requisite for connection pooling?

Multiple processes must agree that they will share the same connection, where every parameter is the same, including the security settings.

Asp.Net Interview Questions and answer

1. Describe the role of inetinfo.exe, aspnet_isapi.dll andaspnet_wp.exe in the page loading process.
inetinfo.exe is theMicrosoft IIS server running, handling ASP.NET requests among other things.When an ASP.NET request is received (usually a file with .aspx extension), the ISAPI filter aspnet_isapi.dll takes care of it by passing the request tothe actual worker process aspnet_wp.exe.


2. What’s the difference between Response.Write() andResponse.Output.Write()?
Response.Output.Write() allows you to write formatted output.


3. What methods are fired during the page load?
Init() - when the page is instantiated
Load() - when the page is loaded into server memory
PreRender() - the brief moment before the page is displayed to the user as HTML
Unload() - when page finishes loading.


4. When during the page processing cycle is ViewState available?
After the Init() and before the Page_Load(), or OnLoad() for a control.


5. What namespace does the Web page belong in the .NET Framework class hierarchy?
System.Web.UI.Page

6. Where do you store the information about the user’s locale?
System.Web.UI.Page.Culture


7. What’s the difference between Codebehind="MyCode.aspx.cs" andSrc="MyCode.aspx.cs"?
CodeBehind is relevant to Visual Studio.NET only.

8. What’s a bubbled event?
When you have a complex control, like DataGrid, writing an event processing routine for each object (cell, button, row, etc.) is quite tedious. The controls can bubble up their eventhandlers, allowing the main DataGrid event handler to take care of its constituents.

9. Suppose you want a certain ASP.NET function executed on MouseOver for a certain button. Where do you add an event handler?
Add an OnMouseOver attribute to the button. Example: btnSubmit.Attributes.Add("onmouseover","someClientCodeHere();");


10. What data types do the RangeValidator control support?
Integer, String, and Date.

11. Explain the differences between Server-side and Client-side code?
Server-side code executes on the server. Client-side code executes in the client's browser.


12. What type of code (server or client) is found in a Code-Behind class?
The answer is server-side code since code-behind is executed on the server. However, during the code-behind's execution on the server, it can render client-side code such as JavaScript to be processed in the clients browser. But just to be clear, code-behind executes on the server, thus making it server-side code.

13. Should user input data validation occur server-side or client-side? Why?
All user input data validation should occur on the server at a minimum. Additionally, client-side validation can be performed where deemed appropriate and feasable to provide a richer, more responsive experience for the user.

14. What is the difference between Server.Transfer and Response.Redirect? Why would I choose one over the other?
Server.Transfer transfers page processing from one page directly to the next page without making a round-trip back to the client's browser. This provides a faster response with a little less overhead on the server. Server.Transfer does not update the clients url history list or current url. Response.Redirect is used to redirect the user's browser to another page or site. This performas a trip back to the client where the client's browser is redirected to the new page. The user's browser history list is updated to reflect the new address.

15. Can you explain the difference between an ADO.NET Dataset and an ADO Recordset?
Valid answers are:
· A DataSet can represent an entire relational database in memory, complete with tables, relations, and views.
· A DataSet is designed to work without any continuing connection to the original data source.
· Data in a DataSet is bulk-loaded, rather than being loaded on demand.
· There's no concept of cursor types in a DataSet.
· DataSets have no current record pointer You can use For Each loops to move through the data.
· You can store many edits in a DataSet, and write them to the original data source in a single operation.
· Though the DataSet is universal, other objects in ADO.NET come in different versions for different data sources.

16. What is the Global.asax used for?
The Global.asax (including the Global.asax.cs file) is used to implement application and session level events.

17. What are the Application_Start and Session_Start subroutines used for?
This is where you can set the specific variables for the Application and Session objects.

18. Can you explain what inheritance is and an example of when you might use it?
When you want to inherit (use the functionality of) another class. Example: With a base class named Employee, a Manager class could be derived from the Employee base class.

19. Whats an assembly?
Assemblies are the building blocks of the .NET framework. Overview of assemblies from MSDN

20. Describe the difference between inline and code behind.
Inline code written along side the html in a page. Code-behind is code written in a separate file and referenced by the .aspx page.

21. Explain what a diffgram is, and a good use for one?
The DiffGram is one of the two XML formats that you can use to render DataSet object contents to XML. A good use is reading database data to an XML file to be sent to a Web Service.

22. Whats MSIL, and why should my developers need an appreciation of it if at all?
MSIL is the Microsoft Intermediate Language. All .NET compatible languages will get converted to MSIL. MSIL also allows the .NET Framework to JIT compile the assembly on the installed computer.

23. Which method do you invoke on the DataAdapter control to load your generated dataset with data?
The Fill() method.

24. Can you edit data in the Repeater control?
No, it just reads the information from its data source.

25. Which template must you provide, in order to display data in a Repeater control?
ItemTemplate.

26. How can you provide an alternating color scheme in a Repeater control?
Use the AlternatingItemTemplate.

27. What property must you set, and what method must you call in your code, in order to bind the data from a data source to the Repeater control?
You must set the DataSource property and call the DataBind method.

28. What base class do all Web Forms inherit from?
The Page class.

29. Name two properties common in every validation control?
ControlToValidate property and Text property.

30. Which property on a Combo Box do you set with a column name, prior to setting the DataSource, to display data in the combo box?
DataTextField property.

31. Which control would you use if you needed to make sure the values in two different controls matched?
CompareValidator control.

32. How many classes can a single .NET DLL contain?
It can contain many classes.

Asp.Net Interview Questions

Which controls do not have events?


What is the difference between ADO and ADO.NET?


How u can create XML file?


What is CLR?

What is "Common Type System" (CTS)?


What Is The Difference Between ViewState and SessionState


How would one do a deep copy in .NET?


What is Web.config?


Why is catch(Exception) almost always a bad idea?


What is strong-typing versus weak-typing? Which is preferred? Why?


Advantages of VB.NET


Which two properties are on every validation control?


What is the difference between a.Equals(b) and a == b?


How do you turn off cookies for one page in your site?


What is a Strong Name?


What is cts and cls?


What is the difference between VB and VB.NET?


What is the difference between the C#.NET and VB.NET?


Which property on a Combo Box do you set with a column name, prior to setting the DataSource, to display data in the combo box?

True or False: A Web service can only be written in .NET

web services is not only for .net,
we can develop webservices nin any language,becoz web services is the concept of XML .so,any one can follow these rules and can develop webservices.


XML webservices is rules.but ASP.NET websevices is a s/w with these webservices any other language people can comm to it.


What is the root class in .Net ?
System.object is the root class in .net


What are the advantages and drawbacks of using ADO.NET?


How do you create a permanent cookie?



What is cyclomatic complexity and why is it important?


In .NET Compact Framework, can I free memory explicitly without waiting for garbage collector to free the memory?


What is the difference between thread and process?


Advantages of migrating to VB.NET


How different are interface and abstract class in .Net?


What tags do you need to add within the asp:datagrid tags to bind columns manually?


How does VB.NET/C# achieve polymorphism?


What is serialization, how it works in .NET?


What are value types and reference types?


How many classes can a single .NET DLL contain?


What is the Scope of public/private/friend/protected/protected friend ?


What is managed code and managed data?


What are Assemblies.


What is .NET / .NET Framework?


What does WSDL stand for?


Can we run .NET in unix plateform?


Explain how Viewstate is being formed and how it?s stored on client.


Which control cannot be placed in MDI?


What tags do you need to add within the asp:datagrid tags to bind columns manually.


What is FullTrust? Do GAC?ed assemblies have FullTrust?


Explain DataSet.AcceptChanges and DataAdapter.Update methods.


What is an Interface?


Give the detail procedure of how to add different controls at runtime in VB and dot Net. The controls should be added as per the customers requirement at the customers place without intervention of the programmer. Similarly how to remove these controls which are generated by the customer at runtime?


Differences between Datagrid, Datalist and Repeater?


What is Machine.config?


How can I read .doc document in ASP.Net?


What are the Types of Assemblies?


What tag do you use to add a hyperlink column to the DataGrid?


What is the difference between "using System.Data;" and directly adding the reference from "Add References Dialog Box"?


How to clear a datagrid on a button click?


Briefly explain how the server control validation controls work.


Describe ways of cleaning up objects.


Should validation (did the user enter a real date) occur server-side or client-side? Why?


What?s wrong with a line like this ? DateTime.Parse(myString).


What is a Manifest?


What is a Web Service?







Briefly explain how server form post-back works (perhaps ask about view state as well).


What is the Main difference between ASP and ASP.NET ?


What is CLR?


What is the difference between VB6 and VB.Net?


With respect to security ,which one is the better choice?.Net or J2EE? Explain.


What is "Common Language Specification" (CLS)?


Explain the differences between Server-side and Client-side code?


What is the purpose of reserved word ?using? in C#?


Explain manifest & metadata.


Explain about code access security?


what's ArrayList in .Net (VB.Net or C#) What's the advantageous using ArrayList.


What is Reflection?


What is an Intermediate language?


How is a property designated as read-only?


What property do you have to set to tell the grid which page to go to when using


Explain what a diffgram is, and a good use for one


Is string a value type or a reference type?


Describe the difference between inline and code behind - which is best in a loosely coupled solution.


What are the authentication methods in .NET?


What is the difference between proc. sent BY VAL and By Ref?

With respect to security ,which one is the better choice ,.Net or J2EE? Explain.........


How many types of assemblies are there , wat are they?


How does the XmlSerializer work? What ACL permissions does a process using it require


Difference between Panel and GroupBox classes?


16. What are Attributes?


How would ASP and ASP.NET apps run at the same time on the same server?


NET is Compile Time OR RunTime Environment?


What is an interface and what is an abstract class? Please, expand by examples of using both. Explain why.


What exactly is being serialized when you perform serialization?


Can you give an example of what might be best suited to place in the application_Start and Session_Start subroutines?


Where on the Internet would you look for Web services?


What is the purpose of DOTNET?


What is the transport protocol you use to call a Web service SOAP


Can you explain what inheritance is and an example of when you might use it?


What are PDBs? Where must they be located for debugging to work?


When multiple users are working on one application, the SQL/Oracle statement gets locked when one user is working, thus another user cannot work simultaneously. How can multiple users work. Thus give me syntax for freeing SQL/Oracle queries in order for working of multiple users.


What are ASP.NET Web Forms? How is this technology different than what is available though ASP (1.0-3.0)?


What type of code (server or client) is found in a Code-Behind class?


What should you do to store an object in a Viewstate?


Using ActiveX Control in .Net


Can the action attribute of a server-side tag be set to a value and if not how can you possibly pass data from a form page to a subsequent page. Briefly describe the role of global.asax.


Briefly explain what user controls are and what server controls are and the differences between the two.


How does the lifecycle of Windows services differ from Standard EXE?


Which template must you provide, in order to display data in a Repeater control?


Which method do you invoke on the DataAdapter control to load your generated dataset with data?


In what order do the events of an ASPX page execute. As a developer is it important to understand these events?


What is the difference between Debug.Write and Trace.Write? When should each be used?


Describe session handling in a webfarm, how does it work and what are the limits


Contrast the use of an abstract base class against an interface?


Whats an assembly ..?


What does this do? gacutil /l | find /i ?about?


Can you give an example of what might be best suited to place in the Application Start and Session Start subroutines?


What are the differences between ASP and ASP .Net ?


What is the difference between Servers? Transfer and Response. Redirect? Why would I choose one over the other?


What is the base class of Button control?


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


What is connection pooling and how do you make your application use it?


What should one do to make class serializable?


What?s the use of System.Diagnostics.Process class?


What are the two kinds of properties.



RaiseEvent eventname[( argumentlist )]


Which property of the textbox cannot be changed at runtime?


webFarm Vs webGardens


What is Delegation?


Can implement same method name in both base class And derived class with different action?


Can you explain the difference between an ADO.NET Dataset and an ADO Recordset?


What are HTML controls, Web controls, and server controls.


Can you give an example of when it would be appropriate to use a web service as opposed to a non-serviced .NET component


Why The JavaScript Validation Not Run on the Asp.Net Button But Run SuccessFully On The HTML Button


How does output caching work in ASP.NET?


What is an interface and what is an abstract class? Please, expand by examples of using both. Explain why.


What is the RaiseEvent used for?


Parts


Creating a Key Pair


What is "Microsoft Intermediate Language" (MSIL)?


Can you edit data in the Repeater control?


How would you implement inheritance using VB.NET/C#?


What is an interface and what is an abstract class? Please, expand by examples of using both. Explain why.


ASP.NET Authentication Providers and IIS Security


What is a Metadata?


What is an assembly?


What is "Common Language Runtime" (CLR)?


Can you give an example of when it would be appropriate to use a web service as opposed to a non-serviced .NET component


What is the Pager object?


What base class do all Web Forms inherit from?


How can you provide an alternating color scheme in a Repeater control?


What are the features of ADO.Net ?


How would you get ASP.NET running in Apache web servers - why would you even do this?


Contrast OOP and SOA. What are tenets of each ?


What does the


Name some of the languages .NET support?


What is the difference between user control an custom control? What are the advantages/disadvantages?


What is the use of ErrorProvider Control?


Can any object be stored in a Viewstate?


What do you know about ADO.NET?s objects and methods?


ctype(123.34,integer) - should it throw an error? Why or why not?


What is the difference between imperative and interrogative code?


What is a constructor ?


What is GAC?


Briefly explain how code behind works and contrast that using the inline style.

What is the standard you use to wrap up a call to a Web service


What is a Windows Service and how does its lifecycle differ from a ?standard? EXE?


What property must you set, and what method must you call in your code, in order to bind the data from some data source to the Repeater control?


Whats MSIL, and why should my developers need an appreciation of it if at all?


What is the difference between a Debug and Release build? Is there a significant speed difference? Why or why not?


What are the disadvantages of viewstate/what are the benefits


Can you explain what inheritance is and an example of when you might use it?


Where would you use an iHTTPModule, and what are the limitations of any approach you might take in implementing one


What is boxing?


What is the difference between an EXE and a DLL?


How would you implement inheritance using VB.NET/C#?


Can you explain the difference between an ADO.NET Dataset and an ADO Recordset?


How many types of exception handlers are there in .NET?


Difference between Panel and GroupBox classes?


What is Response object? How is it related to ASP?s Response object?


What is Viewstate?


State and explain about Microsoft.net?


Explain about CLR?


What is an Abstract class?


Explain about the base class library provided by Microsoft.NET?

Explain about Common language infrastructure?


Explain about metadata?


directcast(123.34,integer) - should it throw an error? Why or why not?


Explain about appdomains?


How can you clean up objects holding resources from within the code


Difference between a sub and a function.


Explain about Validation?


Explain about developer benefit from memory management?


Explain about .NET Garbage collector?


Explain the process of GC?


Explain about generation?


Explain about WPF?


What is the maximum size of the textbox?


State the different levels of exceptional safety?


Explain about continuable exceptions?


Explain some of the disadvantages due to Microsoft.NET?


Name some changes done since version 3.0?


Using COM Component in .Net


What is the difference between ASP and ASP.NET?


Given a server with 4 cpu's, and no databases write a pseudocode to search for the word camera in 100,000 html documents.


How will you make .NET programs work in Linux ?


what i do for load testing in . net application .


Can i change private assembly to shared assembly?How?


What is the difference between a namespace and assembly name?


What are good ADO.NET object(s) to replace the ADO Recordset object.


True or False: To test a Web service you must create a windows application or Web application to consume this service?


Which control would you use if you needed to make sure the values in two different controls matched?


Which method do you use to redirect the user to another page without performing a round trip to the client?


What method do you use to explicitly kill a user session?

Differnce between ASP.Net Vs ASP

ASP stands for Active Server Pages. ASP.NET is the next generation of ASP. After the introduction of ASP.NET, old ASP is called 'Classic ASP'.

Classic ASP uses vb script for server side coding. Vb Script is not supported any more in ASP.NET. Instead, ASP.NET supports more languages including C#, VB.NET, J# etc. VB.NET is very similar to vb script, so it should be easy for old Visual Basic or ASP programmers to switch to VB.NET and ASP.NET

VB Script is a simple scripting language, where as VB.NET or C# are modern, very powerfull, object oriented programming languages. Just for that reason, you will be able to write much more robust and reliable programs in ASP.NET compared to ASP.

In classic ASP, there was no server controls. You have to write all html tags manually. ASP.NET offers a very rich set of controls called Server Controls and Html Controls. It is very easy to drag and drop any controls to a web form. The VS.NET will automatically write the required HTML tags automatically for you.

ASP is interpreted, ASP.NET is compiled

Since ASP uses vb script, there is no compilation. All ASP pages are interpreted when th page is executed.

ASP.NET uses modern .NET languages like C#, VB.NET etc. They can be compiled to efficient Microsoft Intermediate Language (MSIL). When you compile an ASP.NET application, the server side code is compiled to assemblies. These assemblies are loaded at run time which makes the ASP.NET pages perform better than classic ASP.

ADO and ADO.NET

Classic ASP uses a technology called ADO to connect and work with databases. ASP.NET uses the ADO.NET technology (which is the next generation of ADO).

Event driven programming


If you have written Visual Basic programs before, you would love the event driven programming approach. It is so easy to drag and drop a button control and double click on the button to write the event handler for the button click event. When you click on the button at turn time, it will execute whatever code you have written in the event handler.

This type of event driven programming was not available with classic ASP. You cannot drag and drop a button and write a 'on click' event handler with ASP.

With ASP.NET, this is changed. It works pretty much like your Visual Basic program. You can write event handlers for several events like button click event, text changed event etc.

However, there is big difference between the way event handling works in regular Visual basic and ASP.NET. In ASP.NET, a page is loaded in the client browser. And the server may be in another location (may be in another country). When you click on the button in an ASP.NET page, the 'click event' handler has to be executed on the server, not on the client.

How does the server know when you click on a button your browser? This is a tricky thing in ASP.NET. When you write an event handler for a button lick or something like that in ASP.NET, lot of things happens behind the screens. ASP.NET will produce lot of client side javascript code to handle this and embed this javascript in the html page it sends to the browser. When you click on the button in the browser, the client side javascript will get executed. This javascript will generate some information required for the server and and submit the page request to the server. There is enough information embedded in this request so that the server will understand that user has clicked a specific button in the browser and it has to execute some 'specific event handler' code in the server side. So, when the user clicks on a button, the page is submitted automatically to the server with some special information. In the server side, it will process the event handler for the button click event and send back the output page to the browser again. Similary, you can write other event handlers like text changed event for Textboxes etc.

As a user of the web page, you will not even know what happened in the background. All you can see is, when you clicked the button, it executed the button click event handler in the server side and you got the result. However, you may notice a delay because the page has to be submitted to the server to execute the event handler.

Basic .Net Framework Questions and answer

1. What is an Intermediate Language (IL)?
Microsoft Intemediate Language.All .Net Source code is compiled to IL.
IL is then converted to machine code at the point where software is installed.

2. What is a Common Language Runtime (CLR)?
Common Language Runtime (CLR) manages the execution of code and provides different services like Garbage collection and support for Base Class Libraries etc.

The main constituents of CLR are described below
The common Language Runtime (CLR) a rich set of features for cross-language development and deployment. CLR supports both Object Oriented Languages as well as procedural languages. CLR provides security garbage collection cross language exception handling cross language inheritance and so on.

3. What is Common Type System (CTS)?
The Common Type System support both Object Oriented Programming languages as well as procedural languages. Basically CTS provides rich type system that is intended to support wide range of languages.

4. What is a Common Language Specification (CLS)?

CLS (Common Language Specification) defines a subset of Common Type System which all language compilers targeting CLR must adhere to. CLS is a subset of CTS.

5. What is Global Assembly Cache?

The Global Assembly Cache or the popular acronym GAC refers to the machine-wide code cache in any of the computers that have been installed with common language runtime. The GAC or the Global Assembly Cache in .NET Framework acts as the central place for registering assemblies.

6. What is a Garbage collection?
The .NET Framework's garbage collector manages the allocation and release of memory for your application. Each time you use the newoperator to create an object, the runtime allocates memory for the object from the managed heap.

As long as address space is available in the managed heap, the runtime continues to allocate space for new objects. However, memory is not infinite. Eventually the garbage collector must perform a collection in order to free some memory. The garbage collector's optimizing engine determines the best time to perform a collection, based upon the allocations being made.

When the garbage collector performs a collection, it checks for objects in the managed heap that are no longer being used by the application and performs the necessary operations to reclaim their memory.

7. What is Reflection?
Reflection is a collection of classes which allow you to query assembly (classes/objects) metadata at runtime.

8. What is Assembly?

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

Three types of assembly

Public Assembly
Private Assembly
Satelite Assembly

9. What is NameSpace?

Namespaces are a way of grouping type names and reducing the chance of name collisions. A namespace can contain both other namespaces and types. The full name of a type includes the combination of namespaces that contain that type.

10. What is Delay signing?

11. What is Manifeast?

An assembly manifest is a text file containing metadata about .NET assemblies. It describes the relationship and dependencies of the components in the assembly, versioning information, scope information and the security permissions required by the assembly.

12. What is Concept of Boxing and UnBoxing?
C# provides us with Value types and Reference Types. Value Types are stored on the stack and Reference types are stored on the heap. The conversion of value type to reference type is known as boxing and converting reference type back to the value type is known as unboxing.

13. What is Managed code?
1. Code that is executed by the CLR. Managed code provides information (i.e., metadata) to allow the CLR to locate methods encoded in assembly modules, store

and retrieve security information, handle exceptions, and walk the program stack. Managed code can access both managed data and unmanaged data. Managed data

—Memory that is allocated and released by the CLR using Garbage Collection. Managed data can only be accessed by managed code2.Code that targets the common

language runtime, the foundation of the .NET Framework, is known as managed code; code that does not target the common language runtime is known as unmanaged

code. You can think of the runtime as an agent that manages code at execution time, providing core services such as memory management, thread management, and

remoting, while also enforcing strict type safety in the code. The concept of code management is a fundamental principle of the runtime. 3.Managed code

supplies the metadata necessary for the CLR to provide services such as memory management, cross-language integration, code access security, and automatic

lifetime control of objects. All code based on IL executes as managed code. 4.Code that executes under the CLI execution environment. Managed code uses the

execution environment for memory management, object lifetime, and the basic type-system, among other fundamental services.
14. What is a strong names?

15. What are Values types and Reference types?

ADO.NET Interview Questions and Answer

What is Microsoft ADO.NET?
Visual Studio .NET provides access to databases through the set of tools and namespaces collectively referred to as Microsoft ADO.NET

What are the 3 major types of connection objects in ADO.NET?
OleDbConnection object : Use an OleDbConnection object to connect to a Microsoft Access or third-party database, such as MySQL. OLE database connections use the OleDbDataAdapter object to perform commands and return data.

SqlConnection object : Use a SqlConnection object to connect to a Microsoft SQL Server database. SQL database connections use the SqlDataAdapter object to perform commands and return data.

OracleConnection object : Use an OracleConnection object to connect to Oracle databases. Oracle database connections use the OracleDataAdapter object to perform commands and return data. This connection object was introduced in Microsoft .NET Framework version 1.1.

List the 4 common ADO.NET Namespaces?
System.Data : Contains Classes, types, and services for creating and accessing data sets and their subordinate objects

System.Data.SqlClient : Contains Classes and types for accessing Microsoft SQL Server databases

System.Data.OracleClient : Contains Classes and types for accessing Oracle databases (Microsoft .NET Framework version 1.1 and later)

System.Data.OleDb : Contains Classes and types for accessing other databases

List all the steps in order, to access a database through ADO.NET?
1. Create a connection to the database using a connection object.
2. Invoke a command to create a DataSet object using an adapter object.
3. Use the DataSet object in code to display data or to change items in the database.
4. Invoke a command to update the database from the DataSet object using an adapter object.
5. Close the database connection if you explicitly opened it in step 2 using the Open method. Invoking commands without first invoking the Open method

implicitly opens and closes the connection with each request.

Why will you usually create an ASPNET user account in the Database for an ASP.NET web application?
Web applications run using the ASPNET user account. The SQL database administrator will have to set up this account and grant it permissions before your Web application will have access to a SQL database. For file-based databases, such as Microsoft Access, you must grant permissions on the database file to the ASPNET user account using Windows file security settings.

What is the difference between DataReader and DataAdapter?

1. Data Reader is read only forward only and much faster than DataAdapter.
2. If you use DataReader you have to open and close connection explicitly where as if you use DataAdapter the connection is automatically opened and closed.
3. DataReader is connection oriented where as Data Adapter is disconnected

Can you inherit from SqlConnection Class?
No, you cannot inheirt from SqlConnection Class. SqlConnection Class is a sealed class. It is a compile time error.

Will the connection be closed, if the SqlConnection object goes out of scope?
No, If the SqlConnection goes out of scope, it won't be closed. Therefore, you must explicitly close the connection by calling Close or Dispose.

What happens if connection pooling is enabled?
If connection pooling is enabled and when you call Close or Dispose methods, then the connection is returned to the connection pool. This connection can then be resused.If connection pooling is disabled and when you call Close or Dispose methods, the underlying connection to the server is actually closed.

How do you ensure that the database connections are always closed?
To ensure that the database connections are always closed, open the connection inside of a using block, as shown in the following code fragment. Doing so ensures that the connection is automatically closed when the code exits the block.
using (SqlConnection ConnectionObject = new SqlConnection())
{
ConnectionObject.Open();
//The database connection will be closed when the control exits the using code block
}

How do you read an XML file into a DataSet?
Using the DataSet object’s ReadXML method.

When do you use ExecuteReader, ExecuteNonQuery, ExecuteScalar methods?


If the command or stored procedure that is being executed returns a set of rows, then we use ExecuteReader method.

If the command or stored procedure that is being executed returns a single value then we use ExecuteScalar method.

If the command or stored procedure performs INSERT, DELETE or UPDATE operations, then we use ExecuteNonQuery method. ExecuteNonQuery method returns an

integer specifying the number of rows inserted, deleted or updated.

Can your class inherit from SqlCommand Class?
No, you cannot inheirt from SqlCommand Class. SqlCommand Class is a sealed class. It is a compile time error.

Give an example that shows how to execute a stored procedure in ADO.NET?
using (SqlConnection ConnectionObject = new SqlConnection())
{
//Specify the name of the stored procedure to execute and the Connection Object to use
SqlCommand CommandObject = new SqlCommand("StoredProcedureName", ConnectionObject);
//Specify the SQL Command type is a stored procedure
CommandObject.CommandType = CommandType.StoredProcedure;
//Open the connection
ConnectionObject.Open();
//Execute the Stored Procedure
int RecordsAffected = CommandObject.ExecuteNonQuery();
}

Can you reuse a SqlCommand object?
Yes, you can reset the CommandText property and reuse the SqlCommand object.

What are the methods that can ensure asynchronous execution of the Transact-SQL statement or stored procedure?
BeginExecuteNonQuery
BeginExecuteReader

What is SqlCommand.CommandTimeout Property used for?
CommandTimeout Property is used to Get or set the wait time before terminating the attempt to execute a command and generating an error.
//Specify the CommandTimeout property value
SqlCommand CommandObject = new SqlCommand("StoredProcedureName", ConnectionObject);
//Wait for 10 seconds to execute the Stored procedure
CommandObject.CommandTimeout = 10;
The time is in seconds. The default is 30 seconds.

Web Services AND Remoting

ASP.NET Web Services Can be accessed only over HTTP but .Net Remoting Can be accessed over various protocols like TCP, HTTP, SMTP etc.

Web Services are based on stateless service architecture but .Net Remoting support for both stateful and stateless environment.

Web Services support heterogeneous environments means interoperability across platforms but .Net remoting requires .Net on both server and client end.

.NET Remoting provides the fast communication than Web Services when we use the TCP channel and the binary formatter.

Web services support only the objects that can be serialized but .NET Remoting can provide support to all objects that inherit MarshalByRefObject.

Web Services are reliable than .Net remoting because Web services are always hosted in IIS.

Web Services are ease to create and deploy but .Net remoting is bit complex to program.

Introduction ASP.Net 2.0

ASP.NET is the next generation ASP, but it's not an upgraded version of ASP.

ASP.NET is an entirely new technology for server-side scripting. It was written from the ground up and is not backward compatible with classic ASP.

.Net Framework is a development and execution envirnonment that allows developers to create windows and web-based applications.

.Net Framework provides an integrated development environment in which programmers can develop applications in different programming language, such as C# and VB.NET.

ASP.NET is a server side scripting technology that enables scripts (embedded in web pages) to be executed by an Internet server.

* ASP.NET is a Microsoft Technology
* ASP stands for Active Server Pages
* ASP.NET is a program that runs inside IIS
* IIS (Internet Information Services) is Microsoft's Internet server

ASP.NET vs. ASP

ASP.NET has better language support, a large set of new controls, XML-based components, and better user authentication.

ASP.NET provides increased performance by running compiled code.

ASP.NET code is not fully backward compatible with ASP.
New in ASP.NET

* Better language support
* Programmable controls
* Event-driven programming
* XML-based components
* User authentication, with accounts and roles
* Higher scalability
* Increased performance - Compiled code
* Easier configuration and deployment
* Not fully ASP compatible

Common Language Runtime (CLR)


This is a language-independent runtime environment of .NET Framework that manages the code at execution time. Irrespective of what language you choose to develop your application, CLR manages the code for all.

Garbage Collection
The Common Language Runtime (CLR) requires that you create objects in the managed heap, but you do not have to bother with cleaning up the memory once the object goes out of the scope or is no longer needed. The Microsoft .NET Framework Garbage Collector provides memory management capabilities for managed resources. The Garbage Collector frees objects that are not referenced and reclaims their memory. You should set your references to Nothing(null) as soon as you are done with them to ensure your objects are eligible for collection as soon as possible.


Here are the list of some tasks performed by the Garbage collector:

Garbage collector reserves a piece of memory as the application starts for the managed heap.
Garbage collector controls the managed heap memory currently used and available to an application.
Garbage collector allocates memory for new objects within the application.
The Garbage Collector attempts to reclaim the memory of objects that are not referenced.


In ASP.Net the state can be maintained in following ways
Server-side state management
Application objects
Session Variables
Database
Client-side state management
Cookies
Hidden input fields
Query String
ViewState

Connection Pooling
Connection pooling enables an application to use a connection from a pool of connections that do not need to be re-established for each use. Once a connection has been created and placed in a connection pool, an application can reuse that connection without performing the complete connection creation process.

By default, the connection pool is created when the first connection with a unique connection string connects to the database. The pool is populated with connections up to the minimum pool size. Additional connections can be added until the pool reaches the maximum pool size.

When a user request a connection, it is returned from the pool rather than establishing new connection and, when a user releases a connection, it is returned to the pool rather than being released. But be sure than your connections use the same connection string each time.

Here is the Syntax

conn.ConnectionString = "integrated Security=SSPI; SERVER=192.168.0.123; DATABASE=MY_DB; Min Pool Size=4;Max Pool Size=40;Connect Timeout=14;";

ASP.NET Security Interview Questions

Here I am giving Some Asp.Net Security Interview Questions. It is Very Import for Experienced as well as Freshers. Please go through all questions and answer.

1 - Describe the security authentication process in aspnet
2 - What is the Website Administrative Tool in Visual Studio 2005?
3 - What is Authentication in ASP.NET?
4 - What is Authorization in ASP.NET?
5 - What is IIS Metabase?
6 - What is mixed mode Authentication in ASP.NET?
7 - What is Provider Model and Personalization in Aspnet 2.0?

if you want to add any question here. you can post comments your question.

I will add more questions and answer.

ADO.NET Interview Questions

Here I am giving Some Ado.Net Security Interview Questions. It is Very Import for Experienced as well as Freshers. Please go through all questions and answer.

What is ADO.NET?
Whats a connection object? How to connect to a database?
What is a command object? How to use a command object in ADO.NET?
What is SelectCommand in ADO.NET?
What is a SqlCommandBuilder in ADO.NET?
What is a DataView in ADO.NET?
How to use a DataRelation between two columns?
What is Diffgram? When do we use Diffgram?
What is a Typed Dataset? Why do we use a Typed DataSet?
How to run a Stored Procedure from .NET code?

if you want to add any question here. you can post comments your question.
I will add more questions and answer.

C# Interview Questions

Describe the accessibility modifier "protected internal"
Can multiple data types be stored in System.Array?
How to sort array elements in descending order?
Whats the use of "throw" keyword?
Can we put multiple catch blocks in a single try statement?
How to achieve polymorphism in C#?
How to achieve inheritance in C#?
Compare Session state and Viewstate?
How to add gridview/datagrid columns manually? Autogenerate?
How to add a ReadOnly property in C#?
How to prevent a class from being inherited? Sealed?
How to inherit the class, but not the method inside it?
Can we inherit multiple interfaces?
What are the different ways a method can be overloaded?
How to call a specific base constructor?
What are generics in C#?
What is the use of the main() function in C#?
Are C# Keywords in lowercase or uppercase?
What is the use of Console.Readline() in C#?
Can we set the specifier of the main() method in C# as private?
Can we set different types of parameters & return-types in main() method
What is the use of GetCommandLineArgs() method
What is the use of System.Environment class?
Why is the new keyword used for instantiating an object in .NET?
Default values of bool, int, double, string, char, reference-types?
Why does the compiler throw an error when variables are declared with initial value?
How to declare a constant variable in C#?
In C#, can we create an object of reference type using const keyword
What is the difference between const and readonly in C#?
What are the different parameter modifiers available in C#
What is the difference between out and ref in C#?
What is an Interface in C#? How to implement an interface?
How to find whether a class implements an interface, at runtime
What are the Classes in System.Collections? What are the Interfaces in System.Collections?

ASP.NET 2.0 Interview Questions

Here I am giving Some Asp.Net Basic Interview Questions. It is Very Import for Experienced as well as Freshers. Please go through all questions and answer

Can we bind data to a server control without writing code in .NET?
What is a Masterpage? What is a ContentPage?
Can there be a master page inside a masterpage?
What is a SiteMapPath control in ASP.NET 2.0?
How to sort the contents of a GridView control?
What does the Hotspot class in .NET do? What is an ImageMap in ASP.NET?
How do we update and delete data in a gridview? Datakeynames property in .NET?

if you want to add any question here. you can post comments your question.

I will add more questions and answer.

ASP.NET Interview Questions

Here I am giving Some Asp.Net Basic Interview Questions. It is Very Import for Experienced as well as Freshers. Please go through all questions and answer
How to redirect a user to a new page?

How to pass values between pages?
What is the role of the ASP.NET worker process?
Explain the page life cycle in ASP.NET 1.1 & 2.0
How to store global variables?
How to store values between postbacks?
What is a server control?
What is a viewstate?
How to send an email using ASP.NET?
Which namespace does a webpage belong?
How to store information about a user's locale?
How to add an event handler for a server control?
What are validation controls? How do validation controls work?
What is global.asax? Application_start, Session_start?
What is an HTTP handler? Can we use it to upload files?
What is a session? Different ways to maintain session?
What is the @Register directive used for?
What is a cookie? Limitations of cookie? Permanent cookie?
How to implement a web farm and a web garden?
Can dataset be stored in a viewstate?
How to set view state for a server control? Enableviewstate property?
What is smart navigation?
Differences between Web Service and Remoting
Differences between Public Assembly and Private Assembly
Differences between Trace and Debug
Differences between Server.Transfer and Response.Redirect
Differences between Server.Transfer and Server.Execute
Differences between Authentication and Authorization

if you want to add any question here. you can post comments your question.

I will add more questions and answer.

My Profile

I have 4 years Experience .Net and SQL Server. I am working as software engineer in private company Bangalore. I have faced many interviews. Here I am Sharing My Interview experience (Technical, HR and Written Test). This Blog is useful for .Net Developers and Freshers. My hobbies I like to play Foot ball, to read some books, to Learn new technologies. I have Experienced in Asp.Net 2.0, C#.Net, VB.Net, SQL Server and Xml.