sap4help@gmail.com +91 8956877466
This website is always under updation with new contents
1> WHAT IS CLR ?

ANS> The Common Language Runtime (CLR), the virtual machine component of Microsoft's .NET framework, manages the execution of .NET programs. A process known as just-in-time compilation converts compiled code into machine instructions which the computer's CPU then executes. The CLR provides additional services including memory management, type safety, exception handling, garbage collection, security and thread management. All programs written for the .NET framework, regardless of programming language, are executed by the CLR. All versions of the .NET framework include CLR. CLR implements the Virtual Execution System (VES) as defined in the Common Language Infrastructure (CLI) standard, initially developed by Microsoft itself. A public standard defines the Common Language Infrastructure specification.

2> WHAT IS GARBEG COLLECTION IN C# ?

Ans>The .NET Framework's garbage collector manages the allocation and release of memory for your application. Each time you create a new object, the common language runtime allocates memory for the object from the managed heap. As long as address space is available in the managed heap, the runtime continues to allocate space for new objects. However, memory is not infinite. Eventually the garbage collector must perform a collection in order to free some memory. The garbage collector's optimizing engine determines the best time to perform a collection, based upon the allocations being made. When the garbage collector performs a collection, it checks for objects in the managed heap that are no longer being used by the application and performs the necessary operations to reclaim their memory.

3> WHAT IS DESTRUCTOR ?

ANS> Destructors cannot be defined in structs. They are only used with classes. A class can only have one destructor. Destructors cannot be inherited or overloaded. Destructors cannot be called. They are invoked automatically. A destructor does not take modifiers or have parameters. In general, C# does not require as much memory management as is needed when you develop with a language that does not target a runtime with garbage collection. This is because the .NET Framework garbage collector implicitly manages the allocation and release of memory for your objects. However, when your application encapsulates unmanaged resources such as windows, files, and network connections, you should use destructors to free those resources. When the object is eligible for destruction, the garbage collector runs the Finalize method of the object.

4> WHAT IS FINALIZE METHOD ?

Ans> Implement Finalize only on objects that require finalization. There are performance costs associated with Finalize methods. If you require a Finalize method, consider implementing IDisposable to allow users of your class to avoid the cost of invoking the Finalize method. Do not make the Finalize method more visible. It should be protected, not public. An object's Finalize method should free any external resources that the object owns. Moreover, a Finalize method should release only resources that the object has held onto. The Finalize method should not reference any other objects. Do not directly call a Finalize method on an object other than the object's base class. This is not a valid operation in the C# programming language. Call the base class's Finalize method from an object's Finalize method.

5> WHAT IS ATTRIBUTE ?

ANS>In computing, an attribute is a specification that defines a property of an object, element, or file. It may also refer to or set the specific value for a given instance of such. For clarity, attributes should more correctly be considered metadata. An attribute is frequently and generally a property of a property. However, in actual usage, the term attribute can and is often treated as equivalent to a property depending on the technology being discussed. An attribute of an object usually consists of a name and a value; of an element, a type or class name; of a file, a name and extension. Each named attribute has an associated set of rules called operations: one doesn't sum characters or manipulate and process an integer array as an image object— one doesn't process text as type floating point (decimal numbers). For example, in computer graphics, line objects can have attributes such as thickness (with real values), color (with descriptive values such as brown or green or values defined in a certain color model, such as RGB), dashing attributes, etc. A circle object can be defined in similar attributes plus an origin and radius.

6> WH AT IS MSIL ?

ANS> Common Intermediate Language (CIL, pronounced either "sil" or "kil") (formerly called Microsoft Intermediate Language or MSIL) CIL was originally known as Microsoft Intermediate Language (MSIL) during the beta releases of the .NET languages. Due to standardization of C# and the Common Language Infrastructure, the bytecode is now officially known as CIL.[1] A .NET programming language (C#, VB.NET, J# etc.) does not compile into executable code; instead it compiles into an intermediate code called Microsoft Intermediate Language (MSIL). As a programmer one need not worry about the syntax of MSIL - since our source code in automatically converted to MSIL. The MSIL code is then send to the CLR (Common Language Runtime) that converts the code to machine language, which is, then run on the host machine. MSIL is similar to Java Byte code. MSIL is the CPU-independent instruction set into which .NET Framework programs are compiled. It contains instructions for loading, storing, initializing, and calling methods on objects. Combined with metadata and the common type system, MSIL allows for true cross- language integration Prior to execution, MSIL is converted to machine code. It is not interpreted.

7> EXPLAIN METADATA IN C# ?

ANS> Metadata, in the Common Language Infrastructure (CLI), refers to certain data structures embedded within the Common Intermediate Language (CIL) code that describes the high-level structure of the code. Metadata describes all classes and class members that are defined in the assembly, and the classes and class members that the current assembly will call from another assembly. The metadata for a method contains the complete description of the method, including the class (and the assembly that contains the class), the return type and all of the method parameters. A CLI language compiler will generate the metadata and store this in the assembly containing the CIL. When the run-time executes CIL it will check to make sure that the metadata of the called method is the same as the metadata that is stored in the calling method. This ensures that a method can only be called with exactly the right number of parameters and exactly the right parameter types. The Windows Runtime application platform, present in Windows 8 and Windows Phone 8, makes use of the CLI metadata format to describe component interfaces for code written in any of the supported programming languages. A difference in use within the Common Language Runtime is that an assembly typically does not contain any CI

8> WHAT IS POINTER IN ARRAY?

ANS> C# also supports pointers in a limited extent. A pointer is nothing but a variable that holds the memory address of another type. But in C# pointer can only be declared to hold the memory address of value types and arrays. Unlike reference types, pointer types are not tracked by the default garbage collection mechanism. For the same reason pointers are not allowed to point to a reference type or even to a structure type which contains a reference type. We can say that pointers can point to only unmanaged types which includes all basic data types, enum types, other pointer types and structs which contain only unmanaged types.

9> WHAT IS DYANAMIC MEMORY ALLOCATION ?

ANS> Except for the stackalloc operator, C# provides no predefined constructs for managing non-garbage collected memory. Such services are typically provided by supporting class libraries or imported directly from the underlying operating system. For example, the Memory class below illustrates how the heap functions of an underlying operating system might be accessed from C#: In .NET, memory is allocated by the CLR as and when required. If there is insufficient memory remaining on the heap to store a new object, then a garbage collection automatically takes place to free up memory that is no longer required by the process. Consequently, there is no need for you to manage memory yourself such as in C or (unmanaged) C++. It is possible to allocate 'unmanaged' memory yourself (for interop purposes) using methods of the System.Runtime.InteropServices.Marshal class such as AllocHGlobal():

10> what is difference between early binding and late binding in c# ? What is an Early Binding?

Ans> Methods, Functions and properties which are detected and checked during compile time or during compilation is called as early binding. In Early binding objects are basically a strong type objects or static type objects. An object is early bounded only when it is been assigned to a specific type (strong type). If something goes wrong while coding or before an execution of an application the visual studio intellisense automatically shows a compile time error with error line number and .NET Intellisense automatically populates declared objects methods and properties on click of the dot operator. Now in the further upcoming of an article we will see the real-time demonstration of an early binding using an example. Late Binding The name itself describes that compiler does not know what kind of object it is, what are all the methods and properties it contains. You have to declare it as an object, later you need get the type of the object, methods that are stored in it. Everything will be known at the run time. Minimal Impact of code in future enhancements, if Late Binding is used.

11> what is static array and dynamic array ?

Ans> Static array. An array can be static. It can store values that are not specific to instances of classes in the C# language. This pattern is commonly used in C# programs and often useful. We examine some example code. Example. To start, we use a static integer array. The data shown is separate from the state of the object. The list of prime numbers is not affected by state. The array contains the first five Wagstaff prime numbers. In computer science, a dynamic array, growable array, resizable array, dynamic table, mutable array, or array list is a random access, variable-size list data structure that allows elements to be added or removed. It is supplied with standard libraries in many modern mainstream programming languages. A dynamic array is not the same thing as a dynamically allocated array, which is an array whose size is fixed when the array is allocated, although a dynamic array may use such a fixed-size array as a back end.[1]

12> what is copy constructor ?

Ans> C# does not provide a copy constructor. A copy constructor enables you to copy the data stored in the member variables of an object of the class into another object. In simple words a copy constructor means a constructor which copies data of one object into another object, Above the class "Car" has two types of constructor. The first constructor is an Instance Constructor of a class with three input parameters and second is a copy constructor with input parameter of a class object. When we assign some input values to class properties using instance constructor then with the use of copy constructor we can create copy of data stored in an object to another new object as shown below code snippet. A copy constructor is a constructor that you can define which initializes an instance of a class based on a different instance of the same class. If a base class includes a copy constructor, you can add a copy constructor to a derived class, from which you call the copy constructor of the base class.

14> what is unsafe code ?

Ans> C# allows using pointer variables in a function of code block when it is marked by theunsafe modifier. The unsafe code or the unmanaged code is a code block that uses apointer variable. Note: To execute the programs mentioned in this chapter atcodingground, please set compilation option in Project >> Compile Options >> Compilation Command to mcs *.cs -out:main.exe -unsafe"
Pointers A pointer is a variable whose value is the address of another variable i.e., the direct address of the memory location. similar to any variable or constant, you must declare a pointer before you can use it to store any variable address.

15> What are the use of inheritance and interface ?

Ans>inheritance is achieved when a class is derived from another class in such a way that it inherits all its members. Interface inheritance is when a class inherits only the signatures of the functions from another class.

16> What is exception in .Net ?

Ans>Exceptions are errors that occur during the runtime of a program. The advantage of using exceptions is that the program doesn’t terminate due to the occurrence of the exception. Whenever an exception is occurred the .NET runtime throws an object of specified type of Exception.

17> What is an event ?

Ans> When an action is performed, this action is noticed by the computer application based on which the output is displayed. These actions are called events. Examples of events are pressing of the keys on the keyboard, clicking of the mouse. Likewise, there are a number of events which capture your actions.

18> What is polymorphism in c# ?

Ans>Polymorphism means many forms (ability to take more than one form). In Polymorphism poly means “multiple” and morph means “forms” so polymorphism means many forms. In polymorphism we will declare methods with same name and different parameters in same class or methods with same name and same parameters in different classes. Polymorphism has ability to provide different implementation of methods that are implemented with same name.

19> What is c# ?

Ans> c# is a object oriented programming language developed by Microsoft. It will immediately be familiar to C and C++ programmers. C# combines the high productivity of Rapid Application Development (RAD) languages.

20> What is the concept of object oriented programming language ?

Ans> objects Classes Data abstraction and encapsulation Inheritance Polymorphism Dynamic Binding Massege Passing

21> What are the modifiers in c# ?

Ans>abstract Sealed Virtual Const Event Extern Override Readonly Static New

22> What are the access modifiers in c# ?

Ans>There are five access modifiers in c# . Public Private Protected Internal Internal protect

23> What are the characteristic of c# ?

Ans> Simple, Type safe , Flexibale , Object Oriented, Compatible , Consistent , modern.

24> Types of constructor ?

Ans> Default Constructor Parameterize Constructor Copy Constructor Private Constructor Static Constructor

25> What is static classes ?

Ans>A static class is basically the same as a non-static class, but there is one difference: you cannot use the new keyword to create a variable of the class type. Because there is no instance variable, you access the members of a static class by using the class name itself.

26> What is the main use of Event and Delegates ?

Ans> An event is an action like massege sent by the control to notifye the occurrence of action. However it is not known which object receives the event. For this reason, .NET provides a special type called Delegate which acts as an intermediary between the sender object and receiver object.

27> What is the use of using statement in c# ?

Ans>The "using" statement provides convenient syntax that ensures the correct use of IDisposable objects. Within the using block, the object is read-only and cannot be modified or reassigned.

28> Where validation is occure server side or client side ?

Ans>client side.

29> How does c# different from c++ ?

Ans>C# doesn't support multiple inheritances while C++ does. Casting is Safer in C# than C++. C# doesn’t require semicolon on completion of class definition while C++ use. In C#, Command line parameter acts differently as compared to C++.

30> What is custom control ?

Ans> A Custom control inherits from System.Windows.Controls.Control class. They are compiled code faster to use, difficult to develop, and can be placed in toolbox. Custom controls can be reused on multiple places easily. Provide more flexibility in extending the control’s behavior. Custom controls can be used just by drag and drop into the form.

31> What are value types in c#?

Ans> decimal, int, byte, enum, double, long, Float

32>What are reference type in c# ?

Ans> class, string, interface, Object

33> What are the types of exception in c# ?

Ans>NullReferenceException, ArgumentNullException, DivideByZeroException, IndexOutOfRangeException, InvalidOperationException, StackOverflowException etc.

34> Explain Generics in c# ?

Ans>Generics in c# is used to make the code reusable and which intern decreases the code redundancy and increases the performance and type safety. Namespace – “System.Collections.Generic” is available in C# and this should be used over “System.Collections” types.

35> What is attribute in c# ?

Ans>Attributes are used to convey the info for runtime about the behavior of elements like – “methods”, “classes”, “enums” etc. Attributes can be used to add metadata like – comments, classes, compiler instruction etc.

36>What is the use of Dispose() in c#.net?

Ans>Dispose() is called to indicate for an object to release any unmanaged resources.

37>What is MSIL code?

Ans>When we compile our .Net Program using any .Net compliant language like (C#, VB.NET, C++.NET) it does not get converted into the executable binary code but to an intermediate code, called MSIL or IL in short, understandable by CLR. MSIL is an OS and H/w independent code. When the program needs to be executed, this MSIL or intermediate code is converted to binary executable code, called native code. The presence of IL makes it possible the Cross Language Relationship as all the .Net compliant languages produce the similar standard IL code.

38>What is framework class library?

Ans> .NET Framework provides huge set of Framework (or Base) Class Library (FCL) for common, usual tasks. FCL contains thousands of classes to provide the access to Windows API and common functions like String Manipulation, Common Data Structures, IO, Streams, Threads, Security, Network Programming, Windows Programming, Web Programming, Data Access, etc. It is simply the largest standard library ever shipped with any development environment or programming language. The best part of this library is they follow extremely efficient OO design (design patterns) making their access and use very simple and predictable. You can use the classes in FCL in your program just as you use any other class and can even apply inheritance and polymorphism on these.

39>What is garbage collector?

Ans> CLR also contains Garbage Collector (GC) which runs in a low-priority thread and checks for un-referenced dynamically allocated memory space. If it finds some data that is no more referenced by any variable/reference, it re-claims it and returns the occupied memory back to the Operating System; so that it can be used by other programs as necessary.

40> What is serialization?

Ans> Serialization is the process of converting an object into a stream of bytes. Deserialization is the opposite process of creating an object from a stream of bytes.

41> What are assemblies?

Ans> Assemblie is a compiled output of a program which are used for easy deployment of an application. They are executable in the form of exe or dll.it is also a collection of resources that were used while building the application.

42> What are the types of assemblies?

Ans>Private assemblies: it is accessible by single application.they resides within a application folder by unique nqame. Shared assemblies: it is shared by multiple application to ensure reusability. Satelite assemblies: these assemblies provide the support for multiple language based culture.

43> What is an array?

Ans> Array is a collection of finite order of homogenious data element. Finite order means it store fixed size of data in one by one, homogenious means array store one type of data item that you have decleard.

44> What is jagged array?

Ans>The array which has elements of type array is called jagged array. The elements can be of different dimensions and sizes. We can also call jagged array as Array of arrays. For ex> in a theater there is fixed number of rows but column vary according to arriving customer.

45> What is method overloading?

Ans>Method overloading is creating multiple methods with the same name with unique signatures in the same class. When we compile, the compiler uses overload resolution to determine the specific method to be invoke.

46> What is the difference between array and arraylist?

Ans>In an array, we can have items of the same type only. The size of the array is fixed. An arraylist is similar to an array but it doesn't have a fixed size.

47>What is indexer in c#?

Ans>Indexer allows classes to be used in more intuitive manner. C# introduces a new concept known as Indexers which are used for treating an object as an array. The indexers are usually known as smart arrays in C#. it allows you to access a member variable of a class using the features of an array.

48>What is reflection?

Ans>Reflection is the ability to find the information about types contained in assemblie at runtime.

49> What is preprocessor in c#?

Ans>The preprocessor gives an instruction to compiler to preprocess the information before compilation starts . all preprocessor directives starts with # preprocessor directive does not ends with ;.

50> What is namespace in c#?

Ans> They are used to provide information to the c# compiler a context for the named information in your program like variable name. without namespace you cant do .

For accessing computer programs go to TECHNOLOGY