Languages [TCS Placement]: Sample Questions 54 - 55 of 131

Get unlimited access to the best preparation resource for competitive exams : get questions, notes, tests, video lectures and more- for all subjects of your exam.

Question 54

Edit

Describe in Detail

Essay▾

Describe the roles of CLR in . NET Framework.

Explanation

CLR is common runtime environment for all . NET code irrespective of their programming language.

CLR provides an environment to execute . NET applications on target machines. It performs the following:

  • Automatic memory management:
    • Calls predefined functions of . NET framework to allocate and de-allocate memory of . NET objects.
    • Garbage Collection:
    • GC is used to prevent memory leaks or holes. Garbage collector of CLR automatically determines the best time to free the memory of an object.
    • Code Access Security:
    • CLR allows access to code to perform only those tasks for which it has permission. It also checks user՚s permissions after authentication and configuration files of . NET applications.
    • JIT compilation of . NET code:
  • JIT compiler converts MSIL code to targeted machine code for execution.

Question 55

Languages
Edit

Describe in Detail

Essay▾

What is the role of the JIT compiler in . NET Framework?

Explanation

  • The JIT compiler is an important element of CLR, which loads MSIL on target machines for execution.
  • MSIL is stored in . NET assemblies after the developer has compiled the code written in any . NET-compliant programming language, such as Visual Basic and C#.
  • JIT compiler translates the MSIL code to CPU architecture of the target machine to execute a . NET application.
  • It also stores the resulting native code so that it is accessible for subsequent calls.
  • If a code executing on a target machine calls a non-native method, the JIT compiler converts the MSIL of that method into native code.
  • JIT compiler also enforces type-safety in runtime environment of . NET Framework- checks values that are passed to parameters of any method. For example, JIT compiler detects if a user tries to assign a 32-bit value to a parameter that can only accept 8-bit value.
Given the Image is Define the JIT Compiler

Developed by: