ASP.NET questions, part 2

ASP.NET interview questions, part 1

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

  2. Describe the difference between inline and code behind - which is best in a loosely coupled solution? ASP.NET supports two modes of page development: Page logic code that is written inside <script runat=server> blocks within an .aspx file and dynamically compiled the first time the page is requested on the server. Page logic code that is written within an external class that is compiled prior to deployment on a server and linked "behind" the .aspx file at run time.
  3. Explain what a diffgram is, and a good use for one? A DiffGram is an XML format that is used to identify current and original versions of data elements. The DataSet uses the DiffGram format to load and persist its contents, and to serialize its contents for transport across a network connection. When a DataSet is written as a DiffGram, it populates the DiffGram with all the necessary information to accurately recreate the contents, though not the schema, of the DataSet, including column values from both the Original and Current row versions, row error information, and row order.
  4. Where would you use an iHTTPModule, and what are the limitations of anyapproach you might take in implementing one? One of ASP.NET’s most useful features is the extensibility of the HTTP pipeline, the path that data takes between client and server. You can use them to extend your ASP.NET applications by adding pre- and post-processing to each HTTP request coming into your application. For example, if you wanted custom authentication facilities for your application, the best technique would be to intercept the request when it comes in and process the request in a custom HTTP module.
  5. What are the disadvantages of viewstate/what are the benefits?
  6. Describe session handling in a webfarm, how does it work and what are the limits?
  7. How would you get ASP.NET running in Apache web servers - why would you even do this?
  8. Whats MSIL, and why should my developers need an appreciation of it if at all?
  9. In what order do the events of an ASPX page execute. As a developer is it important to undertsand these events? Every Page object (which your .aspx page is) has nine events, most of which you will not have to worry about in your day to day dealings with ASP.NET. The three that you will deal with the most are: Page_Init, Page_Load, Page_PreRender.
  10. Which method do you invoke on the DataAdapter control to load your generated dataset with data?
    System.Data.Common.DataAdapter.Fill(System.Data.DataSet);

    If my DataAdapter is sqlDataAdapter and my DataSet is dsUsers then it is called this way:

    sqlDataAdapter.Fill(dsUsers);

  11. ata in the Repeater control?
  12. Which template must you provide, in order to display data in a Repeater control? ItemTemplate
  13. How can you provide an alternating color scheme in a Repeater control?
    AlternatingItemTemplate Like the ItemTemplate element, but rendered for every other
    row (alternating items) in the Repeater control. You can specify a different appearance
    for the AlternatingItemTemplate element by setting its style properties.

  14. 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 DataMember property which Gets or sets the specific table in the DataSource to bind to the control and the DataBind method to bind data from a source to a server control. This method is commonly used after retrieving a data set through a database query.

  15. What base class do all Web Forms inherit from? System.Web.UI.Page
  16. What method do you use to explicitly kill a user’s session?
    The Abandon method destroys all the objects stored in a Session object and releases their resources.
    If you do not call the Abandon method explicitly, the server destroys these objects when the session times out.

    Syntax: Session.Abandon

  17. How do you turn off cookies for one page in your site?
    Use the Cookie.Discard Property which Gets or sets the discard flag set by the server. When true, this
    property instructs the client application not to save the Cookie on the user’s hard disk when a session ends.

  18. Which two properties are on every validation control? ControlToValidate & ErrorMessage properties
  19. What tags do you need to add within the asp:datagrid tags to bind columns manually?
  20. How do you create a permanent cookie? Setting the Expires property to MinValue means that the Cookie never expires.
  21. What tag do you use to add a hyperlink column to the DataGrid?
  22. What is the standard you use to wrap up a call to a Web service?
  23. Which method do you use to redirect the user to another page without performing a round trip to the client? Server.transfer()
  24. What is the transport protocol you use to call a Web service? SOAP. Transport Protocols: It is essential for the acceptance of Web Services that they are based on established Internet infrastructure. This in fact imposes the usage of of the HTTP, SMTP and FTP protocols based on the TCP/IP family of transports. Messaging Protocol: The format of messages exchanged between Web Services clients and Web Services should be vendor neutral and should not carry details about the technology used to implement the service. Also, the message format should allow for extensions and different bindings to specific transport protocols. SOAP and ebXML Transport are specifications which fulfill these requirements. We expect that the W3C XML Protocol Working Group defines a successor standard.
  25. True or False: A Web service can only be written in .NET. False.
  26. What does WSDL stand for? Web Services Description Language
  27. What property do you have to set to tell the grid which page to go to when using the Pager object?
  28. Where on the Internet would you look for Web services? UDDI repositaries like uddi.microsoft.com, IBM UDDI node, UDDI Registries in Google Directory, enthusiast sites like XMethods.net.
  29. What tags do you need to add within the asp:datagrid tags to bind columns manually? Column tag and an ASP:databound tag.
  30. Which property on a Combo Box do you set with a column name, prior to setting the DataSource, to display data in the combo box?
  31. How is a property designated as read-only? In VB.NET:
    Public ReadOnly Property PropertyName As ReturnType
    	Get 		 ‘Your Property Implementation goes in here
    	End Get
    End Property

    in C#

    public returntype PropertyName
    {
    	get{
    		//property implementation goes here
    	}
    	// Do not write the set implementation
    }
    
  32. Which control would you use if you needed to make sure the values in two different controls matched? Use the CompareValidator control to compare the values
    of 2 different controls.

  33. True or False: To test a Web service you must create a windows application or Web application to consume this service? False.
  34. How many classes can a single .NET DLL contain? Unlimited.
This entry was posted in .NET, Web dev. Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

19 Comments on ASP.NET questions, part 2

  1. Andrew O
    Posted 3/8/2004 at 6:33 am | Permalink

    @Everybody, Isn’t it much easier to print this page than to have the admin send it to you…

  2. raphu
    Posted 4/9/2004 at 11:34 am | Permalink

    Do you know Where the reference assemblies are stored in .NET application?

  3. AndrewO
    Posted 6/22/2004 at 12:20 pm | Permalink

    Hello Admin, [long time]

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

    Set the sessionState mode in the web.config file to “StateServer”.
    StateServer mode uses an out-of-process Windows NT Server to store state information.
    It solves the session state loss problem in InProc mode.
    Allows a webfarm to store session on a central server.
    It provides a Single point of failure at the State Server.

    Follow these simple steps:
    - In a web farm, make sure you have the same in all your web servers.
    - Also, make sure your objects are serializable.
    - For session state to be maintained across different web servers in the web farm, the Application Path of the website in the IIS Metabase should be identical in all the web servers in the web farm.

  4. Steve Campbell
    Posted 7/12/2004 at 2:02 pm | Permalink

    5) Disadvantage of viewstate is that additional data is sent to the browser. The benefits are that you do not have to manually manage refreshing the page fields after a submit, (when re-displaying the same page).

  5. Posted 3/15/2005 at 1:26 pm | Permalink

    I don’t need to preserve session variables between servers, but would like to preserve them between different .Net applications on the same server. Is there a way to do this?

    Thanks

  6. Posted 3/17/2005 at 6:58 am | Permalink

    This is also one difference between ADO and ADO.Net

    Performance
    Transmitting a large ADO recordset or a large ADO.NET dataset can consume network resources; as the amount of data grows, the stress placed on the network also rises. Both ADO and ADO.NET let you minimize which data is transmitted. But ADO.NET offers another performance advantage, in that ADO.NET does not require data-type conversions. ADO, which requires COM marshalling to transmit records sets among components, does require that ADO data types be converted to COM data types.

  7. Posted 3/17/2005 at 7:07 am | Permalink
  8. Posted 5/20/2005 at 6:20 am | Permalink

    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

    by
    Milan Mathew
    http://www.emilan.tk

  9. Posted 5/20/2005 at 6:27 am | Permalink

    What are the disadvantages of view state / what are the benefits?

    Automatic view-state management is a feature of server controls that enables them to repopulate their property values on a round trip (without you having to write any code). This feature does impact performance, however, since a server control’s view state is passed to and from the server in a hidden form field. You should be aware of when view state helps you and when it hinders your page’s performance.

    What is State Management in .Net and how many ways are there to maintain a state in .Net? What is view state?

    Web pages are recreated each time the page is posted to the server. In traditional Web programming, this would ordinarily mean that all information associated with the page and the controls on the page would be lost with each round trip.
    To overcome this inherent limitation of traditional Web programming, the ASP.NET page framework includes various options to help you preserve changes — that is, for managing state. The page framework includes a facility called view state that automatically preserves property values of the page and all the controls on it between round trips.
    However, you will probably also have application-specific values that you want to preserve. To do so, you can use one of the state management options.
    Client-Based State Management Options:
    View State
    Hidden Form Fields
    Cookies
    Query Strings
    Server-Based State Management Options
    Application State
    Session State
    Database Support

    http://www.emilan.tk

  10. Posted 6/4/2005 at 3:05 am | Permalink

    What is the major difference between Ado and Ado.net?
    Using Dataset Navigation is possible?Explain(First,Next,last,back)
    what is asp.net archietechure?

  11. Tarwn
    Posted 6/7/2005 at 1:47 pm | Permalink

    [From part 1]
    3. Should validation (did the user enter a real date) occur server-side or client-side? Why?
    Client-side validation because there is no need to request a server side date when you could obtain a date from the client machine. so many other reasons, see answer #1

    I heavily disagree. Data validation on client-side is always optional. The only time you should be validating data on the client-side is to make the process smoother for the end-user. Any data that you actually plan on using anywhere should be validated on the server-side and should be considered to have the potential to fail. Without this you are opening yourself to people probing your application for error output or attempting injection or overflow errors.

    19. What tags do you need to add within the asp:datagrid tags to bind columns manually?
    tag and either or tags (with appropriate attributes of course)

    21. What tag do you use to add a hyperlink column to the DataGrid?
    Depends on who’s definition of hyperlink your using. Manually a std html anchor tag (a) will work or you can use the micro-magical tag

    22. What is the standard you use to wrap up a call to a Web service?
    Several possible answers depending on your interpretation of the quesiton, but I think you were aiming for SOAP (with the caveat that this is MS’s version of SOAP)

    24. What is the transport protocol you use to call a Web service?
    SOAP is not the transport protocol. SOAP is the data encapsulation protocol that is used but the transport protocol is fairly unlimited. Generally HTTP is the most common transport protocol used though you could conceivanly use things like SMTP or any others. SOAP is not dependant on any single transport protocol or OS, it is a syntactical and logical definition, not a transport protocol.

    - anyway, those were the ones I saw that were unanswered or mostly wrong

  12. Tarwn
    Posted 6/7/2005 at 1:51 pm | Permalink

    Sorry, apparently missed the part that said tags would be removed from posts:

    19: Columns tag and either asp:BoundColumn or Asp:TemplateColumn tags (with appropriate attributes of course)

    21. Depends on who’s definition of hyperlink your using. Manually a std html anchor tag (a) will work or you can use the micro-magical asp:HyperLink tag

  13. Pawan Kumar
    Posted 7/21/2005 at 9:12 am | Permalink

    How to abandon the session which is already running.

    Let I have a ID, I login once, if some other try to login same time with same ID my first session should be stopped and new session should be start.

    reply ASAP

    Pawan Kumar
    Soft Engr.
    ASP.Net, VB.Net

  14. Adam
    Posted 11/9/2005 at 6:47 pm | Permalink

    22. SOAP Envelope

  15. Saroj Nanda
    Posted 3/2/2006 at 7:04 am | Permalink

    What is the difference between boxing and unboxing???

  16. Posted 6/20/2006 at 1:25 pm | Permalink

    . Describe garbage collection (in simple terms).
    Garbage collection eliminates uneeded objects.
    1. the new statement allocates memory for an object on the heap.
    2. When no objects reference the object it may be removed from the heap (this is a non deterministic process).
    3. Finalize is called just before the memory is released.

  17. Gags
    Posted 7/24/2006 at 4:33 am | Permalink

    Q:What is the difference between boxing and unboxing???
    A: Boxing allows us to convert value types to reference types. Basically, the runtime creates a temporary reference-type box for the object on heap.
    Eg:
    int i=20;
    object o=i;

  18. sunita apte
    Posted 11/28/2006 at 9:31 am | Permalink

    what is difference between .dll & .exe?

  19. Saravanakumaur. Pa
    Posted 1/2/2007 at 12:32 am | Permalink

    ACTIVEX DLL:

    An in-process component, or ActiveX DLL, runs in another application’s process.In-process components are used by applications or other in-process components. this allows you to wrap up common functionality (like an ActiveX Exe).

    ACTIVEX EXE:

    An out-of-process component, or ActiveX EXE, runs in its own address space. The client is usually an application running in another process.The code running in an ActiveX Exe is running in a separate process space. You would usually use this in N-Tier programming. An ActiveX EXE runs out of process while an ActiveX DLL runs in the same process space as VB app. Also, and ActiveX EXE can be run independent of your application if desired.

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*