Saturday, December 29, 2007

Interview q&a


Does the thought of going for an interview, make you break into a cold sweat? Most people do badly at job interviews not because they are incompetent but simply because they are just plain nervous.
Job interviews usually have two parts -- technical and HR. While the technical interview deals with your knowledge in the field, HR tests your personality and presence of mind. Here are a few tips on how to make a good impression at your job interview:
• Confidence is the most important aspect. You should appear confident, keep your wits about you and listen to every word of the question. Often, prospective employees usually don't even hear the question properly in their nervousness. Fumbling and stammering (if not a medical problem) will not work in your favour.
• While confidence is good, never appear over-confident. This presents you as a pompous and bossy person, definitely not the qualities of a team player.
• Never panic. If you don't know the answer to a question, try this old trick -- ask the interviewer to repeat the question. It lets you hear the question again, gives you time to think and eliminates any embarrassing pauses.
• Thinking on your feet is very important. In a situation where three or four pairs of eyes are staring at you, it is easy to get intimidated. Practice thinking on your feet by having mock interviews with friends. Quick-wittedness is not something you can learn but mock interviews help you think faster than you otherwise would.
Dinesh Samtani, Divya Pinge and Srilaxmi Pai have only recently started working and are fresh on the job market. Here are some tips they had on how tackle difficult interview questions:
Q: Tell us about yourself.
A: This is possibly the most common question asked; it is the answer to this question that gives your prospective employer the supremely important first impression. Most people tend to talk about their family -- what their parents do for a living and what their siblings are doing at the moment. This is NOT what the interviewer is interested in. Talk mostly about yourself -- your education, previous jobs, achievements, interests and strong points of your personality. Once you're done, give a very brief description of your family.
Q: What are your weaknesses? Or what would you like to change about yourself?
A: Although being honest is always better, make sure that your answer does not project you in a bad light. Saying things like "bad at decision making" or "not punctual" go against you. Always say things that can be converted into a positive. For instance: "I am forgetful but I am now trying to get over my weakness by keeping reminders on my phone and writing what I might forget"; You could even say: "I used to be disorganised but now I carry an electronic organiser to keep my phone numbers, deadlines etc". Never say things like "I don't see any weakness in myself", you might just end up annoying the interviewer.
Q: What are your strengths?
A: Some people might get carried away here and end up boasting. The interviewer is looking for skills that will benefit the company, so base your answer on what the company might want. Being a good team player, leadership qualities, analytical skills are among common virtues employers are looking for. Never lie about your virtues, it will catch up with you sooner or later. As always, honesty is the best policy.
Q: What is the one thing you would like to change about your college/ previous office?
A: Always say things that are not too negative. Complaining about your prior bosses or professors shows you in a bad light. Talk of things that are small but not inconsequential. Srilaxmi, for instance, said that she wanted the library timings to be extended.
Q: What would your prior boss/ professor have to say about you?
A: It is good to be prepared for this question. Ask your professor or boss to write a recommendation letter for you if possible. This is useful to present to the interviewer. State what the person would say and then present the letter as proof. This gives the impression of a well-prepared and confident person.
Q: What do you know about our company?
A: Make sure you do your homework before you appear for an interview. Read up on the company's history, progress report and statistics. A small margin is permissible while stating figures but it is best avoided.
Q: Why should I hire you?
A: It's a safe bet to say that you are the best person for the job. But don't sound boastful or pompous. Base your claims with solid results, tell the interviewer why you stand out among all the others and give examples of your expertise.
Q: Name one thing you want to change about yourself.
A: Here, the interviewer will tempt you to sound negative. Never say that you are perfect but at the same time, touch upon you weaknesses in such a way that they seem insignificant. Name an incident in the past that you faltered in, then show that you have now improved.
Q: Where do you see yourself five years from now?
A: It's good to talk of your progress with respect to the company. The interviewer needs to understand that you are not just job-hopping. Things like you see yourself at a much higher post that the one you are applying for, will work in your favour. Tell them that you hope that this job will make you a better professional than you already are and you will also help the company to improve in the department you are going to be working. Then go on to show by your examples what you are doing to reach your goals and objectives.
Q: Do you think your qualifications make you eligible for this job? What has the course taught you?
A: The interviewer probably knows all about your course pattern and has probably studied it himself/ herself. There is no point in discussing it academically; use a more behavioural approach. Your education has made your basics are clear, you have a strong foundation on which to build a career, it has not only taught you the technical aspects of the job you are about to take up but also made you a better professional are all good responses.
Q: Would you call yourself a team player?
A: The obvious answer to this answer is yes. But the way you support this answer is what makes all the difference. Always keep a few instances of when you showed team spirit in mind. It helps to display your ability. Another way in which this question can be asked is by giving you an actual case. The interviewer puts you in a situation and asks what you will do. It is important to think quick and come up with answers showing that you can bring out the best in others and yourself, believe in organisation, communication and delegation of tasks etc.
• Great interview but no job?
The following questions test not your character but your presence of mind. It is important to be alert when faced with these questions, don't take too long to answer:
Q: What part of your body would you hide if you were on the street completely naked?
A: My face, obviously, so no one would know it's me.
Q: What is the colour of the wall behind you?
A: The same as the colour of the wall in front of me. Never turn back and answer this! There is a possibility that the colour might be different but most rooms are painted the same colour. Looking at the interiors of the room you can gauge whether it has a feature (differently coloured) wall or not.
Q: Suppose you have a brother. You go home and open the door and there he is totally naked in front of you. What would u do?
A: I'd pick him up and go put his nappies on him. No one told you your brother's age!
Q: Why are manhole covers round and not square?
A: Because the square cover can fall down if kept vertically along the diagonal.
Q: What is the fastest thing on earth? Why?
A: The mind is the fastest thing. It can be at two places at once and can travel continents in a matter of seconds.
Q: If you were a crayon, what colour would you be?
A: The last thing you want to do here is say any random colour that comes to your head and then give a justification. Think about your best quality, and then associate it with an appropriate colour. For example: "I think I would be blue because I'm very calm and composed at all times. I can keep my head cool in the most stressful situation and take difficult decisions."
These questions are tough but are not really a deciding factor in the interview. Your overall personality and disposition can always convince the interviewer to consider you for the post despite whatever happens in the interview. Calm your nerves and think clearly. Honesty and clarity can impress the employer but a know-it-all attitude is career suicide. Keep these simple tips in mind and you should sail through those nerve-racking interviews!

.net interview q's

ASP.Net interview questions


1. What do I need to create and run an ASP.NET application?

* Windows 2000, Windows Server 2003 or Windows XP.
* ASP.NET, which can be either the redistributable (included in the .NET SDK) or Visual Studio .NET.

1. Where can I download the .NET SDK?

.NET SDK can be obtained here.

(You have to install the Microsoft .NET Framework Version 1.1 Redistributable Package before installing the .NET SDK.)
2. Are there any free IDEs for the .NET SDK?
* Microsoft provides Visual Studio 2005 Express Edition Beta for free. Of particular interest to the ASP.NET developers would be the Visual Web Developer 2005 Express Edition Beta 2 available as a free download.
* The ASP.NET Web Matrix Project (supported by Microsoft) is a free IDE for developing ASP.NET applications and is available here.
* There is also a free open-source UNIX version of the Microsoft .NET development platform called Mono available for download here.
* Another increasingly popular Open Source Development Environment for .NET is the #develop (short for SharpDevelop) available for download here.
3. When was ASP.NET released?

ASP.NET is a part of the .NET framework which was released as a software platform in 2002.
4. Is a new version coming up?

ASP.NET 2.0, Visual Studio 2005 (Whidbey), Visual Web Developer 2005 Express Edition are the next releases of Microsoft's Web platform and tools. They have already been released as Beta versions. They are scheduled to be released in the week of November 7, 2005.
5. Explain Namespace.

Namespaces are logical groupings of names used within a program. There may be multiple namespaces in a single application code, grouped based on the identifiers’ use. The name of any given identifier must appear only once in its namespace.
6. List the types of Authentication supported by ASP.NET.
* Windows (default)
* Forms
* Passport
* None (Security disabled)
7. What is CLR?

Common Language Runtime (CLR) is a run-time environment that manages the execution of .NET code and provides services like memory management, debugging, security, etc. The CLR is also known as Virtual Execution System (VES).
8. What is CLI?

The CLI is a set of specifications for a runtime environment, including a common type system, base class library, and a machine-independent intermediate code known as the Common Intermediate Language (CIL). (Source: Wikipedia.)
9. List the various stages of Page-Load lifecycle.
* Init()
* Load()
* PreRender()
* Unload()
10. Explain Assembly and Manifest.

An assembly is a collection of one or more files and one of them (DLL or EXE) contains a special metadata called Assembly Manifest. The manifest is stored as binary data and contains details like versioning requirements for the assembly, the author, security permissions, and list of files forming the assembly. An assembly is created whenever a DLL is built. The manifest can be viewed programmatically by making use of classes from the System.Reflection namespace. The tool Intermediate Language Disassembler (ILDASM) can be used for this purpose. It can be launched from the command prompt or via Start> Run.
11. What is Shadow Copy?

In order to replace a COM component on a live web server, it was necessary to stop the entire website, copy the new files and then restart the website. This is not feasible for the web servers that need to be always running. .NET components are different. They can be overwritten at any time using a mechanism called Shadow Copy. It prevents the Portable Executable (PE) files like DLLs and EXEs from being locked. Whenever new versions of the PEs are released, they are automatically detected by the CLR and the changed components will be automatically loaded. They will be used to process all new requests not currently executing, while the older version still runs the currently executing requests. By bleeding out the older version, the update is completed.
12. What is DLL Hell?

DLL hell is the problem that occurs when an installation of a newer application might break or hinder other applications as newer DLLs are copied into the system and the older applications do not support or are not compatible with them. .NET overcomes this problem by supporting multiple versions of an assembly at any given time. This is also called side-by-side component versioning.
13. Explain Web Services.

Web services are programmable business logic components that provide access to functionality through the Internet. Standard protocols like HTTP can be used to access them. Web services are based on the Simple Object Access Protocol (SOAP), which is an application of XML. Web services are given the .asmx extension.
14. Explain Windows Forms.

Windows Forms is employed for developing Windows GUI applications. It is a class library that gives developers access to Windows Common Controls with rich functionality. It is a common GUI library for all the languages supported by the .NET Framework.
15. What is Postback?

When an action occurs (like button click), the page containing all the controls within the tag performs an HTTP POST, while having itself as the target URL. This is called Postback.
16. Explain the differences between server-side and client-side code?

Server side scripting means that all the script will be executed by the server and interpreted as needed. Client side scripting means that the script will be executed immediately in the browser such as form field validation, clock, email validation, etc. Client side scripting is usually done in VBScript or JavaScript. Since the code is included in the HTML page, anyone can see the code by viewing the page source. It also poses as a possible security hazard for the client computer.
17. Enumerate the types of Directives.
* @ Page directive
* @ Import directive
* @ Implements directive
* @ Register directive
* @ Assembly directive
* @ OutputCache directive
* @ Reference directive
18. What is Code-Behind?

Code-Behind is a concept where the contents of a page are in one file and the server-side code is in another. This allows different people to work on the same page at the same time and also allows either part of the page to be easily redesigned, with no changes required in the other. An Inherits attribute is added to the @ Page directive to specify the location of the Code-Behind file to the ASP.NET page.
19. Describe the difference between inline and code behind.

Inline code is written along side the HTML in a page. There is no separate distinction between design code and logic code. Code-behind is code written in a separate file and referenced by the .aspx page.
20. List the ASP.NET validation controls?
* RequiredFieldValidator
* RangeValidator
* CompareValidator
* RegularExpressionValidator
* CustomValidator
* ValidationSummary
21. What is Data Binding?

Data binding is a way used to connect values from a collection of data (e.g. DataSet) to the controls on a web form. The values from the dataset are automatically displayed in the controls without having to write separate code to display them.
22. Describe Paging in ASP.NET.

The DataGrid control in ASP.NET enables easy paging of the data. The AllowPaging property of the DataGrid can be set to True to perform paging. ASP.NET automatically performs paging and provides the hyperlinks to the other pages in different styles, based on the property that has been set for PagerStyle.Mode.
23. Should user input data validation occur server-side or client-side? Why?

All user input data validation should occur on the server and minimally on the client-side, though it is a good way to reduce server load and network traffic because we can ensure that only data of the appropriate type is submitted from the form. It is totally insecure. The user can view the code used for validation and create a workaround for it. Secondly, the URL of the page that handles the data is freely visible in the original form page. This will allow unscrupulous users to send data from their own forms to your application. Client-side validation can sometimes be performed where deemed appropriate and feasible to provide a richer, more responsive experience for the user.
24. What is the difference between Server.Transfer and Response.Redirect?
* Response.Redirect: This tells the browser that the requested page can be found at a new location. The browser then initiates another request to the new page loading its contents in the browser. This results in two requests by the browser.
* Server.Transfer: It transfers execution from the first page to the second page on the server. As far as the browser client is concerned, it made one request and the initial page is the one responding with content. The benefit of this approach is one less round trip to the server from the client browser. Also, any posted form variables and query string parameters are available to the second page as well.

26. What is an interface and what is an abstract class?

In an interface, all methods must be abstract (must not be defined). In an abstract class, some methods can be defined. In an interface, no accessibility modifiers are allowed, whereas it is allowed in abstract classes.
27. Session state vs. View state:

In some cases, using view state is not feasible. The alternative for view state is session state. Session state is employed under the following situations:
* Large amounts of data - View state tends to increase the size of both the HTML page sent to the browser and the size of form posted back. Hence session state is used.
* Secure data - Though the view state data is encoded and may be encrypted, it is better and secure if no sensitive data is sent to the client. Thus, session state is a more secure option.
* Problems in serializing of objects into view state - View state is efficient for a small set of data. Other types like DataSet are slower and can generate a very large view state.
28. Can two different programming languages be mixed in a single ASPX file?

ASP.NET’s built-in parsers are used to remove code from ASPX files and create temporary files. Each parser understands only one language. Therefore mixing of languages in a single ASPX file is not possible.
29. Is it possible to see the code that ASP.NET generates from an ASPX file?

By enabling debugging using a <%@ Page Debug="true" %> directive in the ASPX file or a statement in Web.config, the generated code can be viewed. The code is stored in a CS or VB file (usually in the \%SystemRoot%\Microsoft.NET\Framework\v1.0.nnnn\Temporary ASP.NET Files).
30. Can a custom .NET data type be used in a Web form?

This can be achieved by placing the DLL containing the custom data type in the application root's bin directory and ASP.NET will automatically load the DLL when the type is referenced.
31. List the event handlers that can be included in Global.asax?
* Application start and end event handlers
* Session start and end event handlers
* Per-request event handlers
* Non-deterministic event handlers
32. Can the view state be protected from tampering?

This can be achieved by including an @ Page directive with an EnableViewStateMac="true" attribute in each ASPX file that has to be protected. Another way is to include the statement in the Web.config file.
33. Can the view state be encrypted?

The view state can be encrypted by setting EnableViewStateMac to true and either modifying the element in Machine.config to or by adding the above statement to Web.config.
34. When during the page processing cycle is ViewState available?

The view state is available after the Init() and before the Render() methods are called during Page load.
35. Do Web controls support Cascading Style Sheets?

All Web controls inherit a property named CssClass from the base class System.Web.UI.WebControls.WebControl which can be used to control the properties of the web control.
36. What namespaces are imported by default in ASPX files?

The following namespaces are imported by default. Other namespaces must be imported manually using @ Import directives.
* System
* System.Collections
* System.Collections.Specialized
* System.Configuration
* System.Text
* System.Text.RegularExpressions
* System.Web
* System.Web.Caching
* System.Web.Security
* System.Web.SessionState
* System.Web.UI
* System.Web.UI.HtmlControls
* System.Web.UI.WebControls
37. What classes are needed to send e-mail from an ASP.NET application?

The classes MailMessage and SmtpMail have to be used to send email from an ASP.NET application. MailMessage and SmtpMail are classes defined in the .NET Framework Class Library's System.Web.Mail namespace.
38. Why do some web service classes derive from System.Web.WebServices while others do not?

Those Web Service classes which employ objects like Application, Session, Context, Server, and User have to derive from System.Web.WebServices. If it does not use these objects, it is not necessary to be derived from it.
39. What are VSDISCO files?

VSDISCO files are DISCO files that enable dynamic discovery of Web Services. ASP.NET links the VSDISCO to a HTTP handler that scans the host directory and subdirectories for ASMX and DISCO files and returns a dynamically generated DISCO document. A client who requests a VSDISCO file gets back what appears to be a static DISCO document.
40. How can files be uploaded to Web pages in ASP.NET?

This can be done by using the HtmlInputFile class to declare an instance of an tag. Then, a byte[] can be declared to read in the data from the input file. This can then be sent to the server.
41. How do I create an ASPX page that periodically refreshes itself?

The following META tag can be used as a trigger to automatically refresh the page every n seconds:



42. How do I initialize a TextBox whose TextMode is "password", with a password?

The TextBox’s Text property cannot be used to assign a value to a password field. Instead, its Value field can be used for that purpose.

ID="Password" RunAt="server" />

43. Why does the control's PostedFile property always show null when using HtmlInputFile control to upload files to a Web server?

This occurs when an enctype="multipart/form-data" attribute is missing in the
tag.
44. How can the focus be set to a specific control when a Web form loads?

This can be achieved by using client-side script:

document.forms[0].TextBox1.focus ()

The above code will set the focus to a TextBox named TextBox1 when the page loads.
45. How does System.Web.UI.Page's IsPostBack property work?

IsPostBack checks to see whether the HTTP request is accompanied by postback data containing a __VIEWSTATE or __EVENTTARGET parameter. If there are none, then it is not a postback.
46. What is WSDL?

WSDL is an XML format for describing network services as a set of endpoints operating on messages containing either document-oriented or procedure-oriented information. The operations and messages are described abstractly, and then bound to a concrete network protocol and message format to define an endpoint. Related concrete endpoints are combined into abstract endpoints (services). (Source: www.w3.org)
47. What is UDDI?

UDDI stands for Universal Description, Discovery, and Integration. It is like an "Yellow Pages" for Web Services. It is maintained by Microsoft, IBM, and Ariba, and is designed to provide detailed information regarding registered Web Services for all vendors. The UDDI can be queried for specific Web Services.
48. Is it possible to generate the source code for an ASP.NET Web service from a WSDL?

The Wsdl.exe tool (.NET Framework SDK) can be used to generate source code for an ASP.NET web service with its WSDL link.

Example: wsdl /server http://api.google.com/GoogleSearch.wsdl.
49. Why do uploads fail while using an ASP.NET file upload control to upload large files?

ASP.NET limits the size of file uploads for security purposes. The default size is 4 MB. This can be changed by modifying the maxRequestLength attribute of Machine.config's element.
50. Describe the difference between inline and code behind.

Inline code is written along side the HTML in a page. Code-behind is code written in a separate file and referenced by the .aspx page.

51. 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.
52. 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.
53. 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.
54. What data types do the RangeValidator control support?

Integer, String, and Date.
55. 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.
56. What is the transport protocol you use to call a Web service?

SOAP (Simple Object Access Protocol) is the preferred protocol.
57. What is ViewState?

ViewState allows the state of objects (serializable) to be stored in a hidden field on the page. ViewState is transported to the client and back to the server, and is not stored on the server or any other external source. ViewState is used the retain the state of server-side objects between postabacks.
58. What does the "EnableViewState" property do? Why would I want it on or off?

It allows the page to save the users input on a form across postbacks. It saves the server-side values for a given control into ViewState, which is stored as a hidden value on the page before sending the page to the clients browser. When the page is posted back to the server the server control is recreated with the state stored in viewstate.
59. What are the different types of Session state management options available with ASP.NET?

ASP.NET provides In-Process and Out-of-Process state management. In-Process stores the session in memory on the web server. This requires the a "sticky-server" (or no load-balancing) so that the user is always reconnected to the same web server. Out-of-Process Session state management stores data in an external data source. The external data source may be either a SQL Server or a State Server service. Out-of-Process state management requires that all objects stored in session are serializable.
60. Differences Between XML and HTML?

Anyone with a fundamental grasp of XML should be able describe some of the main differences outlined in the table below
XML

HTML
User definable tags Defined set of tags designed for web display
Content driven Format driven
End tags required for well formed documents End tags not required
Quotes required around attributes values Quotes not required
Slash required in empty tags Slash not required
61. Give a few examples of types of applications that can benefit from using XML.

There are literally thousands of applications that can benefit from XML technologies. The point of this question is not to have the candidate rattle off a laundry list of projects that they have worked on, but, rather, to allow the candidate to explain the rationale for choosing XML by citing a few real world examples. For instance, one appropriate answer is that XML allows content management systems to store documents independently of their format, which thereby reduces data redundancy. Another answer relates to B2B exchanges or supply chain management systems. In these instances, XML provides a mechanism for multiple companies to exchange data according to an agreed upon set of rules. A third common response involves wireless applications that require WML to render data on hand held devices.
62. What is DOM and how does it relate to XML?

The Document Object Model (DOM) is an interface specification maintained by the W3C DOM Workgroup that defines an application independent mechanism to access, parse, or update XML data. In simple terms it is a hierarchical model that allows developers to manipulate XML documents easily Any developer that has worked extensively with XML should be able to discuss the concept and use of DOM objects freely. Additionally, it is not unreasonable to expect advanced candidates to thoroughly understand its internal workings and be able to explain how DOM differs from an event-based interface like SAX.
63. What is SOAP and how does it relate to XML?

The Simple Object Access Protocol (SOAP) uses XML to define a protocol for the exchange of information in distributed computing environments. SOAP consists of three components: an envelope, a set of encoding rules, and a convention for representing remote procedure calls. Unless experience with SOAP is a direct requirement for the open position, knowing the specifics of the protocol, or how it can be used in conjunction with HTTP, is not as important as identifying it as a natural application of XML.
64. Can you walk us through the steps necessary to parse XML documents?

Superficially, this is a fairly basic question. However, the point is not to determine whether candidates understand the concept of a parser but rather have them walk through the process of parsing XML documents step-by-step. Determining whether a non-validating or validating parser is needed, choosing the appropriate parser, and handling errors are all important aspects to this process that should be included in the candidate's response.
65. 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.
66. 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.
67. 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.
68. 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.
69. 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.
70. 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.
71. 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.
72. 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.
73. 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.
74. 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.
75. How do you define the lease of the object?

By implementing ILease interface when writing the class code.
76. 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.
77. How can you automatically generate interface for the remotable object in .NET with Microsoft tools?

Use the Soapsuds tool.

1.1 Do I need IIS to run Web applications?


If you are using Visual Studio, you can use the ASP.NET Development Server built into Visual Studio to test your pages. The server functions as a local Web server, running ASP.NET Web pages in a manner virtually identical to how they run in IIS. To deploy a Web application, you need to copy it to a computer running IIS version 5 or 6.

1.2 How do I create pages for mobile devices?


ASP.NET will automatically detect the type of browser making the request. This information is used by the page and by individual controls to render appropriate markup for that browser. You therefore do not need to use a special set of pages or controls for mobile devices. (Whether you can design a single page to work with all types of browsers will depend on the page, on the browsers you want to target, and on your own goals.)

1.3 Are ASP.NET pages XHTML compatible?


Yes. Individual controls render markup that is compatible with the XHTML 1.1 standard. It is up to you, however, to include the appropriate document type declaration and other XHTML document elements. ASP.NET does not insert elements for you to ensure XHTML compatibility. For details, see ASP.NET and XHTML Compliance.

1.4 Can I hide the source code for my page?


Server-side code is processed on the server and is not sent to the browser, so users cannot see it. However, client script is not protected; any client script that you add to your page, or that is injected into the page by server processing, is visible to users. If you are concerned about protecting your source code on the server, you can precompile your site and deploy the compiled version. For details, see Publishing Web Sites.

1.5 When I run a page, I get the error "The page cannot be displayed" and an HTTP 502 Proxy Error. Why?


This error can occur if you are running ASP.NET Web pages using the Visual Web Developer Web server, because the URL includes a randomly selected port number. Proxy servers do not recognize the URL and return this error. To get around the problem, change your settings in Internet Explorer to bypass the proxy server for local addresses, so that the request is not sent to the proxy. In Internet Explorer, you can make this change in Tools > Internet Options. In the Connections tab, click LAN Settings and then select Bypass proxy server for local addresses.

1.6 Which page code model is preferable, single-file or code-behind?


Both models function the same and have the same performance. The choice of using single-file pages versus code-behind pages is one of personal preference and convenience. For details, see ASP.NET Web Page Code Model.

The QuickStart examples and examples in the API reference seem to use single-file pages frequently. Does this mean that single-file is the preferred model for pages?

No. Single-file pages are frequently used in examples because they are easier to illustrate — the writer does not have to create a separate file to show the code.

1.7 Is it better to write code in C# or Visual Basic?


You can write code for your Web application in any language supported by the .NET Framework. That includes Visual Basic, C#, J#, JScript, and others. Although the languages have different syntax, they all compile to the same object code. The languages have small differences in how they support different features. For example, C# provides access to unmanaged code, while Visual Basic supports implicit event binding via the Handles clause. However, the differences are minor, and unless your requirements involve one of these small differences, the choice of programming language is one of personal preference. Once programs are compiled, they all perform identically; that is, Visual Basic programs run just as fast as C# programs, since they both produce the same object code.

1.8 Do I have to use one programming language for all my Web pages?


No. Each page can be written in a different programming language if you want, even in the same application. If you are creating source code files and putting them in the \App_Code folder to be compiled at run time, all the code in must be in the same language. However, you can create subfolders in the \App_Code folder and use the subfolders to store components written in different programming languages.

1.9 Is the code in single-file and code-behind pages identical?


Almost. A code-behind file contains an explicit class declaration, which is not required for single-file pages.

1.10 Is the old code-behind model still supported?


Old projects will continue to run without change. In Visual Studio 2005, if you open a project created in Visual Studio .NET 2002 or 2003, by default, the project is converted to the new project layout used in Visual Studio 2005. As part of the conversion, pages that use the old code-behind model are converted to use the new code-behind model. Visual Studio 2005 Web Application Projects provide an alternative web project model that uses the same project, build and compilation semantics as the Visual Studio .NET 2003 code-behind model. For details, see Visual Studio 2005 Web Application Projects.

#
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.

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

# 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.

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

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

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

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

# 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.

# 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();");

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

# 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.

# 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.

# 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.

# 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.

# 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.

# 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.

# 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.

# 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.

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

# 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.

# 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.

# 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.

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

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

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

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

# 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.

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

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

# 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.

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

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

What are the main differences between asp and asp.net?

ASP 3.0

• Supports VBScript and JavaScript
o scripting languages are limited in scope
o interpreted from top to bottom each time the page is loaded
• Files end with *.asp extension
• 5 objects: Request, Response, Server, Application, Session
• Queried databases return recordsets
• Uses conventional HTML forms for data collection

ASP .NET

• Supports a number of languages including Visual Basic, C#, and JScript
o code is compiled into .NET classes and stored to speed up multiple hits on a page
o object oriented and event driven makes coding web pages more like traditional applications
• Files end with *.aspx extension
• .NET contains over 3400 classes
• XML-friendly data sets are used instead of recordsets
• Uses web forms that look like HTML forms to the client, but add much functionality due to server-side coding
• Has built-in validation objects
• Improved debugging feature (great news for programmers)
• ASP .NET controls can be binded to a data source, including XML recordsets
Source: mikekissman.com

2. What is a user control?

• An ASP.NET user control is a group of one or more server controls or static HTML elements that encapsulate a piece of functionality. A user control could simply be an extension of the functionality of an existing server control(s) (such as an image control that can be rotated or a calendar control that stores the date in a text box). Or, it could consist of several elements that work and interact together to get a job done (such as several controls grouped together that gather information about a user's previous work experience).
Source: 15seconds.com

3. What are different types of controls available in ASP.net?
• HTML server controls HTML elements exposed to the server so you can program them. HTML server controls expose an object model that maps very closely to the HTML elements that they render.
• Web server controls Controls with more built-in features than HTML server controls. Web server controls include not only form-type controls such as buttons and text boxes, but also special-purpose controls such as a calendar. Web server controls are more abstract than HTML server controls in that their object model does not necessarily reflect HTML syntax.
• Validation controls Controls that incorporate logic to allow you to test a user's input. You attach a validation control to an input control to test what the user enters for that input control. Validation controls are provided to allow you to check for a required field, to test against a specific value or pattern of characters, to verify that a value lies within a range, and so on.
• User controls Controls that you create as Web Forms pages. You can embed Web Forms user controls in other Web Forms pages, which is an easy way to create menus, toolbars, and other reusable elements.
• Note You can also create output for mobile devices. To do so, you use the same ASP.NET page framework, but you create Mobile Web Forms instead of Web Forms pages and use controls specifically designed for mobile devices.
Source: MSDN

4. What are the validation controls available in ASP.net?

Type of validation Control to use
Description

Required entry RequiredFieldValidator Ensures that the user does not skip an entry.
Comparison to a value CompareValidator Compares a user's entry against a constant value, or against a property value of another control, using a comparison operator (less than, equal, greater than, and so on).
Range checking RangeValidator Checks that a user's entry is between specified lower and upper boundaries. You can check ranges within pairs of numbers, alphabetic characters, and dates.
Pattern matching RegularExpressionValidator Checks that the entry matches a pattern defined by a regular expression. This type of validation allows you to check for predictable sequences of characters, such as those in social security numbers, e-mail addresses, telephone numbers, postal codes, and so on.
User-defined CustomValidator Checks the user's entry using validation logic that you write yourself. This type of validation allows you to check for values derived at run time.
Source: MSDN

5. How will you upload a file to IIS in Asp and how will you do the same in ASP.net?

First of all, we need a HTML server control to allow the user to select the file. This is nothing but the same old . This will give you the textbox and a browse button. Once you have this, the user can select any file from their computer (or even from a network). Then, in the Server side, we need the following line to save the file to the Web Server.


myFile.PostedFile.SaveAs ("DestinationPath")

Note: The Form should have the following ENC Type


Source: ASP Alliance
6. What is Attribute Programming? What are attributes? Where are they used?

Attributes are a mechanism for adding metadata, such as compiler instructions and other data about your data, methods, and classes, to the program itself. Attributes are inserted into the metadata and are visible through ILDasm and other metadata-reading tools. Attributes can be used to identify or use the data at runtime execution using .NET Reflection.
Source: OnDotNet.com

7. What is the difference between Data Reader & Dataset?

Data Reader is connected, read only forward only record set.
Dataset is in memory database that can store multiple tables, relations and constraints; moreover dataset is disconnected and is not aware of the data source.

8. What is the difference between server side and client side code?

Server code is executed on the web server where as the client code is executed on the browser machine.

9. Why would you use “EnableViewState” property? What are the disadvantages?

EnableViewState allows me to retain the values of the controls properties across the requests in the same session. It hampers the performance of the application.

10. What is the difference between Server. Transfer and Response. Redirect?

The Transfer method allows you to transfer from inside one ASP page to another ASP page. All of the state information that has been created for the first (calling) ASP page will be transferred to the second (called) ASP page. This transferred information includes all objects and variables that have been given a value in an Application or Session scope, and all items in the Request collections. For example, the second ASP page will have the same SessionID as the first ASP page.

When the second (called) ASP page completes its tasks, you do not return to the first (calling) ASP page. All these happen on the server side browser is not aware of this.
The redirect message issue HTTP 304 to the browser and causes browser to got the specified page. Hence there is round trip between client and server. Unlike transfer, redirect doesn’t pass context information to the called page.

11. What is the difference between Application_start and Session_start?

Application_start gets fired when an application receive the very first request.
Session_start gets fired for each of the user session.



12. What is inheritance and when would you use inheritance?

The concept of child class inheriting the behavior of the parent is called inheritance.
If there are many classes in an application that have some part of their behavior common among all , inheritance would be used.

13. What is the order of events in a web form?

1. Init
2. Load
3. Cached post back events
4. Prerender
5. Unload

14. Can you edit Data in repeater control?

No

15. Which template you must provide to display data in a repeater control?

Item Template

16. How can you provide an alternating color scheme in a Data Grid?

Use ALTERNATINGITEMSTYLE and ITEMSTYLE, attributes or Templates

17. Is it possible to bind a data to Textbox?

Yes

18. What method I should call to bind data to control?

Bind Data ()

19. How can I kill a user session?

Call session. abandon.

21. Which is the common property among all the validation controls?

ControlToValidate

22. How do you bind a data grid column manually?

Use BoundColumn tag.

23. Web services can only be written in .NET, true or false?

False

24. What does WSDL, UDDI stands for?

Web Service Description Language.
Universal Description Discovery and Integration
25. How can you make a property read only? (C#)

Use key word Read Only

25. Which validation control is used to match values in two controls?

Compare Validation control.

26. To test a Web Service I must create either web application or windows application. True or false?

False

27. How many classes can a single .NET assembly contains?

Any number

28. What are the data types available in JavaScript?

Object is the only data type available.

29. Is it possible to share session information among ASP and ASPX page?

No, it is not possible as both of these are running under different processes.

30. What are the caching techniques available?
Page cahahing.
Fragment Caching
And Data Caching



31. What are the different types of authentication modes available?

1. Window.
2. Form.
3. Passport.
4. None.

32. Explain the steps involved to populate dataset with data?

Open connection
Initialize Adapter passing SQL and connection as parameter
Initialize Dataset
Call Fill method of the adapter passes dataset as the parameter
Close connection.

33. Can I have data from two different sources into a single dataset?

Yes, it is possible.

34. Is it possible load XML into a Data Reader?

No.

35. Is it possible to have tables in the dataset that are not bound to any data source?

Yes, we can create table object in code and add it to the dataset.

36. Why do you deploy an assembly into GAC?

To allow other application to access the shared assembly.

37. How do you uninstall assembly from GAC?

Use Gacutil.exe with U switch.

38. What does Regasm do?

The Assembly Registration tool reads the metadata within an assembly and adds the necessary entries to the registry, which allows COM clients to create .NET Framework classes transparently. Once a class is registered, any COM client can use it as though the class were a COM class. The class is registered only once, when the assembly is installed. Instances of classes within the assembly cannot be created from COM until they are actually registered.

39. What is the difference between Execute Scalar and ExceuteNoneQuery?

Execute Scalar returns the value in the first row first column of a query result set.
ExceuteNonQuery return number of rows affected.

40. What is an assembly?

Assembly is a deployment unit of .NET application. In practical terms assembly is an Executable or a class library.

41. What is CLR?

The common language runtime is the execution engine for .NET Framework applications.
It provides a number of services, including the following:
• Code management (loading and execution)
Application memory isolation
• Verification of type safety
• Conversion of IL to native code
• Access to metadata (enhanced type information)
• Managing memory for managed objects
• Enforcement of code access security
• Exception handling, including cross-language exceptions
• Interoperation between managed code, COM objects, and pre-existing DLLs (unmanaged code and data)
• Automation of object layout
• Support for developer services (profiling, debugging, and so on)

42. What is the common type system (CTS)?

The common type system is a rich type system, built into the common language runtime that supports the types and operations found in most programming languages. The common type system supports the complete implementation of a wide range of programming languages.

43. What is the Common Language Specification (CLS)?

The Common Language Specification is a set of constructs and constraints that serves as a guide for library writers and compiler writers. It allows libraries to be fully usable from any language supporting the CLS, and for those languages to integrate with each other. The Common Language Specification is a subset of the common type system. The Common Language Specification is also important to application developers who are writing code that will be used by other developers. When developers design publicly accessible APIs following the rules of the CLS, those APIs are easily used from all other programming languages that target the common language runtime.

44. What is the Microsoft Intermediate Language (MSIL)?

MSIL is the CPU-independent instruction set into which .NET Framework programs are compiled. It contains instructions for loading, storing, initializing, and calling methods on objects.
Combined with metadata and the common type system, MSIL allows for true cross-language integration.
Prior to execution, MSIL is converted to machine code. It is not interpreted.

45. What is managed code and managed data?

Managed code is code that is written to target the services of the common language runtime (see what is the Common Language Runtime?). In order to target these services, the code must provide a minimum level of information (metadata) to the runtime. All C#, Visual Basic .NET, and JScript .NET code is managed by default. Visual Studio .NET C++ code is not managed by default, but the compiler can produce managed code by specifying a command-line switch (/CLR).
Closely related to managed code is managed data—data that is allocated and de-allocated by the common language runtime's garbage collector. C#, Visual Basic, and JScript .NET data is managed by default. C# data can, however, be marked as unmanaged through the use of special keywords. Visual Studio .NET C++ data is unmanaged by default (even when using the /CLR switch), but when using Managed Extensions for C++, a class can be marked as managed by using the __gc keyword. As the name suggests, this means that the memory for instances of the class is managed by the garbage collector. In addition, the class becomes a full participating member of the .NET Framework community, with the benefits and restrictions that brings. An example of a benefit is proper interoperability with classes written in other languages (for example, a managed C++ class can inherit from a Visual Basic class). An example of a restriction is that a managed class can only inherit from one base class.

46. What is an assembly?

An assembly is the primary building block of a .NET Framework application. It is a collection of functionality that is built, versioned, and deployed as a single implementation unit (as one or more files). All managed types and resources are marked either as accessible only within their implementation unit or as accessible by code outside that unit.

Assemblies are self-describing by means of their manifest, which is an integral part of every assembly.



The manifest: Establishes the assembly identity (in the form of a text name), version, culture, and digital signature (if the assembly is to be shared across applications).
Defines what files (by name and file hash) make up the assembly implementation.
Specifies the types and resources that make up the assembly, including which are exported from the assembly.
Itemizes the compile-time dependencies on other assemblies.
Specifies the set of permissions required for the assembly to run properly.

This information is used at run time to resolve references, enforce version binding policy, and validate the integrity of loaded assemblies. The runtime can determine and locate the assembly for any running object, since every type is loaded in the context of an assembly. Assemblies are also the unit at which code access security permissions are applied. The identity evidence for each assembly is considered separately when determining what permissions to grant the code it contains.
The self-describing nature of assemblies also helps makes zero-impact install and XCOPY deployment feasible.

47. What are private assemblies and shared assemblies?

A private assembly is used only by a single application, and is stored in that application's install directory (or a subdirectory therein). A shared assembly is one that can be referenced by more than one application. In order to share an assembly, the assembly must be explicitly built for this purpose by giving it a cryptographically strong name (referred to as a strong name). By contrast, a private assembly name need only be unique within the application that uses it.
By making a distinction between private and shared assemblies, we introduce the notion of sharing as an explicit decision. Simply by deploying private assemblies to an application directory, you can guarantee that that application will run only with the bits it was built and deployed with. References to private assemblies will only be resolved locally to the private application directory.
There are several reasons you may elect to build and use shared assemblies, such as the ability to express version policy. The fact that shared assemblies have a cryptographically strong name means that only the author of the assembly has the key to produce a new version of that assembly. Thus, if you make a policy statement that says you want to accept a new version of an assembly, you can have some confidence that version updates will be controlled and verified by the author. Otherwise, you don't have to accept them.
For locally installed applications, a shared assembly is typically explicitly installed into the global assembly cache (a local cache of assemblies maintained by the .NET Framework). Key to the version management features of the .NET Framework is that downloaded code does not affect the execution of locally installed applications. Downloaded code is put in a special download cache and is not globally available on the machine even if some of the downloaded components are built as shared assemblies.
The classes that ship with the .NET Framework are all built as shared assemblies.

48. If I want to build a shared assembly, does that require the overhead of signing and managing key pairs?

Building a shared assembly does involve working with cryptographic keys. Only the public key is strictly needed when the assembly is being built. Compilers targeting the .NET Framework provide command line options (or use custom attributes) for supplying the public key when building the assembly. It is common to keep a copy of a common public key in a source database and point build scripts to this key. Before the assembly is shipped, the assembly must be fully signed with the corresponding private key. This is done using an SDK tool called SN.exe (Strong Name).
Strong name signing does not involve certificates like Authenticode does. There are no third party organizations involved, no fees to pay, and no certificate chains. In addition, the overhead for verifying a strong name is much less than it is for Authenticode. However, strong names do not make any statements about trusting a particular publisher. Strong names allow you to ensure that the contents of a given assembly haven't been tampered with, and that the assembly loaded on your behalf at run time comes from the same publisher as the one you developed against. But it makes no statement about whether you can trust the identity of that publisher.

49. What is the difference between a namespace and an assembly name?

A namespace is a logical naming scheme for types in which a simple type name, such as MyType, is preceded with a dot-separated hierarchical name. Such a naming scheme is completely under the control of the developer. For example, types MyCompany.FileAccess.A and MyCompany.FileAccess.B might be logically expected to have functionality related to file access. The .NET Framework uses a hierarchical naming scheme for grouping types into logical categories of related functionality, such as the Microsoft® ASP.NET application framework, or remoting functionality. Design tools can make use of namespaces to make it easier for developers to browse and reference types in their code. The concept of a namespace is not related to that of an assembly. A single assembly may contain types whose hierarchical names have different namespace roots, and a logical namespace root may span multiple assemblies. In the .NET Framework, a namespace is a logical design-time naming convenience, whereas an assembly establishes the name scope for types at run time.

50. What options are available to deploy my .NET applications?

The .NET Framework simplifies deployment by making zero-impact install and XCOPY deployment of applications feasible. Because all requests are resolved first to the private application directory, simply copying an application's directory files to disk is all that is needed to run the application. No registration is required.
This scenario is particularly compelling for Web applications, Web Services, and self-contained desktop applications. However, there are scenarios where XCOPY is not sufficient as a distribution mechanism. An example is when the application has little private code and relies on the availability of shared assemblies, or when the application is not locally installed (but rather downloaded on demand). For these cases, the .NET Framework provides extensive code download services and integration with the Windows Installer. The code download support provided by the .NET Framework offers several advantages over current platforms, including incremental download, code access security (no more Authenticode dialogs), and application isolation (code downloaded on behalf of one application doesn't affect other applications). The Windows Installer is another powerful deployment mechanism available to .NET applications. All of the features of Windows Installer, including publishing, advertisement, and application repair will be available to .NET applications in Windows Installer 2.0.

51. I've written an assembly that I want to use in more than one application. Where do I deploy it?

Assemblies that are to be used by multiple applications (for example, shared assemblies) are deployed to the global assembly cache. In the prerelease and Beta builds, use the /i option to the GACUtil SDK tool to install an assembly into the cache:
gacutil /i myDll.dll
Windows Installer 2.0, which ships with Windows XP and Visual Studio .NET will be able to install assemblies into the global assembly cache.

52. How can I see what assemblies are installed in the global assembly cache?

The .NET Framework ships with a Windows shell extension for viewing the assembly cache. Navigating to % windir%\assembly with the Windows Explorer activates the viewer.

53. What is an application domain?

An application domain (often AppDomain) is a virtual process that serves to isolate an application. All objects created within the same application scope (in other words, anywhere along the sequence of object activations beginning with the application entry point) are created within the same application domain. Multiple application domains can exist in a single operating system process, making them a lightweight means of application isolation.

An OS process provides isolation by having a distinct memory address space. While this is effective, it is also expensive, and does not scale to the numbers required for large web servers. The Common Language Runtime, on the other hand, enforces application isolation by managing the memory use of code running within the application domain. This ensures that it does not access memory outside the boundaries of the domain. It is important to note that only type-safe code can be managed in this way (the runtime cannot guarantee isolation when unsafe code is loaded in an application domain).

54. What is garbage collection?

Garbage collection is a mechanism that allows the computer to detect when an object can no longer be accessed. It then automatically releases the memory used by that object (as well as calling a clean-up routine, called a "finalizer," which is written by the user). Some garbage collectors, like the one used by .NET, compact memory and therefore decrease your program's working set.

55. How does non-deterministic garbage collection affect my code?

For most programmers, having a garbage collector (and using garbage collected objects) means that you never have to worry about deallocating memory, or reference counting objects, even if you use sophisticated data structures. It does require some changes in coding style, however, if you typically deallocate system resources (file handles, locks, and so forth) in the same block of code that releases the memory for an object. With a garbage collected object you should provide a method that releases the system resources deterministically (that is, under your program control) and let the garbage collector release the memory when it compacts the working set.

56. Can I avoid using the garbage collected heap?

All languages that target the runtime allow you to allocate class objects from the garbage-collected heap. This brings benefits in terms of fast allocation, and avoids the need for programmers to work out when they should explicitly 'free' each object.
The CLR also provides what are called ValueTypes—these are like classes, except that ValueType objects are allocated on the runtime stack (rather than the heap), and therefore reclaimed automatically when your code exits the procedure in which they are defined. This is how "structs" in C# operate.
Managed Extensions to C++ lets you choose where class objects are allocated. If declared as managed Classes, with the __gc keyword, then they are allocated from the garbage-collected heap. If they don't include the __gc keyword, they behave like regular C++ objects, allocated from the C++ heap, and freed explicitly with the "free" method.

57. How do in-process and cross-process communication work in the Common Language Runtime?

There are two aspects to in-process communication: between contexts within a single application domain, or across application domains. Between contexts in the same application domain, proxies are used as an interception mechanism. No marshaling/serialization is involved. When crossing application domains, we do marshaling/serialization using the runtime binary protocol.
Cross-process communication uses a pluggable channel and formatter protocol, each suited to a specific purpose.
If the developer specifies an endpoint using the tool soapsuds.exe to generate a metadata proxy, HTTP channel with SOAP formatter is the default.
If a developer is doing explicit remoting in the managed world, it is necessary to be explicit about what channel and formatter to use. This may be expressed administratively, through configuration files, or with API calls to load specific channels. Options are:
HTTP channel w/ SOAP formatter (HTTP works well on the Internet, or anytime traffic must travel through firewalls)
TCP channel w/ binary formatter (TCP is a higher performance option for local-area networks (LANs))
When making transitions between managed and unmanaged code, the COM infrastructure (specifically, DCOM) is used for remoting. In interim releases of the CLR, this applies also to serviced components (components that use COM+ services). Upon final release, it should be possible to configure any remotable component.
Distributed garbage collection of objects is managed by a system called "leased based lifetime." Each object has a lease time, and when that time expires, the object is disconnected from the remoting infrastructure of the CLR. Objects have a default renew time-the lease is renewed when a successful call is made from the client to the object. The client can also explicitly renew the lease.

58. Can I use COM objects from a .NET Framework program?

Yes. Any COM component you have deployed today can be used from managed code, and in common cases the adaptation is totally automatic.
Specifically, COM components are accessed from the .NET Framework by use of a runtime callable wrapper (RCW). This wrapper turns the COM interfaces exposed by the COM component into .NET Framework-compatible interfaces. For OLE automation interfaces, the RCW can be generated automatically from a type library. For non-OLE automation interfaces, a developer may write a custom RCW and manually map the types exposed by the COM interface to .NET Framework-compatible types.



59. Can .NET Framework components be used from a COM program?

Yes. Managed types you build today can be made accessible from COM, and in the common case the configuration is totally automatic. There are certain new features of the managed development environment that are not accessible from COM. For example, static methods and parameterized constructors cannot be used from COM. In general, it is a good idea to decide in advance who the intended user of a given type will be. If the type is to be used from COM, you may be restricted to using those features that are COM accessible.
Depending on the language used to write the managed type, it may or may not be visible by default.
Specifically, .NET Framework components are accessed from COM by using a COM callable wrapper (CCW). This is similar to an RCW (see previous question), but works in the opposite direction. Again, if the .NET Framework development tools cannot automatically generate the wrapper, or if the automatic behavior is not what you want, a custom CCW can be developed.

60. Can I use the Win32 API from a .NET Framework program?

Yes. Using platform invoke, .NET Framework programs can access native code libraries by means of static DLL entry points.
Here is an example of C# calling the Win32 MessageBox function:
using System;
using System.Runtime.InteropServices;

class MainApp
{
[DllImport("user32.dll", EntryPoint="MessageBox")]
public static extern int MessageBox(int hWnd, String strMessage, String strCaption, uint uiType);

public static void Main()
{
MessageBox( 0, "Hello, this is PInvoke in operation!", ".NET", 0 );
}
}

61. What do I have to do to make my code work with the security system?

Usually, not a thing—most applications will run safely and will not be exploitable by malicious attacks. By simply using the standard class libraries to access resources (like files) or perform protected operations (such as a reflection on private members of a type), security will be enforced by these libraries. The one simple thing application developers may want to do is include a permission request (a form of declarative security) to limit the permissions their code may receive (to only those it requires). This also ensures that if the code is allowed to run, it will do so with all the permissions it needs.
Only developers writing new base class libraries that expose new kinds of resources need to work directly with the security system. Instead of all code being a potential security risk, code access security constrains this to a very small bit of code that explicitly overrides the security system.

62. Why does my code get a security exception when I run it from a network shared drive?

Default security policy gives only a restricted set of permissions to code that comes from the local intranet zone. This zone is defined by the Internet Explorer security settings, and should be configured to match the local network within an enterprise. Since files named by UNC or by a mapped drive (such as with the NET USE command) are being sent over this local network, they too are in the local intranet zone.
The default is set for the worst case of an unsecured intranet. If your intranet is more secure you can modify security policy (with the .NET Framework Configuration tool or the CASPol tool) to grant more permissions to the local intranet, or to portions of it (such as specific machine share names).

63. How do I make it so that code runs when the security system is stopping it?

Security exceptions occur when code attempts to perform actions for which it has not been granted permission. Permissions are granted based on what is known about code; especially its location. For example, code run from the Internet is given fewer permissions than that run from the local machine because experience has proven that it is generally less reliable. So, to allow code to run that is failing due to security exceptions, you must increase the permissions granted to it. One simple way to do so is to move the code to a more trusted location (such as the local file system). But this won't work in all cases (web applications are a good example, and intranet applications on a corporate network are another). So, instead of changing the code's location, you can also change security policy to grant more permissions to that location. This is done using either the .NET Framework Configuration tool or the code access security policy utility (caspol.exe). If you are the code's developer or publisher, you may also digitally sign it and then modify security policy to grant more permissions to code bearing that signature. When taking any of these actions, however, remember that code is given fewer permissions because it is not from an identifiably trustworthy source—before you move code to your local machine or change security policy, you should be sure that you trust the code to not perform malicious or damaging actions.

64. How do I administer security for my machine? For an enterprise?

The .NET Framework includes the .NET Framework Configuration tool, an MMC snap-in (mscorcfg.msc), to configure several aspects of the CLR including security policy. The snap-in not only supports administering security policy on the local machine, but also creates enterprise policy deployment packages compatible with System Management Server and Group Policy. A command line utility, CASPol.exe, can also be used to script policy changes on the computer. In order to run either tool, in a command prompt, change the current directory to the installation directory of the .NET Framework (located in %windir%\Microsoft.Net\Framework\v1.0.2914.16\) and type mscorcfg.msc or caspol.exe.

65. What’s the implicit name and type of the parameter that gets passed into the class’ set method?

Value, and it’s data type depends on whatever variable we’re changing.

66. How do you inherit from a class in C#?

Place a colon and then the name of the base class. Notice that it’s double colon in C++.

67. Does C# support multiple inheritance?

No, use interfaces instead.

68. When you inherit a protected class-level variable, who is it available to?

Classes in the same namespace.



69. Are private class-level variables inherited?

Yes, but they are not accessible, so looking at it you can honestly say that they are not inherited. But they are.

69. Describe the accessibility modifier protected internal.

It’s available to derived classes and classes within the same Assembly (and naturally from the base class it’s declared in).

70. C# provides a default constructor for me. I write a constructor that akes a string as a parameter, but want to keep the no parameter one. How many constructors should I write?

Two. Once you write at least one constructor, C# cancels the freebie constructor, and now you have to write one yourself, even if there’s no implementation in it.

71. What’s the top .NET class that everything is derived from?
System.Object .

72. How’s method overriding different from overloading?

When overriding, you change the method behavior for a derived class. Overloading simply involves having a method with the same name within the class.

73. What does the keyword virtual mean in the method definition?
The method can be over-ridden.

74. Can you declare the override method static while the original method is non-static?
No, you can’t, the signature of the virtual method must remain the same, only the keyword virtual is changed to keyword override.

75. Can you override private virtual methods?
No, moreover, you cannot access private methods in inherited classes, have to be protected in the base class to allow any sort of access.

76. Can you prevent your class from being inherited and becoming a base class for some other classes?

Yes, that’s what keyword sealed in the class definition is for. The developer trying to derive from your class will get a message: cannot inherit from Sealed class WhateverBaseClassName. It’s the same concept as final class in Java.

77. Can you allow class to be inherited, but prevent the method from being over-ridden?

Yes, just leave the class public and make the method sealed.

78. What’s an abstract class?

A class that cannot be instantiated.A concept in C++ known as pure virtual method. A class that must be inherited and have the methods over-ridden. Essentially, it’s a blueprint for a class without any implementation.

79. When do you absolutely have to declare a class as abstract (as opposed to free-willed educated choice or decision based on UML diagram)?
When at least one of the methods in the class is abstract. When the class itself is inherited from an abstract class, but not all base abstract methods have been over-ridden.

80. What’s an interface class?
It’s an abstract class with public abstract methods all of which must be implemented in the inherited classes.

81. Why can’t you specify the accessibility modifier for methods inside the interface?
They all must be public. Therefore, to prevent you from getting the false impression that you have any freedom of choice, you are not allowed to specify any accessibility, it’s public by default.

82. Can you inherit multiple interfaces?
Yes, why not.

83. And if they have conflicting method names?
It’s up to you to implement the method inside your own class, so implementation is left entirely up to you. This might cause a problem on a higher-level scale if similarly named methods from different interfaces expect different data, but as far as compiler cares you’re okay.

84. What’s the difference between an interface and abstract class?
In the interface all methods must be abstract, in the abstract class some methods can be concrete. In the interface no accessibility modifiers are allowed, which is ok in abstract classes.

85. How can you overload a method?
Different parameter data types, different number of parameters, different order of parameters.

86. If a base class has a bunch of overloaded constructors, and an inherited class has another bunch of overloaded constructors, can you enforce a call from an inherited constructor to an arbitrary base constructor?
Yes, just place a colon, and then keyword base (parameter list to invoke the appropriate constructor) in the overloaded constructor definition inside the inherited class.

87. What’s the difference between System. String and System.StringBuilder classes?
System. String is immutable; System.StringBuilder was designed with the purpose of having a mutable string where a variety of operations can be performed

88. How big is the data type int in .NET?
32 bits.



89. How big is the char?
16 bits (Unicode).


90. How do you initiate a string without escaping each backslash?
Put an @ sign in front of the double-quoted string.

91. What are valid signatures for the Main function?
public static void Main ()
public static int Main ()
public static void Main ( string[] args )
public static int Main (string[] args )

92. How do you initialize a two-dimensional array that you don’t know the dimensions of?
int [ , ] myArray; //declaration
myArray = new int [5, 8]; //actual initialization

93. What’s the access level of the visibility type internal?
Current application.

94. What’s the difference between struct and class in C#?
Structs cannot be inherited.
Structs are passed by value, not by reference.
Struct is stored on the stack, not the heap.

95. Explain encapsulation.
The implementation is hidden, the interface is exposed.

96. What data type should you use if you want an 8-bit value that’s signed?
sbyte .

97. Speaking of Boolean data types, what’s different between C# and /C++?
There’s no conversion between 0 and false, as well as any other number and true, like in C/C++.

98. Where are the value-type variables allocated in the computer RAM?
Stack.

99. Where do the reference-type variables go in the RAM?
The references go on the stack, while the objects themselves go on the heap.

100. What is the difference between the value-type variables and reference-type variables in terms of garbage collection?
The value-type variables are not garbage-collected, they just fall off the stack when they fall out of scope, the reference-type objects are picked up by GC when their references go null.

101. How do you convert a string into an integer in .NET?
Int32.Parse( string)

102. How do you box a primitive data type variable?
Assign it to the object, pass an object.

103. Why do you need to box a primitive variable?

To pass it by reference.

104. What’s the difference between Java and .NET garbage collectors?

Sun left the implementation of a specific garbage collector up to the JRE developer, so their performance varies widely, depending on whose JRE you’re using. Microsoft standardized on their garbage collection.

105. How do you enforce garbage collection in .NET?

System.GC.Collect ( );

106. Can you declare a C++ type destructor in C# like ~MyClass ()?

Yes, but what’s the point, since it will call Finalize(), and Finalize() has no guarantees when the memory will be cleaned up, plus, it introduces additional load on the garbage collector.

107. What’s different about namespace declaration when comparing that to package declaration in Java?

No semicolon.

108. What’s the difference between const and read only?

You can initialize read only variables to some runtime values. Let’s say your program uses current date and time as one of the values that won’t change. This way you declare public read only string DateT = new DateTime ().ToString ().

109. What does \a character do?

On most systems, produces a rather annoying beep.

110. Can you create enumerated data types in C#?

Yes.

111. What’s different about switch statements in C#?

No fall-throughs allowed.

112. What happens when you encounter a continue statement inside the for loop?

The code for the rest of the loop is ignored; the control is transferred back to the beginning of the loop.

113. Is goto statement supported in C#? How about Java?

Gotos are supported in C# to the fullest. In Java goto is a reserved keyword that provides absolutely no functionality.

What is the different between ASP.NET and VB.NET?

ASP.Net is an “environment”, and VB.Net is a programming language. You can write ASP.Net pages (called “Web Forms” by Microsoft) using VB.Net (or C#, or J# or Managed C++ or any one of a number of .Net compatible languages).

Confusingly, there is an IDE that Microsoft markets called VB.Net, which allows you to write and compile programs (WinForms, WebForms, class libraries etc) written in the language VB.Net

ASP.Net is simple a library that makes it easy for you to create web applications that run against the .NET runtime (similar to the java runtime).

VB.Net is a language that compiles against the common language runtime, like C#. Any .NET compliant language can use the asp.net libraries to create web applications.

Note : Actually there is not an IDE called VB.Net.? Microsoft’s IDE is called Visual Studio.Net which can be used to manage VB.Net, C#, Eiffle, Fortran, and other languages.

How can we create custom controls in ASP.NET?

Custom Controls can be created in either of the following 3 methods.

1. Creating as a composite control : This method uses and combines the existing controls to give a custom functionality which can be used across different projects by adding to the control library. This can provide for event bubbling from child controls to the Parent container, custom event handling and properties. The CreateChildControls function of the Control class should be overridden for creating this custom control. This can also support design time rendering of the control.

2. Deriving from an existing control : This method of creating a custom control derives from an existing ASP .Net control and customizing the properties that we need. This also can support custom event handling, properties etc.,

3. Creating a control from Scratch : This method is the one which needs maximum programming. This method needs even the HTML code for the custom controls to be written by the programmer. This may also need one to implement the IPostBackDataHandler and IPostBackEventHandler interfaces. A detailed explanation with example for this is available at Rendering Custom Controls Sample in MSDN.
How many types of validation controls are provided by ASP.NET ?

RequiredField Validator Control,Range Validator Control, RegularExpression Validator Control,Custom Validator Control and Validation Summary Control are provided by ASP.NET.

Can you explain what is ?AutoPostBack? feature in ASP.NET ?

AutoPostBack is built into the form-based server controls, and when enabled, automatically posts the page back to the server whenever the value of the control in question is changed.

How can you enable automatic paging in DataGrid ?

Using the Built-In Paging Controls

To use default paging, you set properties to enable paging, set the page size, and specify the style of the paging controls. Paging controls are LinkButton controls. You can choose from these types: Next and previous buttons. The button captions can be any text you want. Page numbers, which allow users to jump to a specific page. You can specify how many numbers are displayed; if there are more pages, an ellipsis ( ? ) is displayed next to the numbers. You must also create an event-handling method that responds when users click a navigation control.

To use the built-in paging controlsSet the control?s AllowPaging property to true. Set the PageSize property to the number of items to display per page.

To set the appearance of the paging buttons, include a element into the page as a child of the DataGrid control. For syntax, see DataGrid Control Syntax. Create a handler for the grid?s PageIndexChanged event to respond to a paging request. The DataGridPageChangedEventsArgs enumeration contains the NewPageIndex property, which is the page the user would like to browse to. Set the grid?s CurrentPageIndex property to e.NewPageIndex, then rebind the data.

What exactly happens when ASPX page is requested from Browser?

At its core, the ASP.NET execution engine compiles the page into a class, which derives from the code behind class (which in turn derives directly or indirectly from the Page class). Then it injects the newly created class into the execution environment, instantiates it, and executes it. ASP.NET, on the other hand, can accept code in any language that is compatible with the .NET framework, because it?s compiled down natively just like other code.

How do you deploy an ASP.NET application?

You can deploy an ASP.NET Web application using any one of the following three deployment options.1.XCOPY Deployment

2.Using the Copy Project option in VS .NET

3.Deployment using VS.NET installer

ASP.NET Configuration.

ASP.NET Configuration

The ASP.NET configuration system features an extensible infrastructure that enables you to define configuration settings at the time your ASP.NET applications are first deployed so that you can add or revise configuration settings at any time with minimal impact on operational Web applications and servers.

The ASP.NET configuration system provides the following benefits:

* Configuration information is stored in XML-based text files. You can use any standard text editor or XML parser to create and edit ASP.NET configuration files.

* Multiple configuration files, all named Web.config, can appear in multiple directories on an ASP.NET Web application server. Each Web.config file applies configuration settings to its own directory and all child directories below it. Configuration files in child directories can supply configuration information in addition to that inherited from parent directories, and the child directory configuration settings can override or modify settings defined in parent directories. The root configuration file named systemroot\Microsoft.NET\Framework\versionNumber\CONFIG\Machine.config provides ASP.NET configuration settings for the entire Web server.

* At run time, ASP.NET uses the configuration information provided by the Web.config files in a hierarchical virtual directory structure to compute a collection of configuration settings for each unique URL resource. The resulting configuration settings are then cached for all subsequent requests to a resource. Note that inheritance is defined by the incoming request path (the URL), not the file system paths to the resources on disk (the physical paths).

* ASP.NET detects changes to configuration files and automatically applies new configuration settings to Web resources affected by the changes. The server does not have to be rebooted for the changes to take effect. Hierarchical configuration settings are automatically recalculated and recached whenever a configuration file in the hierarchy is changed. The
section is an exception.

* The ASP.NET configuration system is extensible. You can define new configuration parameters and write configuration section handlers to process them.

* ASP.NET help protect configuration files from outside access by configuring Internet Information Services (IIS) to prevent direct browser access to configuration files. HTTP access error 403 (forbidden) is returned to any browser attempting to request a configuration file directly.

What can be stored in Web.config file?

There are number of important settings that can be stored in the configuration file. Here are some of the most frequently used configurations, stored conveniently inside Web.config file..

1. Database connections
2. Session States
3. Error Handling
4. Security

Difference between Web.config and machine.config.

web.config:
Web.config file, as it sounds like is a configuration file for the Asp .net web application. An Asp .net application has one web.config file which keeps the configurations required for the corresponding application. Web.config file is written in XML with specific tags having specific meanings.

machine.config
As web.config file is used to configure one asp .net web application, same way Machine.config file is used to configure the application according to a particular machine. That is, configuration done in machine.config file is affected on any application that runs on a particular machine. Usually, this file is not altered and only web.config is used which configuring applications.

What is a PostBack?

The process in which a Web page sends data back to the same page on the server.

Name two properties common in every validation control?

ControlToValidate property and Text property.

Can the validation be done in the server side?

Client side validation is done by default. Server side validation is also possible. We can switch off the client side and server side can be done.

How do you validate the controls in an ASP .NET page?

We can Validate the controls in an ASP.NET page by using special validation controls that are meant for this. We have Range Validator, Email Validator.