Thursday, 12 September 2013

VB.NET General interview questions and answers

VB.NET General interview questions and answers

1.Difference between directcast and ctype.
 DirectCast requires the run-time type of an object variable to bethe same as the specified type.The run-time 
performance ofDirectCast is better than that of CType, if the specified type and the run-time typeof the
expression are the same.
Ctype works fine if there is a valid conversion defined between the expression and the type.
 
2.Explain manifest & metadata.
 Manifest is metadata about assemblies. It describes assembly itself like 
Assembly Name, version number, culture, strong name, list of all files, Type references, and referenced
assemblies.
Metadata is machine-readable information about a resource, or “”data about data.” In .NET, metadata includes
type definitions, version information, external assembly references, and other standardized information.
Metadata describes contents in an assembly classes, interfaces, enums, structs, etc., and their containing
namespaces, the name of each type, its visibility/scope, its base class, the interfaces it implemented, its
methods and their scope, and each method’s parameters, type’s properties, and so on.
 
3.What are the two kinds of properties
 Two types of properties in .Net: Get & Set
 
4.What is a Constructor
 Constructor is a method in the class which has the same name as the class (in VB.Net its New()). It initializes the member attributes whenever an instance of the class is created.
 
5.Describe ways of cleaning up objects
 There is a perfect tool provided by .net frameworks called Garbage collector, where by mean of GC we can clean up the object and reclaim the memory. The namespace used is System.GC.
 
6.Scope of public/private/friend/protected/protected friend.
 Public/public All members in all classes and projects.
Private/private Members of the current class only.
Friend/internal All members in the current project.
Protected/protected All members in the current class and in classes derived from this member’s class. Can be
used only in member definitions, not for class or module definitions. Protected Friend/protected internal All
members in the current project and all members in classes derived from this member’s class. Can be used only in
member definitions, not for class or module definitions.
 
7.what are value types and reference types?
 Value type - bool, byte, chat, decimal, double, enum , float, int, long, sbyte, short, strut, uint, ulong, 
ushort. Value types are stored in the Stack
Reference type - class, delegate, interface, object, string Reference types are stored in the Heap.
 
8.Difference between VB6 and VB.Net
 1. VB.net is object oriented
2. VB.Net can be used in Managed Code
3. It supports inheritance, implements
4. Powerful Exception handling mechanism
5. Have support for the console based applications
6. More than one version of dll is supported
7. Supports the Disconnected data source by using Dataset class
8. Supports threading
 
9.What is Serialization in .NET?
 The serialization is the process of converting the objects into stream of bytes.
they or used for transport the objects(via remoting) and persist objects(via files and databases)
 
10.What is use of System.Diagnostics.Process class?
 By using System.Diagnostics.Process class, we can provide access to the files which are presented in the local 
and remote system.
Example: System.Diagnostics.Process(”c:\mlaks\example.txt”) — local file
System.Diagnostics.Process(”http://www.url.com\example.txt”) — remote file
 
11.what are the authentication methods in .NET?
 1. Windows: Basic, digest or Integrated windows authentication
2. Microsoft passport Authentication
3. Forms Authentication
4. Client Certificate Authentication
 
12.How many languages .NET is supporting now?
 
When .NET was introduced it came with several languages. VB.NET, C#, COBOL and Perl, etc. The site
http://www.dotnetlanguages.net/DNL/Default.aspx says 44 languages are supported
 
13.What is ADO .NET and what is difference between ADO and ADO.NET?
 can treat the ADO.Net as a separate in-memory database where in I can use relationships between the tables and 
select insert and updates to the database. I can update the actual database as a batch.
 
14.type(123.34,integer) - should it throw an error? Why or why not?
 It would work fine. As the runtime type of 123.34 would be double, and Double can be converted to Integer.
 
15.directcast(123.34,integer) - should it throw an error? Why or why not?
 It would throw an InvalidCast exception as the runtime type of 123.34 (double) doesnt match with Integer.