In this post we will discuss some of the C#.Net basic interview questions and answers. Also you can check out:
– WCF interview questions and answers in C#.Net
– asp.net state management interview questions and answers
– Ado.Net interview questions in Asp.Net
1. What is C#.Net (C-Sharp)?
i. C# is a new language created by Microsoft and submitted to the ECMA for standardization.
ii. According Microsoft “C# is a modern, object-oriented language that enables programmers to quickly build a wide range of applications for the new Microsoft .Net platform, which provides tools and services that fully exploit both computing and communications.”
2. What are the characteristics of C#.Net?
C#.Net is designed for both computing and communication is characterized by several key features. It is –
3. What is BOXING and UNBOXING in C#.Net?
BOXING in C#.Net is the conversion of a VALUE type on stack to a OBJECT type on the heap. Vice-versa the conversion from an OBJECT type back to a VALUE type is known as UNBOXING and it requires type casting.
4. In how many ways you can create new copies of an existing string in C#.Net?
There are two ways:
i. Using overloaded = operator like strings2=s1;
ii. Using the static Copy method like – string s2 = string.Copy(s1);
5. In how many ways you can create new copies of an existing string in C#.Net?
There are two ways:
1. Using overloaded = operator like strings2=s1;
2. Using the static Copy method like – string s2 = string.Copy(s1);
6. Which collection class uses the unique key for the collection?
7. What is thread?
It is a process which executes independently.
8. Can interface have static member?
9. Can constructers have access specifier ?
10. How do I launch Internet Explorer in C#.Net?
using the statement – System.Diagnostics.Process.Start(“IExplore.exe”,http://www.google.com);
11. Is it possible to have a static indexer in C#.Net?
No, they are not allowed in C#.Net.
12. Are constructors inherited in C#.Net?
No, constructors are not inherited.
13. How is method overriding different from method overloading?
When overriding a method, you change the behavior of the method for the derived class.
Overloading a method simply involves having another method with the same name within the class.
14. Does C#.Net do array bounds checking?
Yes. An IndexOutOfRange exception is used to signal an error.
15. What happens in memory when you Box and Unbox a value-type?
Boxing converts a value-type to a reference-type, thus storing the object on the heap.
Unboxing converts a reference-type to a value-type, thus storing the value on the stack.
16. How do you convert a value-type to a reference-type?
By Using Boxing.