Set - 3

Question 1 :

What connections does Microsoft SQL Server support? 

Answer :

Windows Authentication (via Active Directory) and SQL Server authentication (via Microsoft SQL Server username and passwords)


Question 2 :

What is a satellite assembly?

Answer :

When you write a multilingual or multi-cultural application in .NET, and want to distribute the core application separately from the localized modules, the localized assemblies that modify the core application are called satellite assemblies.


Question 3 :

How is method overriding different from overloading?

Answer :

When overriding, you change the method behavior for a derived class. Overloading simply involves having a method with the same name within the class.


Question 4 :

When do you absolutely have to declare a class as abstract (as opposed to free-willed educated choice or decision based on UML diagram)?

Answer :

When at least one of the methods in the class is abstract. When the class itself is inherited from an abstract class, but not all base abstract methods have been over-ridden.


Question 5 :

Why would you use untrusted verification?

Answer :

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


Question 6 :

What is the implicit name of the parameter that gets passed into the class set method?

Answer :

Value, and its datatype depends on whatever variable we are changing.


Question 7 :

How do I register my code for use by classic COM clients?

Answer :

Use the regasm.exe utility to generate a type library (if needed) and the necessary entries in the Windows Registry to make a class available to classic COM clients. Once a class is registered in the Windows Registry with regasm.exe, a COM client can use the class as though it were a COM class.


Question 8 :

How do I do implement a trace and assert?

Answer :

Use a conditional attribute on the method, as shown below:

class Debug{
	[conditional("TRACE")]
	public void Trace(string s){
		Console.WriteLine(s);
	}
}
class MyClass{
	public static void Main(){
		Debug.Trace("hello");
	}
}

In this example, the call to Debug.Trace() is made only if the preprocessor symbol TRACE is defined at the call site. You can define preprocessor symbols on the command line by using the /D switch. The restriction on conditional methods is that they must have void return type.


Question 9 :

How do I create a multi language, multi file assembly?

Answer :

Unfortunately, this is currently not supported in the IDE. To do this from the command line, you must compile your projects into netmodules (/target:module on the C# compiler), and then use the command line tool al.exe (alink) to link these netmodules together.


Question 10 :

C# provides a default constructor for me. I write a constructor that takes a string as a parameter, but want to keep the no parameter one. How many constructors should I write?

Answer :

Two. Once you write at least one constructor, C# cancels the freebie constructor, and now you have to write one yourself, even if there is no implementation in


Question 11 :

What is the equivalent to regsvr32 and regsvr32 /u a file in .NET development?

Answer :

Try using RegAsm.exe. The general syntax would be: RegAsm. A good description of RegAsm and its associated switches is located in the .NET SDK docs. Just search on "Assembly Registration Tool".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 hasnot), 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).


Question 12 :

Where is the output of TextWriterTraceListener redirected?

Answer :

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


Question 13 :

How do I create a multilanguage, single-file assembly?

Answer :

This is currently not supported by Visual Studio .NET.


Question 14 :

Why cannot you specify the accessibility modifier for methods inside the interface?

Answer :

They all must be public. Therefore, to prevent you from getting the false impression that you have any freedom of choice, you are not allowed to specify any accessibility, it is public by default.


Question 15 :

Is it possible to restrict the scope of a field/method of a class to the classes in the same namespace? 

Answer :

There is no way to restrict to a namespace. Namespaces are never units of protection. But if you're using assemblies, you can use the 'internal' access modifier to restrict access to only within the assembly.


Question 16 :

What is the role of the DataReader class in ADO.NET connections?

Answer :

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.


Question 17 :

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

Answer :

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.


Question 18 :

What is the wildcard character in SQL?

Answer :

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


Question 19 :

Explain ACID rule of thumb for transactions?

Answer :

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.


Question 20 :

What connections does Microsoft SQL Server support?

Answer :

Windows Authentication (via Active Directory) and SQL Server authentication (via Microsoft SQL Server username and password).


Question 21 :

Explain manifest & metadata?

Answer :

Answer1
Manifest is metadata about assemblies. Metadata is machine-readable information about a resource, or ""data about data." In .NET, metadata includes type definitions, version information, external assembly references, and other standardized information. 

Answer2
Manifest: Manifest describes assembly itself. Assembly Name, version number, culture, strong name, list of all files, Type references, and referenced assemblies.
Metadata: Metadata describes contents in an assembly classes, interfaces, enums, structs, etc., and their containing namespaces, the name of each type, its visibility/scope, its base class, the nterfaces it implemented, its methods and their scope, and each method's parameters, type's properties, and so on.


Question 22 :

Difference between imperative and interrogative code?

Answer :

There are imperative and interrogative functions. Imperative functions are the one which return a value while the interrogative functions do not return a value.


Question 23 :

Difference between value and reference type. what are value types and reference types?

Answer :

Value type - bool, byte, chat, decimal, double, enum , float, int, long, sbyte, short, strut, uint, ulong, ushort
Value types are stored in the Stack
Reference type - class, delegate, interface, object, string
Reference types are stored in the Heap


Question 24 :

What are the two kinds of properties?

Answer :

Two types of properties in .Net: Get and Set


Question 25 :

Explain constructor?

Answer :

Constructor is a method in the class which has the same name as the class (in VB.Net its New()). It initializes the member attributes whenever an instance of the class is created.