Asp.Net interview Questions and Answers Part 1

By
1. ) What is asp ?                                                                                                             
ASP --> Active Server Page
  • Active :- Active means,an asp page provides dynamic content that are updated every time ,When it is accessed(run).
  • Server:- An asp.net page contains scripts codes that always  Executes on web server.
  • Page:-An asp page is a web page that display in browser when any user execute it and navigate to another web page.
2. ) What is difference between asp and asp.net ?                                                    

3. ) What are the default Name space used on every asp.net page ?                     
  • using System;
  • using System.IO;
  • using System.Web;
  • using System.Web.UI;
  • using System.Web.UI.WebControls;
4. ) What are the page Directives in asp.net?                                                             

5. ) What is AutoEventWireup property of page class in asp.net?                        
It is the the property of page class of asp.net.By default its value is 'true' that means ,event of page class will be bound automatically with event handlers,but if it is 'false' we need to bind even handlers with page class event manually.
Example:- 
true

6. ) What is IsPostBack property of page class in asp.net?                                   When the page is loaded at first time,this variable contains 'false' value,but some event fire on page class and page is send to the server then comes back from the server ,this variable contains true value .so if we want to use some values only for the first time when page is loaded then we can use this properties.
Example
protected void Button2_Click(object sender, EventArgs e)
    {
        if (Page.IsPostBack)
        {
            DropDownList1.Items.Add("msdotnet.co.in");
            DropDownList1.Items.Add("google.co.in");
            DropDownList1.Items.Add("irctc.co.in");
        }
        else
        {
            DropDownList1.Items.Add("My.NET Tutorials");
        }
    }
                   

7. ) What is AutoPostBack Property of asp.net controls?                                        
Whenever we click on a Button, page automatically goes to the server for executing the handler but if we want to handle some other control's event ,we need to set AutoPostBack Property of control is 'True' otherwise any event of that control will not be handled.


screen_output


8. ) What is the use of Response.Redirect() method in asp.net?                            
This function(method) is used to redirect the user from one web page to another web page in asp.net.
Example:-
protected void Button2_Click(object sender, EventArgs e)
    {
        Response.Redirect("default.aspx");
    }

9. ) What is the use of Response.Write() method in asp.net?                                 
This function is used to show the message/Notification on the same web page.
Example:-
protected void Page_Load(object sender, EventArgs e)
    {
        Response.Write("welcom to asp.net website:www.msdotnet.co.in");
    }

10. ) What is the use of Response.Write() method in asp.net?                              
This function is used to write the formatted output on same page in asp.net.There are some difference between Response.write() and Response.Output.write() which are shown in below example.
protected void Page_Load(object sender, EventArgs e)
    {
        Response.Write("welcom to asp.net website:www.msdotnet.co.in ");
        Response.Output.Write("Ram made {0} at {1:d}", "Friend", DateTime.Now);
    }

Output
output

11. ) Are all web forms inherited by  page class in asp.net?                                     
Yes.

12. ) What is the basic coding model of asp .net 4.0?                                               
More Details....

0 comments:

Post a Comment

Powered by Blogger.