Interview Tips Interview Tips, Interview Questions and Answers

14Mar/100

C# interview questions and answers, part 2

14. What debugging tools come with the .NET SDK?

Cordbg - command-line debugger, and DbgCLR - graphic debugger. Visual Studio. NET uses the DbgCLR. Cordbg To use, you must compile the original C # using the / debug.

15. What does assert() do?

In debug compilation, assert themselves in a Boolean condition as a parameter, and displays the error dialog if the condition is false. The program continues without interruption if the condition is true.

16. Why are there five tracing levels in System.Diagnostics.TraceSwitcher?

The tracing dumps can be detailed for some applications that are constantly walking, you run the risk of overloading the machine and the hard drive there. Six levels range from None to detail, which allows you to change search activities.

17. How do you debug an ASP.NET Web application?

Attach the aspnet_wp.exe process to the DbgClr debugger.

18. What are three test cases you should go through in unit testing?

Positive check cases (correct information, correct output), negative check cases (broken or missing information, proper handling), exception check cases (exceptions are thrown & caught properly).

19. Can you change the value of a variable while debugging a C# application?

Yes, if you are debugging via Visual Studio.NET, just go to Immediate window.

20. What are advantages and disadvantages of Microsoft-provided data provider classes in ADO.NET?

SQLServer.NET information provider is high speed and robust, but requires purchasing a license for Microsoft SQL Server. OLE-DB.NET is universal for accessing other sources, such as Oracle, DB2, Informix and Microsoft Access, but it is. Network layer on top of OLE layer, so do not fastest in the world. ODBC.NET is a deprecated layer provided for backward compatibility with ODBC engines.

21. What is the wildcard character in SQL? Let’s say you want to query database with LIKE for all employees whose name starts with La.

The wildcard character is %, the proper query with LIKE would involve ‘La%’.

22. Explain ACID rule of thumb for transactions.

Transaction must be atomic (that is four units of work and not depend on previous and subsequent transactions), made (the information is confirmed or roll back, no "between" if something has been updated and something is not any), isolated (no transaction sees the intermediate results of the current transaction), Durable (the values persist if the information had been committed, even if the process is blocked just after).

23. What does the parameter Initial Catalog define inside Connection String?

The database name to connect to.

24. What is a pre-requisite for connection pooling?

Multiple processes must agree that they will share the same connection, where each parameter is the same, including security settings.

6Jan/100

ADO.NET and Database Questions

    1. What is the wildcard character in SQL?Polyglot_Programming_Languages
      Let’s say you want to query database with LIKE for all employees whose name starts with La. The wildcard character is %, the proper query with LIKE would involve ‘La%’.
    2. What is the role of the DataReader class in ADO.NET connections?
      It returns a read-only, forward-only rowset from the data source.  A DataReader provides fast access when a forward-only sequential read is needed.
    3. What are advantages and disadvantages of Microsoft-provided data provider classes in ADO.NET?
      SQLServer.NET data provider is high-speed and robust, but requires SQL Server license purchased from Microsoft. OLE-DB.NET is universal for accessing other sources, like Oracle, DB2, Microsoft Access and Informix. OLE-DB.NET is a .NET layer on top of the OLE layer, so it’s not as fastest and efficient as SqlServer.NET.
    4. What connections does Microsoft SQL Server support?
      Windows Authentication (via Active Directory) and SQL Server authentication (via Microsoft SQL Server username and password).
    5. Between Windows Authentication and SQL Server Authentication, which one is trusted and which one is untrusted?
      Windows Authentication is trusted because the username and password are checked with the Active Directory, the SQL Server authentication is untrusted, since SQL Server is the only verifier participating in the transaction.
    6. What does the Dispose method do with the connection object?
      Deletes it from the memory.
      To Do: answer better. The current answer is not entirely correct.
    7. What is a pre-requisite for connection pooling?
      Multiple processes must agree that they will share the same connection, where every parameter is the same, including the security settings. The connection string must be identical.
    8. What does the Initial Catalog parameter define in the connection string?
      The database name to connect to.
    9. Explain ACID rule of thumb for transactions.
      A transaction must be:
      1. Atomic - it is one unit of work and does not dependent on previous and following transactions.
      2. Consistent - data is either committed or roll back, no “in-between” case where something has been updated and something hasn’t.
      3. Isolated - no transaction sees the intermediate results of the current transaction).
      4. Durable - the values persist if the data had been committed even if the system crashes right after.