C# interview Question
What is C# (C-Sharp)
C-Sharp is a Object oriented programming language that was developed by Microsoft run on .NET Core and .NET Framework. its similar to other programming language like c, c++ and java
what different in C# from C
c in Procedural programming language and c# is object oriented programming language. C# hase garbage collector managed by CLR (Common language runtime). c supports pointers and c# supports pointers only in unsafe mode. c execute on cross platform but c# required .net core or .net Freamework. total 32 keyword used in c programming and 86 keyword used in c#
What is CLR (common language runtime)
common language runtime is Virtual machine component. it is run time environment in .Net framework. CLR help in run the code and making development process easier and providing various services like thread management, memory management, type safety etc.
what is indexers in c#
indexers is smart array in C#. indexers allows the objects of class to be indexed in the same form as array
what is JIT (Just-in-time) Compiler
just-in-time compiler is a part of CLR (common language runtime). it is responsible for managing the execution regardless program. compiler converts the source code to the intermediate language this intermediate language is converted into machine code by JIT (Just-in-time) compiler
what is garbage collector
garbage collector is responsible for memory management. in .net memory management is automatic with the help of GB (garbage collector). when class object is created runtime certain memory allocated in heap memory after the complete the related action allocated memory is waste and it cannot be used in this case GB (garbage collector) automatically releases the memory space
how many types of classes
mainly four type of classes in .Net Abstract class, Partial Class, Sealed Class, Static class
difference between interface and abstract class
interface use for declaration abstract class contains declaration and definition both. multiple inheritance achieved by the interface but not in abstract class. interface does not contain constructor but abstract class contain constructor. abstract class contain static members but interface not. interface contain only public access modifier but abstract class contain public, private and protected access modifiers. class can use multiple interface but class use only one abstract class. interface contain only methods but abstract class contain field, methods, constants variable, etc.
what is inheritance
inheritance is an important part of object oriented programming. interface is standard where one class is allowed to inherit the another class (methods and fields)
can c# support multiple inheritance?
c# Does not support multiple inheritance. in multiple inheritance one class more then one superclass and all its parent class. to solve this problem we use interface to archive multiple inheritance
managed code in c#
the code write to aim to get the services of the managed runtime environment execution like CLR. managed code always implemented by managed runtime environment instead of directly exe by operating system. managed runtime environment provide service like garbage collection, exception handling, type checking, etc.
difference between a struct and a class
a class is contains fields and methods and structure is a collection of variables of different data type in single unit. both are almost similar
Enum
Enum (Enumeration) is a value data type use for assign name and values constants for program easy to read and maintain. the aim objective of enum is to define own data type enum declared using enum keyword
difference between ref and out
ref keyword use to passing the argument by a reference if we change in argument in the method it will reflect in that variable ref does not pass the property
out keyword use to passing the argument to methods as a reference type. it is use where method returns multiple values
Comments
Post a Comment