You must Sign In to post a response.
  • Category: ASP.NET

    Question asked in Interview

    2 day before I had interview. Interviewer asked me these questions? I was not able to answer them.

    How to Handle exception without try catch block in C#?
    Which software is used to debug not visual studio (line by line). Suppose there are 1000 lines of code.I have not used any software yet for this.Does anybody having any idea.
    Difference between var and dynamic?
    How to set master page dynamically?
  • #765758
    Hi Pinky,

    I have answered your question, please look into this if you still having doubts then revert to me.

    1 ) How to Handle exception without try catch block in C#?
    A) We can handle exception without using try catch, using Global.asax and use the Application error event to raise respective errors.

    2) Which software is used for debugging?
    A) If you are not used any software, my suggestion is simply skip the question. Even I'm not very sure about this.

    3) Difference between var and dynamic keyword?
    A) refer below article this will give you clear picture of this, http://www.codeproject.com/Tips/460614/Difference-between-var-and-dynamic-in-Csharp

    4) How to set master page dynamically?
    A) we can set the master page in page level in 2 ways, one is in designer side and another one is in code behind side.

    UI Designer side:

    <%@ Page Language="C#" MasterPageFile="~/masterpage.master" ... %>


    code behind side:

    protected void Page_PreInit(object sender, EventArgs e)
    {
    this.MasterPageFile = "~/masterpage.master";
    }


    Hope this will helpful to you...

    --------------------------------------------------------------------------------
    Give respect to your work, Instead of trying to impress your boss.

    N@veen
    Blog : http://naveens-dotnet.blogspot.in/

  • #765760
    1. if you working on asp.net application web.config has application_error event in that you can catch the exception directly.
    2. what you want to debug exactly, firebug can be used to debug the javascript
    3. var vs dynamic
    var : it is Statically typed – This means the type of variable declared is decided by the compiler at compile time, Since the compiler knows about the type and the methods and properties of the type at the compile time itself, Visual Studio shows intelligence since the type of variable assigned is known to compiler.
    Dynamic : it is Dynamically typed - This means the type of variable declared is decided by the compiler at runtime time, Since the compiler comes to about the type and the methods and properties of the type at the run time, intelligence is not available since the type and its related methods and properties can be known at run time only

    Thanks
    Koolprasd2003
    Editor, DotNetSpider MVM
    Microsoft MVP 2014 [ASP.NET/IIS]

  • #765765
    Thanks naveensanagasetti and Prasad kulkarni for ur help.


Sign In to post your comments