06/6/2007

C# Interview Questions-Answers



General Questions
  1. Is there an equivalent of exit() for quitting a C# .NET application?

    you can use System.Environment.Exit(int exitCode) to exit the application or Application.Exit() if it’s a Windows Forms app.
  2. Is there a way to force garbage collection?

    Set all references to null and then call System.GC.Collect(). If you need to have some objects destructed, and System.GC.Collect() doesn’t seem to be doing it for you, you can force finalizers to be run by setting all the references to the object to null and then calling System.GC.RunFinalizers().

  3. Does C# support multiple-inheritance?

    No.
  4. Who is a protected class-level variable available to?

    It is available to any sub-class (a class inheriting this class).

  5. Are private class-level variables inherited?

    Yes, but they are not accessible.  Although they are not visible or accessible via the class interface, they are inherited.

  6. Describe the accessibility modifier “protected internal”.

    It is available to classes that are within the same assembly and derived from the specified  base class.
  7. What does the term immutable mean?

    The data value may not be changed.  Note: The variable value may be changed, but the original immutable data value was discarded and a new data value was created in memory.

  8. What’s the difference between System.String and System.Text.StringBuilder classes?

    System.String is immutable.  System.StringBuilder was designed with the purpose of having a mutable string where a variety of operations can be performed. 
  9. What’s the advantage of using System.Text.StringBuilder over System.String?

    StringBuilder is more efficient in cases where there is a large amount of string manipulation.  Strings are immutable, so each time a string is changed,  a new instance in memory is created.

  10. What’s the difference between the System.Array.CopyTo() and System.Array.Clone()?

    The Clone() method returns a new array (a shallow copy) object containing all the elements in the original array.  The CopyTo() method copies the elements into another existing array.  Both perform a shallow copy.  A shallow copy means the contents (each array element) contains references to the same object as the elements in the original array.  A deep copy (which neither of these methods performs) would create a new instance of each element's object, resulting in a different, yet identacle object.

  11. Can multiple catch blocks be executed for a single try statement?

    No.  Once the proper catch block processed, control is transferred to the finally block (if there are any).




Categories: FAQ ASP.NET-C#.NET
posted by Maulik Patel at 10:00 AM | Leave Comment [0] | # Link to this entry
04/29/2007

Using the .NET CLR in SQL Server 2005 (Question-Answer)



Q.1 - What are the advantages of CLR integration with SQL Server 2005?
Answer.1 - The integration of the CLR into SQL Server 2005 allows you to run managed code directly within a database. The benefits include: Enhanced programming model, Enhanced safety and security, Common development environment, Performance and scalability

Q.2 - What are the factors based upon which a developer should decide whether to use either managed code or Transact-SQL?
Answer.2 - A developer should use Transact-SQL when code performs data access and has no procedural logic. Managed code should be used when complex programming logic is required to complete a task or the .Net class library is needed.

Q.3 - What features does managed code provide?
Answer.3 - Managed code offers the following features: Type safety, security, fast development, interoperability.

Q.4 - How do you go about enabling the CLR?
Answer.4 - CLR support in SQL Server can be enabled in two ways, either by using SQL Server Surface Area Configuration feature or by using the stored procedure named sp_configue.



Categories: FAQ ASP.NET-C#.NET
posted by Maulik Patel at 10:00 AM | Leave Comment [1] | # Link to this entry

About Me

Maulik Patel
View my complete profile

Friends

Paryank Kansara
woody
Administrator
Nirav Sheth

Links

Know about 14 Gaam
Download Shortkey
Orthotics Management system

Categories

Uncategorized
product
FAQ ASP.NET-C#.NET
Written Test Questions C#.net,asp.net
ASP.NET Interview Questions
General
Short Descriptive Que-Ans
Quiz
C# Interview Questions
New Features ASP.NET C#.NET
Share Points
ASP
ASP.NET
Localization

Archives

April, 2007
August, 2007
December, 2007
February, 2007
February, 2008
January, 2008
July, 2007
June, 2007
June, 2008
March, 2007
November, 2007
October, 2007

RSS Feed