mukeshtekwani@hotmail.com Prof. Mukesh N.

Tekwani
1
.NET Technologies Question Bank
Unit 1
1. Explain the features of CLR.

The Common Language Runtime (CLR) forms the base of the .Net technologies. The CLR is
the module that actually runs the VB .NET application. The VB .NET code is compiled into
the CLR’s Intermediate Language (called MSIL – Microsoft Intermediate Language). This is
similar to the byte code generated for Java programs. When we run the application, the IL
code is translated into binary code by compilers built into the CLR. The compiler translates
this IL code into the equivalent machine code.

Benefits (advantages) of CLR:
1. Enhances the performance by implementing the compiled code execution.
2. Supports interoperability of components developed in different languages.
3. Auto Garbage collection feature that controls memory leakage situations by handling the
dump memory locations.
4. Provides extensible framework of class library grouped into different Namespaces.
5. Offers Object Oriented Programming environment by providing the features like
inheritance, interfaces, overloading, multithreading and exception handling.


2. What is .NET Framework class Library?

The .NET Framework class Library is an important part of the .NET Framework. This class
library contains prewritten code that all applications (created through VB .NET, C#, Visual
C++), use. The class library gives your programs the support it needs. For example, an
application that uses forms gets the support for forms handling from the class library. All we
have to do is to declare a new form,


3. What is intermediate language (IL)?

All the .NET languages are compiled into another lower-level language before the code is
executed. This lower language is called the intermediate language (IL). The CLR is the
engine of .NET and uses the IL code. Since all .Net languages are designed based on IL, they
all have many similarities.
Language compilation in .NET is done as shown below:

At run time, the Just-In-Time (JIT) compiler of CLR converts the IL code into native code


Prof. Mukesh N Tekwani mukeshtekwani@hotmail.com
2 .NET Technologies – QB
for the operating system. The Common Language runtime (CLR) provides the features for
cross language integration, security, cross language exception handling, interoperability, and
debugging.

4. What is the managed execution process?

The managed execution process includes the following steps:
1. Choosing a compiler.
To obtain the benefits provided by the common language runtime, you must use one or more
language compilers that target the runtime. The languages that can be used are Visual Basic,
C#, F#, Visual C++.
2. Compiling your code to MSIL.
Compiling translates your source code into Microsoft intermediate language (MSIL) and
generates the required metadata.
3. Compiling MSIL to native code.
At execution time, a just-in-time (JIT) compiler translates the MSIL into native code. During
this compilation, code must pass a verification process that examines the MSIL and metadata
to find out whether the code can be determined to be type safe.
4. Running code.
The common language runtime provides the infrastructure that enables execution to take
place and services that can be used during execution.


5. What is meant by the term cross language interoperability? OR What is meant by
inter-operability? Explain. OR What is cross-language integration?

Cross-language interoperability is the sharing of components of one language with other
languages e.g., sharing C# components with VB .NET. This is possible only doe to the
Common Language Specification (CLS) and the Common Language Runtime (CLR)

6. What are assemblies? What are the benefits of assembly?

Assemblies are the building blocks of .NET Framework applications; they form the
fundamental unit of deployment, reuse, and security permissions.
An assembly is a collection of types and resources that are built to work together and form a
logical unit of functionality. An assembly provides the common language runtime with the
information it needs to be aware of type implementations.
An assembly performs the following functions:
• It contains code that the common language runtime executes. Microsoft intermediate
language (MSIL) code in a portable executable (PE) file will not be executed if it does
not have an associated assembly manifest.
• It forms a security boundary. An assembly is the unit at which permissions are requested
and granted.
• It forms a type boundary. Every type's identity includes the name of the assembly in
which it resides.
• It forms a reference scope boundary. The assembly's manifest contains assembly
metadata that is used for resolving types and satisfying resource requests. It specifies the
types and resources that are exposed outside the assembly.
• It forms a version boundary. The assembly is the smallest versionable unit in the
common language runtime; all types and resources in the same assembly are versioned as


mukeshtekwani@hotmail.com Prof. Mukesh N. Tekwani
3 Chap 3. PL/SQL Security
a unit. The assembly's manifest describes the version dependencies you specify for any
dependent assemblies.
• It forms a deployment unit. When an application starts, only the assemblies that the
application initially calls must be present. Other assemblies, such as localization
resources or assemblies containing utility classes, can be retrieved on demand. This
allows applications to be kept simple and thin when first downloaded.
• It is the unit at which side-by-side execution is supported.

7. What are the main components of .NET Framework? Describe these in brief.

The .NET Framework has two main components:
• common language runtime and
• .NET Framework class library.

The common language runtime is the foundation of the .NET Framework. We can think of
the runtime as an agent that manages code at execution time; it provides core services such as
memory management, thread management, and also enforces strict type safety and other
forms of code accuracy that promote security and robustness. The concept of code
management is a fundamental principle of the runtime. Code that targets the runtime is
known as managed code, while code that does not target the runtime is known as unmanaged
code.

The class library, the other main component of the .NET Framework, is a comprehensive,
object-oriented collection of reusable types that you can use to develop applications ranging
from traditional command-line or graphical user interface (GUI) applications to applications
based on the latest innovations provided by ASP.NET, such as Web Forms and XML Web
services.


8. What is meant my CTS?

The common type system defines how data types are declared, used, and managed in the
runtime. It is an important part of the runtime's support for cross-language integration.

Functions performed by CTS:
The common type system performs the following functions:
• Establishes a framework that helps enable cross-language integration, type safety, and
high performance code execution.
• Provides an object-oriented model that supports the complete implementation of many
programming languages.
• Defines rules that languages must follow, which helps ensure that objects written in
different languages can interact with each other.

The common type system (CTS) supports two general categories of types:
• Value types
Value types directly contain their data, and instances of value types are either allocated on
the stack or allocated inline in a structure. Value types can be built-in (implemented by the
runtime), user-defined, or enumerations. Variables that are value types each have their own
copy of the data, and therefore operations on one variable do not affect other variables.

• Reference types
Reference types store a reference to the value's memory address, and are allocated on the
heap. Reference types can be self-describing types, pointer types, or interface types. The type
of a reference type can be determined from values of self-describing types. Self-describing


Prof. Mukesh N Tekwani mukeshtekwani@hotmail.com
4 .NET Technologies – QB
types are further split into arrays and class types. The class types are user-defined classes,
boxed value types, and delegates. Variables that are reference types can refer to the same
object; therefore, operations on one variable can affect the same object referred to by another
variable.
All types derive from the System. Object base type.

9. What is the difference between value types and reference types in VB .NET? Explain
with an example.

The common type system (CTS) supports two general categories of types:
• Value types
Value types directly contain their data, and instances of value types are either allocated on
the stack or allocated inline in a structure. Value types can be built-in (implemented by the
runtime), user-defined, or enumerations. Variables that are value types each have their own
copy of the data, and therefore operations on one variable do not affect other variables.

• Reference types
Reference types store a reference to the value's memory address, and are allocated on the
heap. Reference types can be self-describing types, pointer types, or interface types. The type
of a reference type can be determined from values of self-describing types. Self-describing
types are further split into arrays and class types. The class types are user-defined classes,
boxed value types, and delegates. Variables that are reference types can refer to the same
object; therefore, operations on one variable can affect the same object referred to by another
variable.

All types derive from the System. Object base type. The following diagram shows how these
various data types are related.



Example:

Imports System

Class Class1
Public Value As Integer = 0
End Class 'Class1

Class Test
Shared Sub Main()
Dim val1 As Integer = 0
Dim val2 As Integer = val1
val2 = 123


mukeshtekwani@hotmail.com Prof. Mukesh N. Tekwani
5 Chap 3. PL/SQL Security
Dim ref1 As New Class1()
Dim ref2 As Class1 = ref1
ref2.Value = 123
Console.WriteLine("Values: {0}, {1}", val1, val2)
Console.WriteLine("Refs: {0}, {1}", ref1.Value,
ref2.Value)
End Sub 'Main
End Class 'Test


Sign up to vote on this title
UsefulNot useful

Master Your Semester with Scribd & The New York Times

Special offer for students: Only $4.99/month.

Master Your Semester with a Special Offer from Scribd & The New York Times

Cancel anytime.