Showing posts with label c# questions asked. Show all posts
Showing posts with label c# questions asked. Show all posts

C# interview faqs mostly asked questions in interview

C# interview questions
1 Describe the difference between a Thread and a Process?

2 What is a Windows Service and how does its lifecycle differ from a "standard" EXE?

3 What is the maximum amount of memory any single process on Windows can address? Is this different than the maximum virtual memory
for the system? How would this affect a system design?

4 What is the difference between an EXE and a DLL?

5 What is strong-typing versus weak-typing? Which is preferred? Why?

6 Corillian's product is a "Component Container." Name at least 3 component containers that ship now with the Windows Server Family.

7 What is a PID? How is it useful when troubleshooting a system?

8 How many processes can listen on a single TCP/IP port?

9 What is the GAC? What problem does it solve?

10 What is serialization in .NET? What are the ways to control serialization?

11 Does C# support multiple inheritance?

12 What’s the implicit name of the parameter that gets passed into the class’ set method?

13 What’s the top .NET class that everything is derived from?

14 How’s method overriding different from overloading?

15 What is CLR?

16 What is CTS?

17 What is CLS?

18 What is strong name?

19 What is Application Domain?

20 Describe the difference between Interface-oriented, Object-oriented and Aspect-oriented programming.

21 Describe what an Interface is and how it’s different from a Class.

22 What is Reflection?

23 What is the difference between XML Web Services using ASMX and .NET Remoting using SOAP?

24 Are the type system represented by XmlSchema and the CLS isomorphic?

25 Conceptually, what is the difference between early-binding and late-binding?

26 Is using Assembly.Load a static reference or dynamic reference?

27 When would using Assembly.LoadFrom or Assembly.LoadFile be appropriate?

28 What is an Asssembly Qualified Name? Is it a filename? How is it different?

29 Is this valid? Assembly.Load("foo.dll");

30 How is a strongly-named assembly different from one that isn’t strongly-named?

31 Can DateTimes be null?

32 What is the JIT? What is NGEN? What are limitations and benefits of each?

33 How does the generational garbage collector in the .NET CLR manage object lifetime? What is non-deterministic finalization?

34 What is the difference between Finalize() and Dispose()?

35 How is the using() pattern useful? What is IDisposable? How does it support deterministic finalization?

36 What does this useful command line do? tasklist /m "mscor*"

37 What is the difference between in-proc and out-of-proc?

38 What technology enables out-of-proc communication in .NET?

39 When you’re running a component within ASP.NET, what process is it running within on Windows XP? Windows 2000? Windows 2003?

40 What is FullTrust? Do GAC’ed assemblies have FullTrust?

41 What are Satellite Assemblies?

42 What is Global Assembly Cache (GAC) and what is the purpose of it?

43 What is Reflection in .NET?

44 What is the managed and unmanaged code in .net?

45 What are Namespaces?

46 What are the access-specifiers available in c#?

47 Advantage of ADO.Net?

48 Difference between OLEDB Provider and SqlClient ?

49 Differences between dataset.clone and dataset.copy?

50 In a Webservice, need to display 10 rows from a table. So DataReader or DataSet is best choice?

51 What is Remoting?

52 What’s the difference between System.String and System.StringBuilder classes?

53 What’s a delegate?

54 What’s an interface class?

55 What is the transport protocol you use to call a Web service ?

56 What’s wrong with a line like this? DateTime.Parse(myString);

57 What are PDBs? Where must they be located for debugging to work?

58 What is cyclomatic complexity and why is it important?

59 Write a standard lock() plus “double check” to create a critical section around a variable access.

60 What benefit does your code receive if you decorate it with attributes demanding specific Security permissions?

61 What does this do? gacutil /l | find /i "Corillian"

62 What does this do? sn -t foo.dll

63 What ports must be open for DCOM over a firewall? What is the purpose of Port 135?

64 Contrast OOP and SOA. What are tenets of each?

65 How does the XmlSerializer work? What ACL permissions does a process using it require?

66 Why is catch(Exception) almost always a bad idea?

67 What is the difference between Debug.Write and Trace.Write? When should each be used?

68 What is the difference between a Debug and Release build? Is there a significant speed difference? Why or why not?

69 Does JITting occur per-assembly or per-method? How does this affect the working set?

70 Contrast the use of an abstract base class against an interface?

71 What is the difference between a.Equals(b) and a == b?

72 In the context of a comparison, what is object identity versus object equivalence?

73 How would one do a deep copy in .NET?

74 Explain current thinking around IClonable.

75 What is boxing?

76 Is string a value type or a reference type?

77 What is the significance of the "PropertySpecified" pattern used by the XmlSerializer? What problem does it attempt to solve?

78 Why are out parameters a bad idea in .NET? Are they?

79 Can attributes be placed on specific parameters to a method? Why is this useful?

80 Juxtapose the use of override with new. What is shadowing?

81 Explain the use of virtual, sealed, override, and abstract.

82 Explain the importance and use of each component of this string: Foo.Bar, Version=2.0.205.0, Culture=neutral, PublicKeyToken=593777ae2d274679d

83 Explain the differences between public, protected, private and internal.

84 What benefit do you get from using a Primary Interop Assembly (PIA)?

85 By what mechanism does NUnit know what methods to test?

86 What is the difference between: catch(Exception e){throw e;} and catch(Exception e){throw;}

87 What is the difference between typeof(foo) and myFoo.GetType()?

88 Explain what’s happening in the first constructor: public class c{ public c(string a) : this() {;}; public c() {;} } How is this construct useful?

89 What is this? Can this be used within a static method?

C# interview questions on Destructors

C# interview questions on Destructors

What is a Destructor?
A Destructor has the same name as the class with a tilde character and is used to destroy an instance of a class.

Can a class have more than 1 destructor?

No, a class can have only 1 destructor.

Can structs in C# have destructors?
No, structs can have constructors but not destructors, only classes can have destructors.

Can you pass parameters to destructors?
No, you cannot pass parameters to destructors. Hence, you cannot overload destructors.

Can you explicitly call a destructor?

No, you cannot explicitly call a destructor. Destructors are invoked automatically by the garbage collector.

Why is it not a good idea to use Empty destructors?
When a class contains a destructor, an entry is created in the Finalize queue. When the destructor is called, the garbage collector is invoked to process the queue. If the destructor is empty, this just causes a needless loss of performance.

Is it possible to force garbage collector to run?
Yes, it possible to force garbage collector to run by calling the Collect() method, but this is not considered a good practice because this might create a performance over head. Usually the programmer has no control over when the garbage collector runs. The garbage collector checks for objects that are no longer being used by the application. If it considers an object eligible for destruction, it calls the destructor(if there is one) and reclaims the memory used to store the object.

Usually in .NET, the CLR takes care of memory management. Is there any need for a programmer to explicitly release memory and resources? If yes, why and how?
If the application is using expensive external resource, it is recommend to explicitly release the resource before the garbage collector runs and frees the object. We can do this by implementing the Dispose method from the IDisposable interface that performs the necessary cleanup for the object. This can considerably improve the performance of the application.

When do we generally use destructors to release resources?
If the application uses unmanaged resources such as windows, files, and network connections, we use destructors to release resources.

Keywords:
destructor in c# tutorialspoint
constructor and destructor in c#
c# destructor vs dispose
c# destructor not called
destructor in c# in hindi
difference between constructor and destructor in c++
c# destructor vs finalize
virtual destructor in c# net
c# destructor not called
c# finalizer vs destructor
c# static destructor
c# struct constructor
c# form destructor
c# force destructor call
c++ struct destructor
finalize c#
c# destructor not called
c# destructor vs dispose
c# destructor vs finalize
constructor and destructor in c#
destructor in c# tutorialspoint
c# struct destructor
c# static destructor
c# when is destructor called