Top 100 C# Interview Questions and Answers
Top 100 C# Interview Questions and Answers
Top 100 C# Interview Questions and Answers
You are here: Home > Interview Questions > Dot Net Interview Questions and Answers > Top 100 C# Interview Questions and Answers
Top 100 Basic and Advanced C# Interview Questions and Answers for Freshers and 2 - 4 years Experienced Dot Net developers and Testers with
sample code and best answers.
C# is a type-safe, managed and object oriented language, which is compiled by .Net framework for generating intermediate language (IL).
Easy to learn
Object oriented
Component oriented
Part of .NET framework
Ad
We'll try closed
Adnot
by
to show
closed by that ad again
Report this ad
http://a4academics.com/interview-questions/52-dot-net-interview-questions/417-c-oops-interview-questions-and-answers 1/4
12/11/2017 Top 100 C# Interview Questions and Answers
Sealed class is used to prevent the class from being inherited from other classes. So “sealed” modi er also can be used with methods to avoid the
methods to override in the child classes.
class X {}
sealed class Y : X {}
Sealed methods –
class A
class B : A
If any class inherits from class “B” then method – “First” will not be overridable as this method is sealed in class B.
Array stores the values or elements of same data type but arraylist stores values of different datatypes.
Arrays will use the xed length but arraylist does not uses xed length like array.
“Using” statement calls – “dispose” method internally, whenever any exception occurred in any method call and in “Using” statement objects are read
only and cannot be reassignable or modi able.
Namespaces are containers for the classes. We will use namespaces for grouping the related classes in C#. “Using” keyword can be used for using
the namespace in other namespace.
http://a4academics.com/interview-questions/52-dot-net-interview-questions/417-c-oops-interview-questions-and-answers 2/4
12/11/2017 Top 100 C# Interview Questions and Answers
“Const” keyword is used for making an entity constant. We can’t reassign the value to constant.
12) What is the difference between “constant” and “readonly” variables in C#?
“Const” keyword is used for making an entity constant. We cannot modify the value later in the code. Value assigning is mandatory to constant
variables.
“readonly” variable value can be changed during runtime and value to readonly variables can be assigned in the constructor or at the time of
declaration.
“Static” keyword can be used for declaring a static member. If the class is made static then all the members of the class are also made static. If the
variable is made static then it will have a single instance and the value change is updated in this instance.
14) What is the difference between “dispose” and “ nalize” variables in C#?
Dispose - This method uses interface – “IDisposable” interface and it will free up both managed and unmanaged codes like – database connection,
les etc.
Finalize - This method is called internally unlike Dispose method which is called explicitly. It is called by garbage collector and can’t be called from
the code.
Page 1 of 9
Pages 1 2 3 4 5 6 7 8 9
New Articles
Best Job interview tips to land you in your dream job
2015-08-09
Popular Articles
SQL Queries Interview Questions and Answers
2013-02-26