What is ASP.net Programming Part 2

Asp.Net Framework Part 2



7. What is mean by JIT?

Just In Time(JIT) compilers which compile the IL code to native executable code (.exe or .dll) for the specific machine and OS. JIT are slightly different from traditional compilers as they compile the IL to native code only when desired e.g., when a function is called, IL of function's body is converted to native code; just in time of need. If same function is called next time, the CLR uses the same copy of native code without re-compiling. As JIT are aware of processor and OS exactly at runtime, they can optimize the code extremely efficiently resulting in very robust applications.


8. What are different types of JIT?

Pre-JIT - Pre-JIT compiles complete source code into native code in a single compilation cycle. This is done at the time of deployment of the application.
Econo-JIT - Econo-JIT compiles only those functions that are called at runtime. However, these compiled functions are removed when they are not required.
Normal-JIT - Normal-JIT compiles only those functions that are called at runtime and they are stored in cache. If same function is called next time, the CLR uses the same copy of compiled code without re-compiling.


9. What is mean by Assembly?

Assemblies are self-describing installation units, consisting of one or more files. Assemblies are the deployment units of .Net applications. .Net application consists of one or more assemblies. An assembly may also contain references to other assemblies and it include metadata that describes all the types that are defined in the assembly with information about it members-methods, properties, events and fields. One assembly could be a single Dll or exe that includes metadata, or it can be made of different files e.g resource files, modules and an exe.Assembly manifests is a part of the metadata, it describes the assembly with all the information that's needed to reference it and lists all its dependencies.


10. What are the features of Assembly?

·         Assemblies are self-describing; it includes metadata that describes the assembly. It does not required to register key as like COM component.
·         Version dependencies are recorded inside an assembly manifest. The version of the referenced assembly that will be used can be configured by the developer and the system administrator.
·         Two different version of same assembly can be used inside single process.


11. What are different type's assemblies?

Private assembly- Private assembly is used within your application and it is installed at the same time as the application itself. It will be located in the same directory as the application or subdirectories thereof.
Shared assembly- Shared assemblies are used by several applications. Shared assembly must have version number and unique name and it is usually installed in GAC (Global assembly catch). It reduces the need for disk space and memory space.


12. What are parts of assembly manifests?

·         Identity - Name, version, culture and public key
·         A list of files - Files belonging to the assembly, it can have one or more files.
·         Lists of referenced assemblies - all assemblies referenced by the assembly are documented inside the manifest.
·         Set of permission requests- these are the permission needed to run the assembly.
·         Exported types - It describes the structures, class with properties, method and events. It is used to create instance of the class.


13. What is mean by Namespace?

Namespace Logically group classes, it avoids name clashes between classes.
Example: most of the general purpose .net base classes are in a namespace called System. The base class Array is in this namespace is accessed with full name System.Array.


14. What is difference between Assembly and Namespace?

Assembly is physical grouping of classes. Namespace logically groups classes.
Single assembly can have different namespaces
Sample namespace can be used in different assembly. E.g the assembly mscorlib and system contain the namespace System.Threading


15. What is the difference between an executable assembly and a class library?

An executable assembly exists as the .exe file while a class library exists as the .dll file. Executable assembly represent executable applications having some entry (e.g., Main() method in C#). A class library, on the other hand, contains components and libraries to be used inside various applications. A Class library cannot be executed and thus it does not have any entry point.


17. What is mean by Manifest?

Manifest is used to describe the information about the assembly, it contains following information.
·         Assembly name - Aids in versioning and visibility scope.
·         Version information - The version number is integrated into the assembly's identity.
·         Types - Boundaries and scopes of methods, classes, properties, events and attributes.
·         Locale - Information describing language/culture.
·         Reference - provides information for type references in an assembly and other referenced assemblies.
·         Cryptographic Hash - Public key encoded hash acting as version/security check.
·         Security Permissions - The permissions within the assembly determine the permissions that can be granted for all aspects of the assembly contents.


18. How will you created shared assembly?

Shared assembly can be created by signing the assembly. Sets to created shared assembly
·         Create new class library project using visual studio
·         Navigate to the property page of the class library
·         Select "Signing" tab
·         Select "Sign the assembly" check-box
·         Now select < New >... from "Choose a strong name key file" dropdown
·         Enter new Signing key file name and click Ok
·         Next the build the project. Now the shared assembly is ready to use in different project.


19. What is the use of Shared Assembly?

If you want to use the same assembly in different projects, we can create a shared assembly and placed inside the GAC (Global assembly Catch). So that assembly is access by all the application. Private assembly also be used in different projects, but we need to copy the private assembly files to different application folder. But if we are using Shared assembly, the assembly files remains in single location. Shared assembly is highly secured, only administrator can uninstall the shared assembly.


20. What is GAC?

GAC (Global assembly catch) is used to store .Net assembly. It is located in "C:\Windows\assembly"
·         Assembly located in GAC is shared by multiple applications
·         Adding an Assembly to GAC "gacutil -i (assembly_name)", where (assembly_name) is the DLL name of the project.


21. What is mean by Delay signing?

During development process, usually private key will not be exposed to the developer due to security reason. In this kind of scenario, we will go with delay signing. DeLay signing allows you to place a shared assembly in the GAC by signing the assembly with just the public key. This allows the assembly to be signed with the private key at a later stage, when the development process is complete and the component or assembly is ready to be deployed. This process enables developers to work with shared assemblies as if they were strongly named, and it secures the private key of the signature from being accessed at different stages of development.E.g
VB.Net (Assemblyinfo.vb)
<Assembly:AssemblyKeyFileAttribute("myKey.snk")>

 < Assembly: AssemblyDelaySignAttribute(True) >

C#(Assemblyinfo.cs)
[assembly: AssemblyKeyFileAttribute("myKey.snk")]
[assembly: AssemblyDelaySignAttribute(true)]


22. What is mean by Satellite assembly?

When we write a multilingual or multi-cultural application in .NET, and want to distribute the core application separately from the localized modules, the localized assemblies that modify the core application are called satellite assemblies.

23. What is portable executable (PE)?

The file format defining the structure that all executable files (EXE) and Dynamic Link Libraries (DLL) must use to allow them to be loaded and executed by Windows. PE is derived from the Microsoft Common Object File Format (COFF). The EXE and DLL files created using the .NET Framework obey the PE/COFF formats and also add additional header and data sections to the files that are only used by the CLR.


24. What is mean by Garbage collection?

Garbage collection is a CLR features used to automatically manages memory. CLR automatically release the objects which are not longer used or referenced. Developer who forgets to release the dispose the objects will be cleared by GC. But it is not known when GC will be called by CLR to clean the memory. So better we can dispose the objects once it is used.


25. What are the different levels of GC is available?

Generation 0 , Generation 1, Generation 2


26. How Garbage collector will get memory from OS?

When execution engine starts, GC will initialize segment of memory for its operation. GC reserves memory in segment, each segment is 16MB. When we run out of segments we reserve a new segment. If a segment of memory is not in use, it will be deleted.


28. What are situations GC will be called?

  1. If user forcefully calls System.GC.Collect
  2. System is in low memory situation
  3. Memory allocation exceeds the Generation0 threshold

29. What is mean by value type and Reference type?

Value type- Value type stores their value directly to memory address. Value type's values are allocated on the stack memory.
Reference type - Reference type stores the reference to the value's memory address. Reference type values are allocated on head memory.


30. What is mean by Boxing and Unboxing?

Boxing - Converting value type variable to reference type is called as boxing
UnBoxing - Converting reference type variable to value type is called as unboxing
            int vType = 35;
            object rType;
            //Boxing process
            rType = vType;
            //Unboxing process
            vType =(int) rType;



Comments

Popular posts from this blog