1. What is the difference between proc. sent BY VAL and BY SUB?

BY VAL: changes will not be reflected back to the variable.
By REF: changes will be reflected back to that variable.( same as & symbol in c, c++)

2. Which control cannot be placed in MDI?

The controls that do not have events.

6. How can you clean up objects holding resources from within the code?

Call the dispose method from code for clean up of objects

7. Describe ways of cleaning up objects in C#.

Answer1
There is a perfect tool provide by .net frameworks calles Garbage collector, where by mean of GC we can clean up the object and reclaim the memory.The namespace used is System.GC

Answer2
the run time will maintain a service called as garbage collector.this service will take care of deallocating memory corresponding to objects.it works as a thread with least priority.when application demenads for memory the runtime will take care of setting the high priority for the garbage collector,so that it will be called for execution and memory will be released.the programmer can make a call to garbage colector by using GC class in ststem name space.

8. Constructor in C#.

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

9. What are the two kinds of properties.

Two types of properties in .Net: Get and Set

10. Difference between value and reference type.

what are value types and reference types?
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

Download Interview PDF

11. Difference between imperative and interrogative code.

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

12. Explain manifest & metadata in C#.

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.

13. Difference between a sub and a function in C#.

Answer1
A Sub does not return anything whereas a Function returns something.

Answer2
-A Sub Procedure is a method will not return a value
-A sub procedure will be defined with a “Sub” keyword

Sub ShowName(ByVal myName As String)
Console.WriteLine(”My name is: ” & myName)
End Sub

-A function is a method that will return value(s).
-A function will be defined with a “Function” keyword

Function FindSum(ByVal num1 As Integer, ByVal num2 As Integer) As Integer
Dim sum As Integer = num1 + num2
Return sum
End Function

14. directcast(123.34,integer) - should it throw an error? Why or why not?

It would throw an InvalidCast exception as the runtime type of 123.34 (double) doesnt match with Integer.

15. ctype(123.34,integer) - should it throw an error? Why or why not?

Answer1
It would work fine. As the runtime type of 123.34 would be double, and Double can be converted to Integer.

Answer2
the ctype(123.34,integer) will work fine no errors

16. An example of a ctype and directcast.

In the preceding example, the run-time type of Q is Double. CType succeeds because Double can be converted to Integer, but DirectCast fails because the run-time type of Q is not already Integer

17. Difference between directcast and ctype.

Anser1
DirectCast requires the run-time type of an object variable to bethe same as the specified type.The run-time performance ofDirectCast is better than that of CType, if the specified type and the run-time typeof the expression are the same. Ctype works fine if there is a valid conversion defined between the expression and the type.

Answer2
The difference between the two keywords is that CType succeeds as long as there is a valid conversion defined between the expression and the type, whereas DirectCast requires the run-time type of an object variable to be the same as the specified type. If the specified type and the run-time type of the expression are the same, however, the run-time performance of DirectCast is better than that of CType.

19. When should you call the garbage collector in .NET?

As a good rule, you should not call the garbage collector. However, you could call the garbage collector when you are done using a large object (or set of objects) to force the garbage collector to dispose of those very large objects from memory. However, this is usually not a good practice.

21. What are the ways to deploy an assembly?

An MSI installer, a CAB archive, and XCOPY command.

22. How is the DLL Hell problem solved in NET

Assembly versioning allows the application to specify not only the library it needs to run (which was available under Win32), but also the version of the assembly.

25. 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.

26. Explain ACID rule of thumb for transactions in C#.

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.

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

1. Positive test cases (correct data, correct output).
2. Negative test cases (broken or missing data, proper handling).
3. Exception test cases (exceptions are thrown and caught properly).

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

Attach the aspnet_wp.exe process to the DbgClr debugger.

29. 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.

30. What does assert() method 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.

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

1. CorDBG - command-line debugger. To use CorDbg, you must compile the original C# file using the /debug switch.
2. DbgCLR - graphic debugger. Visual Studio .NET uses the DbgCLR.

33. What is a multicast C# delegate?

A delegate that has multiple handlers assigned to it. Each assigned handler (method) is called.

34. What is a C# delegate?

A delegate object encapsulates a reference to a method.

35. If a base class has a number of overloaded constructors, and an inheriting class has a number of overloaded constructors; can you enforce a call from an inherited constructor to a specific base constructor?

Yes, just place a colon, and then keyword base (parameter list to invoke the appropriate constructor) in the overloaded constructor definition inside the inherited class.