Friday 18 September 2015

Basic C#.Net Interview Questions and Answers pdf free download

91. 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,

92. What is the data provider name to connect to Access database? 
Microsoft.Access.

93. Why does my Windows application pop up a console window every time I run it? 
Make sure that the target type set in the project properties setting is set to Windows Application, and not Console Application. If you're using the command line, compile with /target:winexe & not target:exe.

94. What is the wildcard character in SQL?
Let us 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%.

95. What is 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.

96. What does the This window show in the debugger? 
It points to the object that is pointed to by this reference. Object’s instance data is shown.

97. Describe the accessibility modifier protected internal? 
It is available to derived classes and classes within the same Assembly (and naturally from the base class it is declared in).

98. What is an interface class? 
It is an abstract class with public abstract methods all of which must be implemented in the inherited classes.

99. What is a multicast delegate? 
It is a delegate that points to and eventually fires off several methods.

100. How does one compare strings in C#? 
In the past, you had to call .ToString() on the strings when using the == or != operators to compare the strings' values. That will still work, but the C# compiler now automatically compares the values instead of the references when the == or != operators are used on string types. If you actually do want to compare references, it can be done as follows: if ((object) str1 == (object) str2) { ... } Here's an example showing how string compares work: using System;
public class StringTest
{
public static void Main(string[] args)
{
Object nullObj = null;
Object realObj = new StringTest();
int i = 10;
Console.WriteLine("Null Object is [" + nullObj + "]n" +
"Real Object is [" + realObj + "]n" +
"i is [" + i + "]n");
// Show string equality operators
string str1 = "foo";
string str2 = "bar";
string str3 = "bar";
Console.WriteLine("{0} == {1} ? {2}", str1, str2, str1 == str2 );
Console.WriteLine("{0} == {1} ? {2}", str2, str3, str2 == str3 );
}
}
Output: Null Object is []
Real Object is [StringTest]
i is [10]
foo == bar ? False
bar == bar ? True

More Questions & Answers:-

No comments:

Post a Comment