Tuesday, May 19, 2009

VB.NET Interview Questions Series 1

Dear Friends
From here on wards I am starting a new Series of Interview Questions and this series will be found on all of my blogs ,

http://learning-mysql.blogspot.com/
http://explore-aspnet.blogspot.com/
http://deepvbnet.blogspot.com/

Hope this may help those who are seeking for new Job,
If any of you found one of my answers as inappropriate I will really appreciate the correct answer and and if any one of you guys are looking for some question which you won't found on blog you can put that on any of Question series Comments area or can always mail me at
1.akashazad@hotmail.com"
2.akashazad@gmail.com"

So here Come the very first Part

VB.NET Interview Questions

Q1. What are the Benifites of using Class Library?

Ans :- Simple ! Why do we have public library? B/c once book is written, many people can subscribe to it and reuse it again & again.

In the same way once you ceate your own class library which have multiple function and procedures they can be published for your own use, or rewriting or performing copying of Code .

Q2. Which is the base class of .NET?

Ans :- System.Object
System is the Name space

Q3. What keyboard Should you use if you don’t want your class to be inherited?

Ans :- For Vb.NET
a. Class NonInheritable
b. Method  Notoverridable
And in C# use sealed

Q4. What is IL?

Ans :- When compiling to managed code, the compiler translates your source code into Microsoft intermediate language (MSIL), which is a CPU-independent set of instructions that can be efficiently converted to native code. MSIL includes instructions for loading, storing, initializing, and calling methods on objects, as well as instructions for arithmetic and logical operations, control flow, direct memory access, exception handling, and other operations. Before code can be run, MSIL must be converted to CPU-specific code, usually by a just-in-time (JIT) compiler. Because the common language runtime supplies one or more JIT compilers for each computer architecture it supports, the same set of MSIL can be JIT-compiled and run on any supported architecture. When a compiler produces MSIL, it also produces metadata. Metadata describes the types in your code, including the definition of each type, the signatures of each type’s members, the members that your code references, and other data that the runtime uses at execution time. The MSIL and metadata are contained in a portable executable (PE) file that is based on and extends the published Microsoft PE and common object file format (COFF) used historically for executable content. This file format, which accommodates MSIL or native code as well as metadata, enables the operating system to recognize common language runtime images. The presence of metadata in the file along with the MSIL enables your code to describe itself, which means that there is no need for type libraries or Interface Definition Language (IDL). The runtime locates and extracts the metadata from the file as needed during execution.


Q 5. Explain the Diff and similarities between a class and a structure in VB.NET?

Ans : Similarity
a. Both are User defined Types.
b. Both are temple of the object.
c. Both contains members like methods, Properties, fields and use Constructor for initialize.
d. Both of them Inherits from System.Object
Differences
a. Classes are Reference Types where as Structures are Value Types.

Q 6. What is implicit Type casting and Explicit Type Casting ?

Ans : Implicit Type Casting allow conversion without any loss of Data and it should be done when there is no possibility of loss of data.
But There is loss of data Explicit type Casting must be done.
Ex:- Implicit Type Casting
Sub Main()
Dim I as integer
Dim J as double
J= 123.12332
I=D
Writeline(“Integer Value of ” &I)
Print (Result)
I = 132
End Sub

Explicit Type Casting
Sub Main()
Dim I as integer
Dim J as double
J= 123.12332
D =CType(D,I)
Writeline(“Integer Value of ” &I)
Print (Result)
I = 132.12332
End Sub

No comments: