02.07.2013 Views

.NET Interview Questions 4 th Edition By Shivprasad ... - A2Z Dotnet

.NET Interview Questions 4 th Edition By Shivprasad ... - A2Z Dotnet

.NET Interview Questions 4 th Edition By Shivprasad ... - A2Z Dotnet

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

(A) What are different types of JIT?<br />

JIT compiler is a part of <strong>th</strong>e runtime execution environment.<br />

In Microsoft .<strong>NET</strong> <strong>th</strong>ere are <strong>th</strong>ree types of JIT compilers:<br />

• Pre-JIT: - Pre-JIT compiles complete source code into native code in a single<br />

compilation cycle. This is done at <strong>th</strong>e time of deployment of <strong>th</strong>e application.<br />

• Econo-JIT: - Econo-JIT compiles only <strong>th</strong>ose me<strong>th</strong>ods <strong>th</strong>at are called at runtime.<br />

However, <strong>th</strong>ese compiled me<strong>th</strong>ods are removed when <strong>th</strong>ey are not required.<br />

• Normal-JIT: - Normal-JIT compiles only <strong>th</strong>ose me<strong>th</strong>ods <strong>th</strong>at are called at runtime.<br />

These me<strong>th</strong>ods are compiled <strong>th</strong>e first time <strong>th</strong>ey are called, and <strong>th</strong>en <strong>th</strong>ey are stored in<br />

cache. When <strong>th</strong>e same me<strong>th</strong>ods are called again, <strong>th</strong>e compiled code from cache is used<br />

for execution.<br />

(B) What are Value types and Reference types?<br />

Value types directly contain <strong>th</strong>eir data <strong>th</strong>at are ei<strong>th</strong>er allocated on <strong>th</strong>e stack or allocated in-line in<br />

a structure. So value types are actual data.<br />

Reference types store a reference to <strong>th</strong>e value's memory address, and are allocated on <strong>th</strong>e heap.<br />

Reference types can be self-describing types, pointer types, or interface types. You can view<br />

reference type as pointers to actual data.<br />

Variables <strong>th</strong>at are value types each have <strong>th</strong>eir own copy of <strong>th</strong>e data, and <strong>th</strong>erefore operations on<br />

one variable do not affect o<strong>th</strong>er variables. Variables <strong>th</strong>at are reference types can refer to <strong>th</strong>e same<br />

object; <strong>th</strong>erefore, operations on one variable can affect <strong>th</strong>e same object referred to by ano<strong>th</strong>er<br />

variable. All types derive from <strong>th</strong>e System. Object base type.<br />

(B) What is concept of Boxing and Unboxing ?<br />

Boxing and unboxing act like bridges between value type and reference types. When we convert<br />

value type to a reference type it’s termed as boxing. Unboxing is just vice-versa. When an object<br />

box is cast back to its original value type, <strong>th</strong>e value is copied out of <strong>th</strong>e box and into <strong>th</strong>e<br />

appropriate storage location.<br />

Below is sample code of boxing and unboxing where integer data type are converted in to object<br />

and <strong>th</strong>en vice versa.<br />

int i = 1;<br />

object obj = i; // boxing<br />

int j = (int) obj; // unboxing<br />

(B) What is <strong>th</strong>e difference between VB.<strong>NET</strong> and C#?<br />

Well <strong>th</strong>is is <strong>th</strong>e most debatable issue in .<strong>NET</strong> community and people treat languages like religion.<br />

It is a subjective matter which language is best. Some like VB.<strong>NET</strong>’s natural style and some like<br />

professional and terse C# syntaxes. Bo<strong>th</strong> use <strong>th</strong>e same framework and speed is very much<br />

equivalents. Still let us list down some major differences between <strong>th</strong>em:-<br />

Advantages VB.<strong>NET</strong>:-<br />

• Has support for optional parameters <strong>th</strong>at makes COM interoperability much easy.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!