Showing posts with label ASP.Net Interview Questions. Show all posts
Showing posts with label ASP.Net Interview Questions. Show all posts

ASP.Net Interview Questions

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

2. What’s the difference between Response.Write() andResponse.Output.Write()? The latter one allows you to write formattedoutput.

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

4. Where does the Web page belong in the .NET Framework class hierarchy?System.Web.UI.Page

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

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

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

8. Suppose you want a certain ASP.NET function executed on MouseOver overa certain button. Where do you add an event handler? It’s the Attributesproperty, the Add function inside that property. So btnSubmit.Attributes.Add("onMouseOver","someClientCode();")

9. What data type does the RangeValidator control support? Integer,String and Date.

10. Explain the differences between Server-side and Client-side code? Server-side code runs on the server. Client-side code runs in the clients’ browser.

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

12. Should validation (did the user enter a real date) occur server-side or client-side? Why? Client-side. This reduces an additional request to the server to validate the users input.

13. What does the "EnableViewState" property do? Why would I want it on or off? It enables the viewstate on the page. It allows the page to save the users input on a form.

14. What is the difference between Server.Transfer and Response.Redirect? Why would I choose one over the other? Server.Transfer is used to post a form to another page. Response.Redirect is used to redirect the user to another page or site.

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

16. Can you give an example of what might be best suited to place in the Application_Start and Session_Start subroutines? This is where you can set the specific variables for the Application and Session objects.

17. If I’m developing an application that must accommodate multiple security levels though secure login and my ASP.NET web application is spanned across three web-servers (using round-robin load balancing) what would be the best approach to maintain login-in state for the users? Maintain the login state security through a database.

18. Can you explain what inheritance is and an example of when you might use it? When you want to inherit (use the functionality of) another class. Base Class Employee. A Manager class could be derived from the Employee base class.

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

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

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

22. Whats MSIL, and why should my developers need an appreciation of it if at all? MSIL is the Microsoft Intermediate Language. All .NET compatible languages will get converted to MSIL.

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

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

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

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

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

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

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

30. What tags do you need to add within the asp:datagrid tags to bind columns manually? Set AutoGenerateColumns Property to false on the datagrid tag

31. What tag do you use to add a hyperlink column to the DataGrid?
?>?>?>
32. What is the transport protocol you use to call a Web service? SOAP is the preferred protocol.
33. True or False: A Web service can only be written in .NET? False

34. What does WSDL stand for? (Web Services Description Language)

35. Where on the Internet would you look for Web services? (http://www.uddi.org/)

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

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

38. True or False: To test a Web service you must create a windows application or Web application to consume this service? False, the webservice comes with a test page and it provides HTTP-GET method to test.How many classes can a single .NET DLL contain? It can contain many classes.


What is Assembly name and name space?

An assembly is a logical unit of code. Physically it may exist as dll or an exe. which can contain one or more files and they can be any file types like image files, text files etc. along with DLLs or EXEs.When you compile your source code by default the exe/dll which is generated is actually an assemblyand every assembly file contains information about itself which is called as Assembly Manifest.Namespace is an abstract container providing context for the items it holds and allows disambiguation of items having the same name (residing in different namespaces. It can also be said as a context for identifiers. So under a namespace you can have multiple assemblies.

what is capacity of dataset?
DataSet is logical represantation of database so it can store as much as database.

What is deployment? How do you deploy .Net and Java applications


Deployment - It is the procedure to deploy Web Application on the Server. You can deploy .Net application by simply Xcopy and create virtual directory for the application on server.

Where this DataSet is Stored?

Dataset is an in-memory representation of a database. Its stored no where but in memory. Goes off when GC stats after a littl sleep.

How different are interface and abstract class in .Net?

When a class is not provided with full functionalitythen it is declared as abstract.it doesn't support instance creation as well as it cannot be overridable to child class.interface is a colection of methods only without functionality.interface is 90% same as abstract class.

How does vs.net 2005 support biztalkserver?

if you install biztalk server it provides Biztalk Project in the project types like webproject, windows project, console project. We use rest of the products of the Biztalk like adapters and all those thing and use them in .net.

what is marshling?

Marshaling performs the necessary conversions in data formats between managed and unmanaged code.CLR allows managed code to interoperate with unmanaged code usining COM Marshaler(Component of CLR).

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

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.

In .NET Compact Framework, can I free memory explicitly without waiting for garbage collector to free the memory?
.NET Compact Framework come with CLR which perform automatic garbage collector to free the memory without using destector(perform garbage collector when is declear)

.Net Interview Questions

     ASP.Net Questions

Q. Explain the differences between Server-side and Client-side code?
A. Server-side code executes on the server. Client-side code executes in
     the context of the clients' browser.

Q. What are some ways to manage state in an ASP.Net application?
A. Session objects, Application objects, ViewState, cookies, hidden form fields.

Q. What does the "EnableViewState" property do? Why would I want it on or off?
A. It allows page objects to save their state in a Base64 encoded string in the page
     HTML. One should only have it enabled when needed because it adds to the
     page size and can get fairly large for complex pages with many controls.
    (It takes longer to download the page).

Q. What is the difference between Server.Transfer and Response.Redirect? Why
      would I choose one over the other?
A. Server.Transfer transfers excution directly to another page. Response.Redirect
     sends a response to the client and directs the client (the browser) to load the
    new page (it causes a roundtrip). If you don't need to execute code on the client,
     Transfer is more efficient.

Q. How can I maintain Session state in a Web Farm or Web Garden?
A. Use a State Server or SQL Server to store the session state.

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

Q. What does WSDL stand for? What does it do?
A.(Web Services Description Language). It describes the interfaces and
     other information of a web service.

Q. Which WebForm Validator control would you use if you needed to make
      sure the values in two different WebForm controls matched?
A. CompareValidator Control

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


     C# Questions

Q. Can you explain what inheritance is and an example of when you might use it?
A. Inheritance allows us to extend the functionality of a base class. It is an "Is a"
     type of relationship rather than a "Uses" type of relationship (a dalmation IS A
     dog which IS A canine which IS A mammal - dalmations inherist from dog which
     inherits from canine which inherits from mammal). All child classes retain the
     properties and methods of their parent classes but may override them. When you
     want to inherit (use the functionality of) another class. Base Class Employee.
     A Manager class could be derived from the Employee base class.

Q. Does C# support multiple-inheritance?
A. No, use interfaces instead.

Q. Can you prevent your class from being inherited by another class?
A. Yes. The keyword “sealed” will prevent the class from being inherited.

Q. What does the keyword “virtual” declare for a method or property?
A. The method or property can be overridden.

Q. What's the top .NET class that everything is derived from?
A. System.Object.

Q. What does it mean that a String is immutable?
A. Strings cannot be altered. When you alter a string (by adding to it for example),
     you are actually creating a new string.

Q. If I have to alter a string many times, such as mutliple concatenations,
      what class should I use?
A. StringBuilder. It is not immutable and is very efficient.

Q. In a Try - Catch - Finally block, will the finally block execute if an exception
      has not occurred? If an Exception has occurred?
A. Yes and yes.

Q. Whats MSIL, and why should developers need an appreciation of it, if at all?
A. MSIL is the Microsoft Intermediate Language. All .NET compatible
      languages will get converted to MSIL.

Q. Explain the three tier or n-Tier model.
A. Presentation (UI), business (logic and underlying code) and data
     (from storage or other sources).

Q. What is SOA?
A. Service Oriented Architecture. In SOA you create an abstract layer that
     your applications use to access various "services" and can aggregate the
     services. These services could be databases, web services, message queues
     or other sources. The Service Layer provides a way to access these services
     that the applications do not need to know how the access is done. For example,
     to get a full customer record, I might need to get data from a SGL Server
     database, a web service and a message queue. The Service layer hides this from
     the calling application. All the application knows is that it asked for a full
     customer record. It doesn't know what system or systems it came from or
      how it was retrieved.

Q. What is the role of the Data Reader class in ADO.NET connections?
A. It returns a forward-only, read-only view of data from the data source when
     the command is executed.

Q. Is XML case-sensitive?
A. Yes.

Q. What is the CLR?
A. Common Language Runtime

Q. Can you explain some differences between an ADO.NET Dataset and
      an ADO Recordset? (Or describe some features of a Dataset).
A. 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

Q. Name some of the Microsoft Application Blocks. Have you used any?
     Which ones?
A. Examples:
     Exception Management
     Logging
     Data Access
     User Interface
     Caching Application Block for .NET
     Asynchronous Invocation Application Block for .NET
     Configuration Management Application Block for .NET
     (there are others) We use Exception and Data Access

Tough ASP.NET interview questions

  • Describe the difference between a Thread and a Process?
  • What is a Windows Service and how does its lifecycle differ from a “standard” EXE?
  • What is the maximum amount of memory any single process on Windows can address? Is this different than the maximum virtual memory for the system? How would this affect a system design?
  • What is the difference between an EXE and a DLL?
  • What is strong-typing versus weak-typing? Which is preferred? Why?
  • What’s wrong with a line like this? DateTime.Parse(myString
  • What are PDBs? Where must they be located for debugging to work?
  • What is cyclomatic complexity and why is it important?
  • Write a standard lock() plus double check to create a critical section around a variable access.
  • What is FullTrust? Do GAC’ed assemblies have FullTrust?
  • What benefit does your code receive if you decorate it with attributes demanding specific Security permissions?
  • What does this do? gacutil /l | find /i “about”
  • What does this do? sn -t foo.dll
  • What ports must be open for DCOM over a firewall? What is the purpose of Port 135?
  • Contrast OOP and SOA. What are tenets of each
  • How does the XmlSerializer work? What ACL permissions does a process using it require?
  • Why is catch(Exception) almost always a bad idea?
  • What is the difference between Debug.Write and Trace.Write? When should each be used?
  • What is the difference between a Debug and Release build? Is there a significant speed difference? Why or why not?
  • Does JITting occur per-assembly or per-method? How does this affect the working set?
  • Contrast the use of an abstract base class against an interface?
  • What is the difference between a.Equals(b) and a == b?
  • In the context of a comparison, what is object identity versus object equivalence?
  • How would one do a deep copy in .NET?
  • Explain current thinking around IClonable.
  • What is boxing?
  • Is string a value type or a reference type?


.Net And ASP.Net Questions


Explain the .NET architecture.

How many languages .NET is supporting now? - When .NET was introduced it came with several languages. VB.NET, C#, COBOL and Perl, etc. The site DotNetLanguages.Net says 44 languages are supported.

How is .NET able to support multiple languages? - a language should comply with the Common Language Runtime standard to become a .NET language. In .NET, code is compiled to Microsoft Intermediate Language (MSIL for short). This is called as Managed Code. This Managed code is run in .NET environment. So after compilation to this IL the language is not a barrier. A code can call or use a function written in another language.

How ASP .NET different from ASP? - Scripting is separated from the HTML, Code is compiled as a DLL, these DLLs can be executed on the server.

Resource Files: How to use the resource files, how to know which language to use?

What is smart navigation? - The cursor position is maintained when the page gets refreshed due to the server side validation and the page gets refreshed.

What is view state? - The web is stateless. But in ASP.NET, the state of a page is maintained in the in the page itself automatically. How? The values are encrypted and saved in hidden controls. this is done automatically by the ASP.NET. This can be switched off / on for a single control

Explain the life cycle of an ASP .NET page.

How do you validate the controls in an ASP .NET page? - Using special validation controls that are meant for this. We have Range Validator, Email Validator.

Can the validation be done in the server side? Or this can be done only in the Client side? - Client side is done by default. Server side validation is also possible. We can switch off the client side and server side can be done.

How to manage pagination in a page? - Using pagination option in DataGrid control. We have to set the number of records for a page, then it takes care of pagination by itself.

What is ADO .NET and what is difference between ADO and ADO.NET? - ADO.NET is stateless mechanism. I can treat the ADO.Net as a separate in-memory database where in I can use relationships between the tables and select insert and updates to the database. I can update the actual database as a batch.