C# (Sharp) Programming Language Interview Questions And Answers
Learn C# (Sharp) Programming Language by Interview Questions and Answers
1 ► What's 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 in C#?
4 ► Is it possible to have a static indexer 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 implement thread synchronization (Object.Wait, Notify,and CriticalSection) in C#?
11 ► How do you directly call a native function exported from a DLL?
12 ► How do I simulate optional parameters to COM calls?
13 ► The C# keyword .int. maps to which .NET type?
14 ► Which of these string definitions will prevent escaping on backslashes in C#?
15 ► Which of these statements correctly declares a two-dimensional array in C#?
16 ► If a method is marked as protected internal who can access it?
17 ► What is boxing in C#?
18 ► What compiler switch creates an xml file from the xml comments in the files in an assembly?
19 ► What is a satellite assembly in C#?
20 ► What is a delegate in C#?
21 ► How does assembly versioning in .NET prevent DLL Hell?
22 ► Which .Gang of Four. design pattern is shown below?
23 ► In the NUnit test framework, which attribute must adorn a test class in order for it to be picked up by the NUnit GUI?
24 ► Which of the following operations can you NOT perform on an ADO.NET DataSet?
25 ► In Object Oriented Programming, how would you describe encapsulation in C#?
26 ► What do you know about .NET assemblies?
27 ► What is the difference between private and shared assembly?
28 ► What is a strong name in C#?
29 ► How can you tell the application to look for assemblies at the locations other than its own install?
30 ► How can you debug failed assembly binds?
31 ► Where are shared assemblies stored?
32 ► How can you create a strong name for a .NET assembly?
33 ► Where is global assembly cache located on the system?
34 ► Can you have two files with the same file name in GAC?
35 ► So lets say I have an application that uses MyApp.dll assembly ...
36 ► What is delay signing?
37 ► Is there an equivalent of exit() for quitting a C# .NET application?
38 ► Can you prevent your class from being inherited and becoming a base class for some other classes?
39 ► If a base class has a bunch of overloaded constructors ...
40 ► 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?
41 ► How do I make a DLL in C#?
42 ► Will finally block get executed if the exception had not occurred?
43 ► 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?
44 ► Is there regular expression (regex) support available to C# developers?
45 ► Is there a way to force garbage collection?
46 ► Does C# support properties of array types?
47 ► What connections does Microsoft SQL Server support?
48 ► What is a satellite assembly?
49 ► How is method overriding different from overloading?
50 ► When do you absolutely have to declare a class as abstract (as opposed to free-willed educated choice or decision based on UML diagram)?
51 ► Why would you use untrusted verification?
52 ► What is the implicit name of the parameter that gets passed into the class set method?
53 ► How do I register my code for use by classic COM clients?
54 ► How do I do implement a trace and assert?
55 ► How do I create a multilanguage, multifile assembly?
56 ► C# provides a default constructor for me. I write a constructor that takes a string as a parameter ...
57 ► What is the equivalent to regsvr32 and regsvr32 /u a file in .NET development?
58 ► Explain ACID rule of thumb for transactions.
59 ► Where is the output of TextWriterTraceListener redirected?
60 ► How do I create a multilanguage, single-file assembly?
61 ► Why cannot you specify the accessibility modifier for methods inside the interface?
62 ► Is it possible to restrict the scope of a field/method of a class to the classes in the same namespace?
63 ► Why do I get a syntax error when trying to declare a variable called checked?
64 ► Why are there five tracing levels in System.Diagnostics.TraceSwitcher?
65 ► What is the syntax for calling an overloaded constructor within a constructor (this() and constructorname() does not compile)?
66 ► Why do I get a "CS5001: does not have an entry point defined" error when compiling?
67 ► What does the keyword virtual mean in the method definition?
68 ► What optimizations does the C# compiler perform when you use the /optimize+ compiler option?
69 ► How can I create a process that is running a supplied native executable (e.g., cmd.exe)?
70 ► What is the difference between the System.Array.CopyTo() and System.Array.Clone()?
71 ► How do I declare inout arguments in C#?
72 ► Is there a way of specifying which block or loop to break out of when working with nested loops?
73 ► What is the difference between const and static read-only?
74 ► What does the parameter Initial Catalog define inside Connection String?
75 ► What is the difference between System.String and System.StringBuilder classes?
76 ► What is the top .NET class that everything is derived from?
77 ► Can you allow class to be inherited, but prevent the method from being over-ridden?
78 ► Can you change the value of a variable while debugging a C# application?
79 ► Are private class-level variables inherited?
80 ► Can you inherit multiple interfaces?
81 ► From a versioning perspective, what are the drawbacks of extending an interface as opposed to extending a class?
82 ► Which one is trusted and which one is untrusted?
83 ► What namespaces are necessary to create a localized application?
84 ► Does Console.WriteLine() stop printing when it reaches a NULL character within a string?
85 ► What is the advantage of using System.Text.StringBuilder over System.String?
86 ► What are advantages and disadvantages of Microsoft-provided data provider classes in ADO.NET?
87 ► Why do I get a security exception when I try to run my C# app?
88 ► Is there any sample C# code for simple threading?
89 ► What is the difference between // comments, /* */ comments and /// comments?
90 ► What is the difference between and XML documentation tag?
91 ► Explain the three services model (three-tier application). Presentation (UI), business (logic and underlying code) and data (from storage or other sources).
92 ► How do you inherit from a class in C#?
93 ► How do I port "synchronized" functions from Visual J++ to C#?
94 ► Can I define a type that is an alias of another type (like typedef in C++)?
95 ► Is it possible to have different access modifiers on the get/set methods of a property?
96 ► Does C# support #define for defining global constants?
97 ► Does C# support templates?
98 ► Does C# support parameterized properties?
99 ► Does C# support C type macros?
100 ► Can you store multiple data types in System.Array?
101 ► Can you declare the override method static while the original method is non-static?
102 ► Does C# support multiple inheritance?
103 ► Can multiple catch blocks be executed?
104 ► Can you override private virtual methods?
105 ► What is a pre-requisite for connection pooling?
106 ► What is the data provider name to connect to Access database?
107 ► Why does my Windows application pop up a console window every time I run it?
108 ► What is the wildcard character in SQL?
109 ► What is the role of the DataReader class in ADO.NET connections?
110 ► What does the This window show in the debugger?
111 ► Describe the accessibility modifier protected internal?
112 ► What is an interface class in C#?
113 ► What is a multicast delegate in C#?
114 ► What does assert() do in C#?
115 ► How do I get deterministic finalization in C#?
116 ► How can I get around scope problems in a try/catch?
117 ► Why do I get an error (CS1006) when trying to declare a method without specifying a return type?
118 ► How do I convert a string to an int in C#?
119 ► How do you directly call a native function exported from a DLL?
120 ► What is the .NET datatype that allows the retrieval of data by a unique key?
121 ► How do you specify a custom attribute for the entire assembly (rather than for a class)?
122 ► What is the difference between a Struct and a Class?
123 ► What is the implicit name of the parameter that gets passed into the set method/property of a class?
124 ► What does the keyword “virtual” declare for a method or property?
125 ► How is method overriding different from method overloading?
126 ► Can you declare an override method to be static if the original method is not static?
127 ► What are the different ways a method can be overloaded?
128 ► 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?
129 ► What is a C# delegate?
130 ► What is a multicast C# delegate?
131 ► How do you generate documentation from the C# file commented properly with a command-line compiler?
132 ► What debugging tools come with the .NET SDK?
133 ► What does assert() method do?
134 ► What is the difference between the Debug class and Trace class?
135 ► How do you debug an ASP.NET Web application?
136 ► What are three test cases you should go through in unit testing?
137 ► Explain ACID rule of thumb for transactions in C#.
138 ► Between Windows Authentication and SQL Server Authentication, which one is trusted and which one is untrusted?
139 ► What does the Initial Catalog parameter define in the connection string?
140 ► What does the Dispose method do with the connection object?
141 ► How is the DLL Hell problem solved in NET
142 ► What are the ways to deploy an assembly?
143 ► What is the smallest unit of execution in .NET?
144 ► When should you call the garbage collector in .NET?
145 ► How do you convert a value-type to a reference-type?
146 ► Difference between directcast and ctype.
147 ► An example of a ctype and directcast.
148 ► ctype(123.34,integer) - should it throw an error? Why or why not?
149 ► directcast(123.34,integer) - should it throw an error? Why or why not?
150 ► Difference between a sub and a function in C#.
151 ► Explain manifest & metadata in C#.
152 ► Difference between imperative and interrogative code.
153 ► Difference between value and reference type.
154 ► What are the two kinds of properties.
155 ► Constructor in C#.
156 ► Describe ways of cleaning up objects in C#.
157 ► How can you clean up objects holding resources from within the code?
158 ► Which controls do not have events?
159 ► What is the maximum size of the textbox?
160 ► Which property of the textbox cannot be changed at runtime?
161 ► Which control cannot be placed in MDI?
162 ► What is the difference between proc. sent BY VAL and BY SUB?
- Ads By Google