CSharp DotNet Interview Questions and Answers for freshers pdf

1.  What is C# ?
2.  Is it possible to inline assembly or IL in C# code? 
3.  Is it possible to have different access modifiers on the get/set methods of a property? 
4.  Is it possible to have a static indexer in C#? allowed in C#. 
5.  If I return out of a try/finally in C#, does the code in the finally-clause run? 
6.  I was trying to use an out int parameter in one of my functions. How should I declare the variable that I am passing to it? 
7.  How does one compare strings in C#? 
8.  How do you specify a custom attribute for the entire assembly (rather than for a class)? 
9.  How do you mark a method obsolete?
10. How do you directly call a native function exported from a DLL? 
11. How do I simulate optional parameters to COM calls?  
12. What do you know about .NET assemblies? 
13. What’s the difference between private and shared assembly? 
14. What’s a strong name? 
15. How can you tell the application to look for assemblies at the locations other than its own install? 
16. How can you debug failed assembly binds? 
17. Where are shared assemblies stored? 
18. How can you create a strong name for a .NET assembly? 
19. Where’s global assembly cache located on the system? 
20. Can you have two files with the same file name in GAC? 
21. How do I tell the client applications that are already installed to start using this new MyApp.dll?
22. What is delay signing? 
23. Is there an equivalent of exit() for quitting a C# .NET application? 
24. Can you prevent your class from being inherited and becoming a base class for some other classes? 
25. Is XML case-sensitive? 
26. Constructor to an arbitrary base constructor? 
27. I was trying to use an "out int" parameter in one of my functions. How should I declare the variable that I am passing to it? 
28. How do I simulate optional parameters to COM calls? 
29. Will finally block get executed if the exception had not occurred? 
30. What is the C# equivalent of C++ catch (…), which was a catch-all statement for any possible exception? Does C# support try-catch-finally blocks? 
31. If I return out of a try/finally in C#, does the code in the finally-clause run? 
32. Is there regular expression (regex) support available to C# developers?
33. Is there a way to force garbage collection? 
34. Does C# support properties of array types? 
35. What connections does Microsoft SQL Server support? 
36. What is a satellite assembly? 
37. How is method overriding different from overloading? 
38. Why would you use untrusted verification? 
39. What is the implicit name of the parameter that gets passed into the class set method? 
40. How do I register my code for use by classic COM clients? 
41. How do I do implement a trace and assert? 
42. How do I create a multi language, multi file assembly?
43. 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? 
44. What is the equivalent to regsvr32 and regsvr32 /u a file in .NET development? 
45. Where is the output of TextWriterTraceListener redirected? 
46. How do I create a multilanguage, single-file assembly? 
47. Why cannot you specify the accessibility modifier for methods inside the interface? 
48. Is it possible to restrict the scope of a field/method of a class to the classes in the same namespace? 
49. Why do I get a syntax error when trying to declare a variable called checked? 
50. Why are there five tracing levels in System.Diagnostics.TraceSwitcher? 
51. What is the syntax for calling an overloaded constructor within a constructor (this() and constructorname() does not compile)? 
52. Why do I get a "CS5001: does not have an entry point defined" error when compiling? 
53. What does the keyword virtual mean in the method definition? 
54. How can I create a process that is running a supplied native executable (e.g., cmd.exe)?
55. What is the difference between the System.Array.CopyTo() and System.Array.Clone()? 
56. How do I declare inout arguments in C#? 
57. Is there a way of specifying which block or loop to break out of when working with nested loops? 
58. What is the difference between const and static read-only? 
59. What does the parameter Initial Catalog define inside Connection String? 
60. What is the difference between System.String and System.StringBuilder classes? 
61. What is the top .NET class that everything is derived from? 
62. Can you allow class to be inherited, but prevent the method from being over-ridden? 
63. Can you change the value of a variable while debugging a C# application? 
64. Are private class-level variables inherited? 
65. Can you inherit multiple interfaces? 
66. From a versioning perspective, what are the drawbacks of extending an interface as opposed to extending a class?
67. Which one is trusted and which one is untrusted? 
68. What namespaces are necessary to create a localized application? 
69. Does Console.WriteLine() stop printing when it reaches a NULL character within a string? 
70. What is the advantage of using System.Text.StringBuilder over System.String? 
71. What are advantages and disadvantages of Microsoft-provided data provider classes in ADO.NET? 
72. Why do I get a security exception when I try to run my C# app? 
73. Is there any sample C# code for simple threading? 
74. What is the difference between // comments, /* */ comments and /// comments? 
75. What is the difference between and XML documentation tag? 
76. How do you inherit from a class in C#? 
77. How do I port "synchronized" functions from Visual J++ to C#? 
78. Can I define a type that is an alias of another type (like typedef in C++)?
79. Is it possible to have different access modifiers on the get/set methods of a property? 
80. Is it possible to have a static indexer in C#? 
81. Does C# support #define for defining global constants? 
82. Does C# support templates? 
83. Does C# support parameterized properties? 
84. Does C# support C type macros? 
85. Can you store multiple data types in System.Array? 
86. Is it possible to inline assembly or IL in C# code? 
87. Can you declare the override method static while the original method is non-static? 
88. Does C# support multiple inheritance? 
89. Can multiple catch blocks be executed? 
90. Can you override private virtual methods? 
91. What is a pre-requisite for connection pooling? 
92. What is the data provider name to connect to Access database? 
93. Why does my Windows application pop up a console window every time I run it? 
94. What is the wildcard character in SQL?
95. What is the role of the DataReader class in ADO.NET connections? 
96. What does the This window show in the debugger? 
97. Describe the accessibility modifier protected internal? 
98. What is an interface class? 
99. What is a multicast delegate? 
100. How does one compare strings in C#? 
101. What does assert() do? 
102. How do I get deterministic finalization in C#? 
103. How can I get around scope problems in a try/catch? 
104. Why do I get an error (CS1006) when trying to declare a method without specifying a return type? 
105. How do I convert a string to an int in C#?
106. How do you directly call a native function exported from a DLL? 
107. What is the .NET datatype that allows the retrieval of data by a unique key? 
108. How do you specify a custom attribute for the entire assembly (rather than for a class)? 
109. What is the difference between a struct and a class in C#? 
110. What is the difference between the Debug class and Trace class? 
120. How can you overload a method? 
121. What debugging tools come with the .NET SDK? 
122. What does Dispose method do with the connection object? 
123. How do you generate documentation from the C# file commented properly with a command-line compiler? 
124. When you inherit a protected class-level variable, who is it available to? 
125. How can I get the ASCII code for a character in C#? 
126. Is there an equivalent to the instanceof operator in Visual J++? 
127. How do destructors and garbage collection work in C#? 
128. My switch statement works differently! Why? 
129. How can I access the registry from C# code? 
130. How can you sort the elements of the array in descending order? 
131. How do you debug an ASP.NET Web application? 
132. How do you mark a method obsolete? 
133. How is the DLL Hell problem solved in .NET? 
134. What are the ways to deploy an assembly? 
135. Why does DllImport not work for me?
136. What is a delegate? 
137. What is the difference between an interface and abstract class? 
138. What is an abstract class? 
139. Does C# support multiple-inheritance? 
140. Who is a protected class-level variable available to? 
141. Can you store multiple data types in System.Array? 
142. What’s the top .NET class that everything is derived from? 
143. What does the term immutable mean? 
144. What’s the difference between System.String and System.Text.StringBuilder classes? 
145. What’s the advantage of using System.Text.StringBuilder over System.String? 
146. What’s the difference between the System.Array.CopyTo() and System.Array.Clone()? 
147. How can you sort the elements of the array in descending order? 
148. What’s the .NET collection class that allows an element to be accessed using a unique key? 
149. What class is underneath the SortedList class? 
150. Will the finally block get executed if an exception has not occurred?
151. What’s the C# syntax to catch any possible exception? 
152. Can multiple catch blocks be executed for a single try statement? 
153. Explain the three services model commonly know as a three-tier application. 
154. What is the syntax to inherit from a class in C#?
155. Can you prevent your class from being inherited by another class? 
156. Can you allow a class to be inherited, but prevent the method from being over-ridden? 
157. When do you absolutely have to declare a class as abstract? 
158. What’s the difference between an interface and abstract class? 
159. What is the difference between a Struct and a Class? 
160. Why are there five tracing levels in System.Diagnostics.TraceSwitcher?

0 comments: