C# Interview Question and Answers

1. What is C#?
 
  • C# is a programming language designed by Microsoft. It is loosely based on C/C++, and bears a striking similarity to Java in many ways. Microsoft describes C# as follows.
  • C# is a simple, modern, object oriented and type safe programming language derived from C and C++. C#(pronounced C sharp) is firmly planted in the C and C++ family tree of languages, and will immediately be familiar to C and C++ programmers.
  • C# aims to combine the high productivity of Visual Basic and the raw power of C++.
 
Your Name Your Email-ID
Your Answer
2. How many languages .NET is supporting now?
  When .NET was introduced it came with some 16 languages. VB.NET, C#, COBOL and PERL etc.
 
Your Name Your Email-ID
Your Answer
3. What are the escape sequence supported by c#?
  C# defines the following character escape sequences:
  • \' – single quote, needed for character literals
  • \" – double quote, needed for string literals
  • \\ - backslash
  • \0 - Unicode character 0
  • \a – Alert (character 7)
  • \b – Backspace (character 8)
  • \f – Form feed (character 12)
  • \n – New line (character 10)
  • \r – Carriage return (character 13)
  • \t – Horizontal tab (character 9)
  • \v – Vertical quote (character 11)
  • \uxxxx – Unicode escape sequence for character with hex value xxxx
  • \xn[n][n][n] – Unicode escape sequence for character with hex value nnnn ( variable length version of \ uxxxx)
  • \Uxxxxxxxx – Unicode escape sequence for character with hex value xxxxxxxx (for generating surrogates) Of these, \a, \f, \v, \x and \U are rarely used in my experience.
 
Your Name Your Email-ID
Your Answer
4. Is C# an object oriented language?
  Yes. C# provides language support for the so called "Three Pillars of Object Oriented Programming" : encapsulation, polymorphism and inheritance.
 
Your Name Your Email-ID
Your Answer
5. What are sealed classes in C#?
 
  • The sealed modifier is used to prevent derivation from a class.
  • A compile time error occurs if a sealed class is specified as the base class of another class. (A sealed class cannot also be an abstract class).
 
Your Name Your Email-ID
Your Answer
12345678910 Page 1 of 10