October 23, 2018

Srikaanth

Hexacta Most Frequently Asked Latest C# Interview Questions Answers

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.

What's 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.

Why Are There Five Tracing Levels In System.diagnostics.traceswitcher?

The tracing dumps can be quite verbose and for some applications that are constantly running you run the risk of overloading the machine and the hard drive there. Five levels range from None to Verbose, allowing to fine-tune the tracing activities.

Where Is The Output Of Textwritertracelistener Redirected?

To the Console or a text file depending on the parameter passed to the constructor.

How Do You Debug An Asp.net Web Application?

Attach the aspnet_wp.exe process to the DbgClr debugger.

What Are Three Test Cases You Should Go Through In Unit Testing?

Positive test cases (correct data, correct output), negative test cases (broken or missing data, proper handling), exception test cases (exceptions are thrown and caught properly).

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.

Explain The Three Services Model (three-tier Application).

Presentation (UI), business (logic and underlying code) and data (from storage or other sources).
Hexacta Most Frequently Asked Latest C# Interview Questions Answers
Hexacta Most Frequently Asked Latest C# Interview Questions Answers

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, but it’s a .NET layer on top of OLE layer, so not the fastest thing in the world. ODBC.NET is a deprecated layer provided for backward compatibility to ODBC engines.

What's The Role Of The Datareader Class In Ado.net Connections?

It returns a read-only dataset from the data source when the command is executed.

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%’.

Explain Acid Rule Of Thumb For Transactions.

Transaction must be Atomic (it is one unit of work and does not dependent on previous and following transactions), Consistent (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).

What Connections Does Microsoft Sql Server Support?

Windows Authentication (via Active Directory) and SQL Server authentication (via Microsoft SQL Server user name and passwords).

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.

Why Would You Use Untrusted Verificaion?

Web Services might use it, as well as non-Windows applications.

What Does The Parameter Initial Catalog Define Inside Connection String?

The database name to connect to.

What's The Data Provider Name To Connect To Access Database?

Microsoft.Access.

Is It True That All C# Types Derive From A Common Base Class?

Yes and no. All types can be treated as if they derive from object (System.Object), but in order to treat an instance of a value type (e.g. int, float) as object-derived, the instance must be converted to a reference type using a process called 'boxing'. In theory a developer can forget about this and let the run-time worry about when the conversion is necessary, but in reality this implicit conversion can have side-effects that may trip up the unwary.

What Are The Fundamental Differences Between Value Types And Reference Types?

C# divides types into two categories - value types and reference types. Most of the intrinsic types (e.g. int, char) are value types. Structs are also value types. Reference types include classes, arrays and strings. The basic idea is straightforward - an instance of a value type represents the actual data, whereas an instance of a reference type represents a pointer or reference to the data.

The most confusing aspect of this for C++ developers is that C# has predetermined which types are represented as values, and which are represented as references. A C++ developer expects to take responsibility for this decision.

For example, in C++ we can do this
int x1 = 3; // x1 is a value on the stack
int *x2 = new int(3) // x2 is a pointer to a value on the heap
but in C# there is no control
int x1 = 3; // x1 is a value on the stack
int x2 = new int();
x2 = 3; // x2 is also a value on the stack!

Okay, So An Int Is A Value Type, And A Class Is A Reference Type. How Can Int Be Derived From Object?

It isn't, really. When an int is being used as an int, it is a value. However, when it is being used as an object, it is a reference to an integer value (on the managed heap). In other words, when you treat an int as an object, the runtime automatically converts the int value to an object reference. This process is called boxing. The conversion involves copying the int to the heap, and creating an object instance which refers to it. Unboxing is the reverse process - the object is converted back to a value.

int x = 3; // new int value 3 on the stack
object objx = x; // new int on heap, set to value 3 - still have x=3 on stack
int y = (int)objx; // new value 3 on stack, still got x=3 on stack and objx=3 on heap

Subscribe to get more Posts :