C# Interview Answers

2 min
9
0
0
Published on updated on
  1. Can multiple catch blocks be executed? No, once the proper catch code fires off, the control is transferred to the finally block (if there are any), and then whatever follows the finally block.
  2. What is the .NET datatype that allows the retrieval of data by a unique key? HashTable.
  3. What is the advantage of using System.Text.StringBuilder over System.String? StringBuilder is more efficient in the cases, where a lot of manipulation is done to the text. Strings are immutable, so each time it’s being operated on, a new instance is created.
  4. What is a delegate? A delegate object encapsulates a reference to a method. In C++ they were referred to as function pointers.
  5. What is a multicast delegate? It’s a delegate that points to and eventually fires off several methods.
  6. How do you generate documentation from the C# file commented properly with a command-line compiler? Compile it with a /doc switch.
  7. What does assert() do? In debug compilation, assert takes in a Boolean condition as a parameter, and shows the error dialog if the condition is false. The program proceeds without any interruption if the condition is true.
  8. What is the difference between the Debug class and Trace class? Documentation looks the same. Use Debug class for debug builds, use Trace class for both debug and release builds.
  9. Explain ACID rule of thumb for transactions. The transaction must be:

Atomic (it is one unit of work and does not depend on previous and following transactions), Consistent (the data is either committed or roll back, no “in-between” case where something has been updated and something hasn’t),

Isolated (no transaction sees the intermediate results of the current transaction),

Durable (the values persist if the data had been committed even if the system crashes right after).

  1. 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.
  2. Why would you use untrusted verification? Web Services might use it, as well as non-Windows applications.
  3. What does the parameter Initial Catalog define inside Connection String? It defines the database name to connect to.
  4. What is the data provider name to connect to Access database? Microsoft.Access.
  5. What does the Dispose method do with the connection object? It deletes the connection object from the memory.
  6. 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.

Find C# jobs

Continue reading around the topics :

Comment

In the same category

free entry-level IT courses IT Career Advice
Whether you’re looking to switch careers or dive into IT straight from school, you can pick up the essential skills without breaking the bank. We're sharing free resources and answering common questions that can guide you on your journey.
4 min

Connecting Tech-Talent

Free-Work, THE platform for all IT professionals.

Free-workers
Resources
About
Recruiters area
2024 © Free-Work / AGSI SAS
Follow us