.NET Framework Exclusive Interview Questions and Answers (46) - Page 3

  • A joint initiative from DotNetFunda.Com and Questpond.
  • A one stop place on the internet to get trusted and proven Interview Questions (based on more than a decade of experience in this field) to ensure the success of the candidates.
  • You will find almost all Interview questions from Questpond here and this list is growing day by day with all latest and updated interview questions.

46 records found.

Get 650+ Questpond's Interview videos on discount

C# and .NET interview: - What is the use of "VAR" keyword in C# ?

VAR is a implicit way of defining variable in .NET.Implicit means indirect way of defining variable types.


VAR is used primarily in 2 kinds of scenarios: -


  • When you have long class names and your code is not readable so by using VAR keyword the code becomes short and sweet.

  • When you are using LINQ and anonymous types VAR keyword reduces your code for creating special classes.

  • Also view the following video on use of "VAR" keyword in .NET and C#: -



    C# and .NET interview questions: - What is reflection?

    Reflection helps us to browse methods, properties and function of a given class or assembly on run time. You can also invoke the methods and functions using reflection. Below is a simple sample code where we are browsing in run time through methods and function of “MyClass”.

    MyClass objMyClass = new MyClass();
    
    // Get the class type
    Type parameterType = objMyClass.GetType();
    string name = parameterType.Name;
    // Browse through members
    foreach (MemberInfo objMemberInfo in parameterType.GetMembers())
    {
    Console.WriteLine(objMemberInfo.Name);

    }
    // Browse through properties.
    foreach (PropertyInfo objPropertyInfo in parameterType.GetProperties())
    {
    Console.WriteLine(objPropertyInfo.Name);

    }

    If you want to invoke method and function you need to use the invoke member function as shown in the below code.

    parameterType.InvokeMember("Display",BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.InvokeMethod | BindingFlags.Instance,null, objMyClass, null);

    Also see the following video on use of "VAR" keyword in .NET and C#: -



    c# interview questions :- How do you debug c# applications using Visual studio ?.

    I use the following things for debugging c# applications using visual studio :-



    1. step over if we want to move one step after other.
    2. step in , if we want to move in to a function.
    3. Step out , if we want to move out of the function.
    4. Add watch and Quick watch to see the variable data.
    5. Intellitrace to back trace debugging history.


    Below is a simple video which explains the above 5 debuging tips in .NET


     


    .NET interview questions: - Does garbage collector claim memory allocated to unmanaged code?

    No, Garbage collector only claims memory for managed code i.e. code which is in IL code format. Any other component which is not developed using .NET framework is outside the control of garbage collector.


    See the below garbage collector video for more details: -



    C# interview questions: - How many generations does garbage collector have?

    There are 3 generations in garbage collector generation 0, 1 and 2. Generation 0 are fresh created objects, generation 1 are objects which are bit older than gen 0 and gen 2 are the oldest objects


    See the below garbage collector video for more details: -



    .NET interview questions: - What is the difference between background and foreground thread?

    Background thread die off when the main thread is killed while foreground thread continue irrespective if the main thread dies or exists.


    Below is a simple video which demonstrates what is threading and difference between background and foreground thread.



    More .NET FRAMEWORK Interview Questions & Answers here

    Found this useful, bookmark this page to the blog or social networking websites. Page copy protected against web site content infringement by Copyscape

     Exclusive Interview Questions and Answers Categories