C Sharp Interviews Questions
C Sharp Interviews Questions
1) What is c sharp
Ans- C# is an object-oriented programming language compiled by the .Net framework to
generate Microsoft Intermediate Language. It’s used to create desktop apps, mobile apps,
web apps, websites, and web services.
Ans- The most significant difference between C# and its predecessor, C, is that C# is an object-
oriented programming language, whereas C is a procedural programming language.
Private -Private members are accessible only within the same class or struct in
which they are declared .they cannot be accessed from outside the class or
struct,including derived classes.(Accessible only within the same class or struct)
Protected – data members and function are access only in derived class,
protect members are accessible within the same class or struct and any derived
classes.they are not accessible from outside the class or struct ,except through
derived classes. In other words protected members are accessible within the
inheritance hierarachy. (Accessible within the same class or struct and derived
classes)
C# is component-oriented.
It is an object-oriented language.
It is easier to learn.
6) what is CLR?
Ans- it is a program execution engine that loads and executes the program it
convert the program into native code it acts as an interface between
frameworks and operating system it does exception handling , memory
management and garbage collections.
7) What is the difference between public , static and void?
Ans- public - You can access public declared variables anywhere in the application.
Static - Static declared variables are globally accessible without creating an instance of the
class.
Void - Void is a type modifier that specifies that the method doesn't return any value.
Also note that the constructor is called when the object is created.
All classes have constructors by default: if you do not create a class constructor yourself, C#
creates one for you. However, then you are not able to set initial values for fields.
9) What are the different type of constructor?
Ans-