Breaking News

Editors Picks

Saturday, July 3, 2010

ASP.NET interview question




1.What is the sequence in which ASP.NET events are processed?
  Following are the sequence of occurrence of events:-
  Page_Init
  Page_Load
  Control events
  Page_Unload event.

2.In which event are the controls fully loaded?
  Page_Load is the event that fully loads the control. Page_Init can be used to access these controls but viewstate are no fully loaded in the Page_Init.

3. How can we identify that the Page is PostBack?
   IsPostBack is the property which is used to know whether the page is post back.

4. Difference between ASP and ASP.NET?
    The following features are supported by ASP.NET:-
    Better language support
    Better control then ASP
    Control have event support
    Compiled code
    User accounts and roles
    Easy configuration
    Easy Deployment

5. What is event bubbling?
    Datagrid, repeater, and datalist has child control. These child control insteads of raising the event by themselves they pass to the parent. Since the child control pass to the parents the event it is said to be event bubbling.

6. How do you assign Page specific attribute?
    @Page directive is used to assign page specific attribute.

7. What is the use of @Register directives?
    If any custom server control is added to the page it will bo informed to the compiler through @Register directive.

8. What is the use of SmartNavigation property?
    It is a special feature provided by ASP.NET inorder to prevent redrawing and flickering when a page is postback.

9. What is AppSetting Section in “Web.Config” file?
    Web.Config is used in for webproject for configuration. User defined values can be provided using AppSetting.

10. Where is ViewState information stored?
     ViewState information is stored in the HTML Hidden Fields.

11. How can we create custom controls in ASP.NET?
    .ASCX is used to creat controls. After the .ASCX file is created two things are to be done:-
    Register the control in the page using @Register directive.
    Use the accounting footer in page.

12. How many types  of validation controls are provided by ASP.NET?
     Validation control is of six types:-
     RangeValidator
     RequiredFieldValidator
     CompareValidator
     RegularExpressionValidator
     CustomValidator

13. What is AutoPostBack feature in ASP.NET?
     AutoPostBack can be used for if you want the control to pass the postbac of any event automatically for this you require to check whether the attribute is set to be true.

14. How can you enable automatic paging in DataGrid?
     Set the attribute to true state
     Set current pageindex clicked.

15. What’s the use of “GLOBAL.ASAX” file?
     GLOBAL.ASAX file is used to execute the ASP.NET application level and also setting the variables.

16.What is the difference between “Web.Config” and “Machine.Config”?
   “Web.Config” is used to apply setting to all the web application and     “Machine.Config” apply setting only to ASP.NET application.

17. What is impersonation in ASP.NET?
     By default, ASP.NET executes in the security context of a restricted user account on the local machine. Sometimes you need to access network resources such as a file on a shared drive, which requires additional permissions. One way to overcome this restriction is to use impersonation. With impersonation, ASP.NET can execute the request using the identity of the client who is making the request, or ASP.NET can impersonate a specific account you specify in web.config.

18. What are the various ways of authentication techniques in ASP.NET?
      Windows authentication
      Forms Authentication
      Custom Authentication
      Passport Authentication

19. What is tracing in ASP.NET?
      Tracing helps to view how the code is executed in detail.

20. How do I send email message from ASP.NET?
      It provides two namespace System.WEB.mailmessage classand System.Web.Mail.Smtpmail class.                    

21. Explain the differences between server-side and client-side code?
      Client side code is executed on the browser while Server side code is executed at  the server side on IIS in ASP.NET framework,

22. What is the difference between Gridlayout and Flowlayout?
        GridLayout provides absolute positioning for controls placed on the page.   Developers that have their roots in rich-client development environments like Visual Basic will find it easier to develop their pages using absolute positioning, because they can place items exactly where they want them. On the other hand, FlowLayout positions items down the page like traditional HTML. Experienced Web developers favor this approach because it results in pages that are compatible with a wider range of browsers.

23. What are design patterns?
      Design patterns are recurring solution to recurring problems in software architecture

24. What are the different types of pattern Available?
      The three basic types available are:-
      Structural Pattern
      Creation Pattern
      Behavioral Pattern

25. What is the difference between Server.Transfer and response.Redirect?
    Server.Transfer cannot redirect to different from the server itself.
    Server.Transfer helps to preserve information.           
    Response.Redirect sends message to the browser when moving to another page.         





26. What is the difference between Authentication and Authorization?
    Authentication is something that verifies the user identity and authorization is a process where identity is checked and then provided access to the system.

27. What is the method to customize columns in Datagrid?
    The template column can be used to column in Datagrid.

28. What are the major events in GLOBAL.ASAX file?
    Events in GLOBAL.ASAX file are as follows:-
    Application_Init
    Application_Disposed:  
    Application_Error
    Application_End
    Application_Start
    Application_EndRequest
    Application_PreRequestHandlerExcute
    Application_PostRequestHandlerExecute
    Application_PreSendRequestHeaders
    Application_PostSendContent

29. In what order they are triggered?
    They're triggered in the following order: 
    Application_BeginRequest
    Application_AuthenticateRequest
    Application_AuthorizeRequest
    Application_ResolveRequestCache
    Application_AcquireRequestState
    Application_PreRequestHandlerExecute
    Application_PreSendRequestHeaders 
    Application_PreSendRequestContent 
    <<code is executed>> 
    Application_PostRequestHandlerExecute
    Application_ReleaseRequestState 
    Application_UpdateRequestCache 
    Application_EndRequest.

30. How do we enable tracing?
    <%@ Page Trace="true" %>
    The above syntax can be used to enable tracing.

31. How can we kill a user session?
   Session.Abandon can be used to kill user session.

32. What are the different IIS isolation levels?
   IIS has three level of isolation.
   LOW(IIS process)
   Medium(Pooled)
   High(Isolated)

33. What are the steps to create a window service in VB.NET?
    The steps to create a service are as follows:-
    Create a project of type “Windows Service”.
    If you see the class created it is automatically inheriting from “System.ServiceProcess.ServiceBase”.
    You can override the following events provided by service and write your custom code. All the three main events can be used that is Start, stop and continue.
    Now to install the service you need to do run the install util exe. InstallUtil <Project Path>BINMyNewService.exe

34. what is  “Web farms” ?
    Web farms have some redundancy to minimize failures. It contains two or more servers with same configuration and also same kind of content. When any request comes there is switching / routing logic which decides which web server from the farm handles the request. For instance we have two servers “Server1” and “Server2” which have the same configuration and content. So there is a special switch which stands in between these two servers and the users and routes the request accordingly.

35. How to implement MVC pattern in ASP.NET?
    The main goal of using MVC pattern is to decouple the GUI with data. It also provides an ability to view multiple views at the same time.
    The three important sections are:-
  • Model
  • Views
  •  Section

36. What is the difference between Namespace and Assembly?
    The major difference between namespace and assembly are:-
    Assembly is physical grouping up of logical units. Namespace is logically grouped classes
    Namespace can spam multiple Assembly.

37. What is Namespace?
     Namespace perform two basic functions:-
     It logically group types.
     In Object oriented environment the same class name will be used by the programmer. Namespace can use to solve this problem. 

38. What are the different types of JIT?
     Three types of JIT compilers are
  • Pre-JIT
  • Econo-JIT
  • Normal-JIT

39 What is COM?
      When any request comes there is switching / routing logic which decides which web server from the farm handles the request. For instance we have two servers “Server1” and “Server2” which have the same configuration and content. So there is a special switch which stands in between these two servers and the users and routes the request accordingly. which is language independent. DCOM is a distributed extension of COM.

40. What is Multi-threading ?
     Multi-threading forms subset of Multi-tasking. Instead of having to switch between programs this feature switches between different parts of the same program. Example you are writing in word and at the same time word is doing a spell check in background

41. Can we use event with threading?
     Yes, it is possible to use event with threading. It is one of the unique techniques used to synchronize one thread with other.

42 What is the use of interlocked class?
        Interlock class provides methods with which you can achieve functionalities like:-
  • Increment Values
  • Exchange values between variables
  • Decrement Values.
  • Compare values from any variables

43. what are wait handles?
     It sends signals regarding the status of the thread from one thread to another.
     Three kinds of wait mode are as follows:-
  • WaitOne
  • WaitAll
  • WaitAny

44. What is Asynchronous One-Way Calls? 
    One-way calls are a different from asynchronous calls from execution angle that the .NET Framework does not guarantee their execution. In addition, the methods used in this kind of call cannot have return values or out parameters. One-way calls are defined by using [OneWay()] attribute in class.

45. Do webservice have state?
    Webservice do not have any mechanism to maintain state. To inherit state it can make use of the ASP.NET intrinsic objects like application, session.

46. What are the various modes of storing ASP.NET?
     The various modes of storing ASP.NET are as follows:-
  •  InProc
  •  StateServer
  •  SQL Server

47. What are the benefits of using Hidden fields?
      Benefits of hidden fields:-
  • Very simple to implement
  • No server resources required.
  • As data captured they work with web farms.
  • Hidden fields supported by all browsers.
 
48. What are the limitations of using Hidden fields?
      Page performance decreases.
      They don’t support rich structures.
      They can be easily tampered.

49. What is cross page posting?
     It is a new feature provided by ASP.NET it enables to fire a normal post back to a different page in the application. The target page can access the values of server controls in the source page which intiated Postback.

50. What is SQL Cache dependency in ASP.NET?
     It is a new feature provided by ASP.NET. In which the cached data object can automatically be invalidated, when any related data is modified. 
Read more ...

Java Script For Validation


<scriptlanguage="JavaScript">
<!--
function IsNumeric(sText)
{
var ValidChars = ",-()+0123456789 ";
var IsNumber=true;
var Char;
for (i = 0; i < sText.length && IsNumber == true; i++)
{
Char = sText.charAt(i);
if (ValidChars.indexOf(Char) == -1)
{
IsNumber = false;
}
}
return IsNumber;
}
function validate()
{
if(document.form.name.value=="")
{
alert("Please Enter Value for Name Field");
document.form.name.focus();
return false;
}
if(document.form.email.value=="")
{
alert("Please Enter Value for E-Mail Field");
document.form.email.focus();
return false;
}
if(!isEmail(document.form.email.value))
{ alert("Please enter the valid email address.");
document.form.email.select();
document.form.email.focus();
return false; }
if(document.form.phone.value=="")
{
alert("Please Enter Value for Telephone Field");
document.form.phone.focus();
return false;
}
if (!IsNumeric(document.form.phone.value))
{
alert ('Phone number seems incorrect!');
document.form.phone.focus();
return (false);
}
if(document.form.firstChoice.value=="")
{
alert("Please Select Project/Location");
document.form.firstChoice.focus();
return false;
}
if(document.form.secondChoice.value=="")
{
alert("Please Select Project/Location");
document.form.secondChoice.focus();
return false;
}
if(document.form.thirdChoice.value=="")
{
alert("Please Select Project/Location");
document.form.thirdChoice.focus();
return false;
}
if(document.form.appbudg.value=="")
{
alert("Please Select Your Budget");
document.form.appbudg.focus();
return false;
}
if(document.form.query.value=="")
{
alert("Please Enter Value for Query Field");
document.form.query.focus();
return false;
}
return true;
}
function isEmail (emailIn){
var isEmailOk = false;
//var filter = /^[a-zA-Z0-9][a-zA-Z0-9._-]*\@[a-zA-Z0-9-]+(\.[a-zA-Z][a-zA-Z-]+)+$/
var filter = /^(([^<>()[\]\\.,;:\s@\”]+(\.[^<>()[\]\\.,;:\s@\”]+)*)|(\”.+\”))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
if(emailIn.search(filter) != -1)
isEmailOk = true;
if(emailIn.indexOf("..") != -1)
isEmailOk = false;
if(emailIn.indexOf(".@") != -1)
isEmailOk = false;
return isEmailOk;
}
//-->
</script>
Read more ...

ASP. NET interview Question -




1. Is there any event named “ModeChanged”?  
    There is a event such as mode changed that is available in DetailView Control. It take place whenever DetailsView attempts to change between mode of edit,insert and read-only. DetailsView also supports "ModeChanging" event.

2. What are the common security threats for any ASP.NET application?
    Common threats that are associated with ASP.NET application are as follows:-
    SQL Injection 
    Storing Password in simple format
    Cross side scripting
    No user input validation

3. Is it possible to delete application’s settings?
   It is possible to delete application’s setting. It consist of three arguments Application Name, Key and Section name. When all the above are present it deletes the specified key.
DeleteSettings(“testApp”) ‘ Deletes all setting of testapp.

4. Is there any difference between Ucase and toUpper?
   In terms of functionality both are the same. 

5. How to print all the variables in the session?
   It is possible by using special keys we can be able to print all the session variable.

6. What is the difference between Session.Abandon and Session.Clear()?
    Session.Abandon() will end current session by firing Session_End and in the next request, Session_Start will be fire. 
    Session.Clear( ) just clears the session data without killing it. With session.clear variable is not removed from memory it just like giving value null to this session. 
    Session ID will remain same in both cases, as long as the browser is not closed.

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

8. What is the size of the session ID?
   The size of the session ID is 32 bit long integer.

9. What is PLINQ?
   PLINQ stands for parallel LINQ. It is the parallel implementation of LINQ to objects.

10. How will make strings with TitleCase?
    With dynamic pages, sometimes you need to create titles dynamically. At such stage you can not go back to check whether they are stored in proper Title case or not. To make this task happen you can use string class provided toUpper() and toLower() methods but that would be much time consuming and tedious job. You can use, titlecase() method to make it single linear task.

11. What is smart navigation in .NET?
     
1. The scroll position of a Web page is maintained after postback. 
2. The element focus on a Web page is maintained during navigation. 
3.   Only the most recent Web page state is retained in the Web browser history folder. 
4.  The flicker effect that may occur on a Web page during navigation is minimized.

          
12. What is Captacha?
    CAPTCHA stands for Completely Automated Public Turing test to tell computers and Human Apart.
It is used to stop spamming as using web bots the process of sign up or submitting feedback can be made automatic. But having Captcha as additional level input stops web bots from doing successful spamming as web bots cannot read Captcha image content.

13. What are the different level of settings are available for configure cookies in browser?
    Listed cookies available on browser:-
    Low
    Medium
    Block Cookies
    Accept cookies

14. What is IsPostback property in asp.net and how does it work?
     Postback property indicates whether the page is used for the first time. This property checks for __VIEWSTATE or __EVENTTARGET parameter in Request object. if these parameters are absent that means it is requested for the first time and if these parameters are present then this request is not first request.

15. What is the difference between TransferRequest and Transfer method?
     TransferRequest: It Performs asynchronous execution for the URL provided.
     Transfer: current page execution is terminated and starts execution for the URL provided.

16. Which namespace are the generic collection are located?
    Generic collection are located in the namespace System.Collection.Generic.

17. Is it possible to create cookies with key?
    It is possible to create cookies using keys. Cookies is a dictionary at the time of initialization, if key is specified with it.


18. Is it possible to use InProc mode for sessionState in case of web garden?
    It’s not possible. As InProc mode is dependent on the worker process and in case of web garden, we have multiple worker process so session handling becomes difficult. Either we can use StateServer or SQL server mode for web garden.

    
19. What is persistent and non-persistent cookie?
    Non Persistent Cookies:- It is Temporary Cookies which get's stored in browser's memory.
    Persistent Cookie: - It is a permanent cookie that is stored in the user machine.

20. What is the difference between ResolveUrl and ResolveClientUrl?
    ResolveUrl - Returns URL relative to the site root using control’s TemplateSourceDirectory property. 
    ResolveClientUrl – Returns URL relative to the folder containing the source file in which the control is instantiated. 
Read more ...

Contact Us

Name

Email *

Message *