Languages-Java [TCS Placement]: Sample Questions 1 - 2 of 2

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 1

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

Question 2

Edit

Describe in Detail

Essay▾

How do you instantiate a complex number?

Explanation

Different ways to assign a value to a complex number are:

  • By passing two Double values to its constructor- first value represents the real, and the second value represents imaginary part.
    • For Example: Complex c1 = new Complex (5,8) ; / ⚹ It represents (5,8) ⚹ /
    • By assigning a Byte, SByte, Intl6, UIntl6, Int32, UInt32, Int64, UInt64, Single, or Double value to a Complex object.
    • The assigned value represents real part, and imaginary part becomes 0.
    • For Example: Complex c2 = 15.8; / ⚹ It represents (15.8,0) ⚹ /
    • By casting a Decimal or BigInteger value to a Complex object.
    • For example, Complex c3 = (Complex) 12.8; / ⚹ It represents (12.8,0) ⚹ /
    • Assigning the value returned by an operator to a Complex variable.
  • For example, Complex c4c1 + c2; / ⚹ It represents (20.8,8) ⚹ /

Developed by: