In this post we will discuss some of the C#.Net basic interview questions and answers.
Also check some posts on:
- Working with enterprise library for data access in asp.net Part-1
- Get last modified time of a file in C#.Net
- RegularExpressionValidator example 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 -
i. Simple
ii. Consitent
iii. Modern
iv. Object-oriented
v. Type-safe
vi. Versionable
vii. Compatible
viii. Interoprable
ix. Flexible
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?
HashTable
7. What is thread?
It is a process which executes independently.
8. Can interface have static member?
No.
9. Can constructers have access specifier ?
Yes
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.
Also check out C#.Net WindowsForm interview questions and answers, Asp.Net MVC interview questions and answers, asp.net state management interview questions and answers and Ado.Net interview questions in Asp.Net.
Also check some posts on:
- Working with enterprise library for data access in asp.net Part-1
- Get last modified time of a file in C#.Net
- RegularExpressionValidator example 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 -
i. Simple
ii. Consitent
iii. Modern
iv. Object-oriented
v. Type-safe
vi. Versionable
vii. Compatible
viii. Interoprable
ix. Flexible
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?
HashTable
7. What is thread?
It is a process which executes independently.
8. Can interface have static member?
No.
9. Can constructers have access specifier ?
Yes
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.
Also check out C#.Net WindowsForm interview questions and answers, Asp.Net MVC interview questions and answers, asp.net state management interview questions and answers and Ado.Net interview questions in Asp.Net.