vb interview questions and answers

Upload: sanhith-chowdary

Post on 14-Apr-2018

218 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/30/2019 VB Interview Questions and answers

    1/17

    What is

    VB.NET

    ?

    VB.Net is a windows based programming language.It supports oops concept.

    2. What is the base class of .net?

    System.Object

    3. What is Difference between Namespace and Assembly?

    Namespace is a collection of different classes. whereas an assembly is the basic

    building blocks of the .net framework.

    4. What is the difference between early binding and late binding?

    Calling a non-virtual method, decided at a compile time is known as early binding.

    Calling a virtual method (Pure Polymorphism), decided at a runtime is known as late

    binding.

    5. What is Intermediate Langauge?

    Microsoft Intermediate Language(MSIL or IL) is the CPU -independent instruction set

    into which .Net framework programs are compiled. It contains instructions for

    loading, storing initializing, and calling methods on objects.

    6. What is Commom Language Runtime?

    CLR also known as Common Language Run time provides a environment in which

    program are executed, it activate object, perform security check on them, lay them

    out in the memory, execute them and garbage collect them.

    7. What is Common Type System?

    The common type system is a rich type system, built into the common language

    runtime, which supports the types and operations found in most programming

    languages.

    8. What is Common Language Specification?

    The Common Language Specification is a set of constructs and constraints that

    serves as a guide for library writers and compiler writers.

    Whats

    the

  • 7/30/2019 VB Interview Questions and answers

    2/17

    difference

    between

    private

    and

    shared

    assembly

    ?

    Private assembly is used inside an application only and does not have to be

    identified by a strong name.

    Shared assembly can be used by multiple applications and has to have a

    strong name.

    10. What namespace does the Web page belong in the .NET Framework class

    hierarchy?

    System.Web.UI.Page

    11. What is an Assembly?

    Assembly are the basic buiding blocks of the .net framework.They are the logical

    grouping of the functionality in a physical file.

    12. What are the advantages of an assembly?

    Increased performance. Better code management and encapsulation. It also

    introduces the n-tier concepts and business logic.

    13. What is Code Access Security?

    CAS - Code Access Security is the part of the .NET security model that determines

    whether or not a piece of code is allowed to run, and what resources it can use when

    it is running.

    14. What are the difference between Structure and Class?

    Structures are value type and Classes are reference type

    Structures can not have constructors or destructors.

    Classes can have both constructors and destructors.

    Structures do not support Inheritance, while Classes support Inheritance.

    15. What is the differences between dataset.clone and dataset.copy?

    Dataset.clone copies just the structure of dataset (including all the datatables,

    schemas, relations and constraints.); however it doesnt copy the data.Dataset.copy, copies both the dataset structure and the data.

  • 7/30/2019 VB Interview Questions and answers

    3/17

    16. What is the use of Internal keyword?

    Internal keyword is one of the access specifier available in .Net framework , that

    makes a type visible in a given assembly , for e.g : a single dll can contain multiple

    modules.

    What is

    the

    differenc

    e

    between

    the

    Debug

    class and

    Trace

    class?

    Use Debug class for debug builds, use Trace class for both debug and release

    builds.

    18. What are class access modifiers?

    Access modifiers are keywords used to specify the declared accessibility of a member

    or a type. This section introduces the four access modifiers :

    Public

    Protected

    Internal

    Protected inertnal

    Private

    19. What is portable executable?

    The file format used for executable programs and for files to be linked together to

    form executable programs.

    20. What is the difference between System.String and System.StringBuilder

    classes?

    System.String is immutable, System.StringBuilder was designed with the purpose of

    having a mutable string where a variety of operations can be performed.

  • 7/30/2019 VB Interview Questions and answers

    4/17

    21. What is tracing?

    Tracing refers to collecting information about the application while it is running. You

    use tracing information to troubleshoot an application.

    22. What is the difference between a Thread and a Process?

    A Process is an instance of an running application. And a thread is the Execution

    stream of the Process. A process can have multiple Thread.

    23. What is serialization?

    Serialization is the process of converting an object into a stream of bytes.

    De-serialization is the opposite process of creating an object from a stream of bytes.

    Serialization/De-serialization is mostly used to transport objects.

    24. How a base class method is hidden?

    Hiding a base class method by declaring a method in derived class with keyword

    new. This will override the base class method and old method will be suppressed.

    What is a

    Constructor

    ?

    A special Method Always called whenever an instance of the class is

    created.

    26. What is Polymorphism?

    Mean by more than one form. Ability to provide different implementation based on

    different number / type of parameters.

    27. What is an Interface?

    An interface has no implementation; it only has the signature or in other words, just

    the definition of the methods without the body.

    28. What is the difference between an EXE and a DLL?

    Dll is an In-Process Component whereas EXE is an OUt-Process Component.Exe is for

    single use whereas you can use Dll for multiple use.

    Exe can be started as standalone where dll cannot be.

    29. What is the GAC?

    Each computer where the common language runtime is installed has a machine-wide

    code cache called the global assembly cache. The global assembly cache stores

  • 7/30/2019 VB Interview Questions and answers

    5/17

    assemblies that are to be shared by several applications on the computer. This area

    is typically the folder under windows or winnt in the machine.

    30. How does CAS work?

    The CAS security policy revolves around two key concepts - code groups and

    permissions. Each .NET assembly is a member of a particular code group, and each

    code group is granted the permissions specified in a named permission set.

    31. What is difference between MetaData and Manifest?

    Metadata and Manifest forms an integral part of an assembly( dll / exe ) in .net

    framework . Out of which Metadata is a mandatory component , which as the name

    suggests gives the details about various components of IL code viz : Methods ,

    properties , fields , class etc.

    32. What is the top .NET class that everything is derived from?

    System.Object

    How is

    method

    overriding

    different

    from

    method

    overloading

    ?

    When overriding a method, you change the behavior of the method for the

    derived class. Overloading a method simply involves having another

    method with the same name within the class.

    34. What is a formatter?

    A formatter is an object that is responsible for encoding and serializing data into

    messages on one end, and deserializing and decoding messages into data on the

    other end.

    35. What is an ArrayList?

    The ArrayList object is a collection of items containing a single data type values.

  • 7/30/2019 VB Interview Questions and answers

    6/17

    36. What is static member?

    The member defined as static which can be invoked directly from the class level,

    rather than from its instance.

    37. What is Overloading?

    A process of creating different implementation of a method having a same name as

    base class, in a derived class. It implements Inheritance.

    38. When do you use virutal keyword?

    When we need to override a method of the base class in the sub class, then we give

    the virtual keyword in the base class method. This makes the method in the base

    class to be overridable. Methods, properties, and indexers can be virtual, which

    means that their implementation can be overridden in derived classes.

    39. What is the purpose of XML Namespaces?

    An XML Namespace is a collection of element types and attribute names. It consists

    of 2 parts

    The first part is the URI used to identify the namespace

    The second part is the element type or attribute name itself.

    40. What is a constructor?

    A constructor is invoked when you use the new operator, or use the various methods

    of reflection to create an instance of a class.

    What is the

    difference between

    System.String and

    System.StringBuilde

    r classes?

    System.String is immutable, System.StringBuilder was designed

    with the purpose of having a mutable string where a variety of

    operations can be performed.

    42. What is the use of JIT ?

    JIT (Just - In - Time) is a compiler which converts MSIL code to Native Code (ie.

    CPU-specific code that runs on the same computer architecture).

    43. What is the difference between early binding and late binding?

  • 7/30/2019 VB Interview Questions and answers

    7/17

    Calling a non-virtual method, decided at a compile time is known as early binding.

    Calling a virtual method (Pure Polymorphism), decided at a runtime is known as late

    binding.

    44. Which method do you invoke on the DataAdapter control to load your

    generated dataset with data?

    DataAdapters fill () method is used to fill load the data in dataset.

    45. What is the purpose of an Assembly?

    An assembly controls many aspects of an application. The assembly handles

    versioning, type and class scope, security permissions, as well as other metadata

    including references to other assemblies and resources. The rules described in an

    assembly are enforced at runtime.

    46. What is Authentication and Authorization?

    Authentication is the process of identifying users. Authentication is

    identifying/validating the user against the credentials (username and password).

    Authorization performs after authentication. Authorization is the process of

    granting access to those users based on identity. Authorization allowing access of

    specific resource to user.

    47. What are the types of Authentication?

    There are 3 types of Authentication.

    Windows authentication

    Forms authentication

    Passport authentication.

    48 What is a Literal Control?

    The Literal control is used to display text on a page. The text is programmable.This control does not let you apply styles to its content.

    What are the namespace available in

    .net?

    Namespace is a logical grouping of class.

    System

    System.Data

    System.IO

  • 7/30/2019 VB Interview Questions and answers

    8/17

    System.DrawingSystem.Windows.Forms

    System.Threading

    50. What is Side-by-Side Execution?

    The CLR allows any versions of the same-shared DLL (shared assembly) to execute

    at the same time, on the same system, and even in the same process. This concept

    is known as side-by-side execution.

    51. What are the different types of Caching?

    There are three types of Caching :

    Output Caching

    Fragment Caching

    Data Caching.

    52. What is Reference type and value type?

    Reference Type : Reference types are allocated on the managed CLR heap, just like

    object types. A data type that is stored as a reference to the values location.

    Reference types can be self-describing types, pointer types, or interface types.

    Value Type : Value types are allocated on the stack just like primitive types in

    VBScript, VB6 and C/C++. Value types are not instantiated using new go out of

    scope when the function they are defined within returns.

    53. What is Delegates?

    Delegates are a type-safe, object-oriented implementation of function pointers and

    are used in many situations where a component needs to call back to the component

    that is using it.

    54. What is Authentication and Authorization?

    Authentication is the process of identifying users. Authentication is

    identifying/validating the user against the credentials (username and password).

    Authorization performs after authentication. Authorization is the process of

    granting access to those users based on identity. Authorization allowing access of

    specific resource to user.

    55. What is a Static class?

    Static class is a class which can be used or accessed without creating an instance of

  • 7/30/2019 VB Interview Questions and answers

    9/17

    the class.

    56 What is sealed class?

    Sealed classes are those classes which can not be inherited and thus any sealed class

    member can not be derived in any other class. A sealed class cannot also be an

    abstract class.

    What are

    the two

    main parts

    of the .NET

    Framework?

    There are the two main parts of the .NET Framework are :

    The common language runtime (CLR).

    The .NET Framework class library.

    58. What is the advantage of using System.Text.StringBuilder over

    System.String?

    StringBuilder is more efficient in cases where there is a large amount of string

    manipulation. Strings are immutable, so each time it's being operated on, a new

    instance is created.

    59. What is reflection?

    All .NET compilers produce metadata about the types defined in the modules they

    produce. This metadata is packaged along with the module (modules in turn are

    packaged together in assemblies), and can be accessed by a mechanism called

    reflection.

    60. What is an Application Domain? How they get created?

    An Application Domain can be thought of as a lightweight processes controlled by the

    .Net runtime. Application Domains are usually created by hosts like Windows Shell,

    ASP.NET and IE. When you run a .NET application from the command-line, the host

    is the Shell. The Shell creates a new Application Domain for every application.

    61. What is the difference between Compiler and Interpreter?

    Compiler :

  • 7/30/2019 VB Interview Questions and answers

    10/17

    A compiler is a program that translates program (called source code) written in some

    high level language into object code.

    Interpreter:

    An interpreter translates high-level instructions into an intermediate form, which it

    then executes. Interpreter analyzes and executes each line of source code in

    succession, without looking at the entire program; the advantage of interpreters is

    that they can execute a program immediately. .

    62. What is a class?

    Class is concrete representation of an entity. It represents a group of objects, which

    hold similar attributes and behavior. It provides abstraction and encapsulations.

    63. What is an Object?

    Object represents/resembles a Physical/real entity. An object is simply something

    you can give a name.

    64 What is Abstraction?

    Hiding the complexity. It is a process of defining communication interface for the

    functionality and hiding rest of the things.

    Howdo you

    conver

    t a

    string

    into an

    integer

    in

    .NET?

    Int32.Parse(string)

    Convert.ToInt32()

    66. Describe the compilation process for .NET code?

    Source code is compiled and run in the .NET Framework using a two-stage process.

    First, source code is compiled to Microsoft intermediate language (MSIL) code using a

    .NET Framework-compatible compiler, such as that for Visual Basic .NET or Visual

    C#. Second, MSIL code is compiled to native code.

    67. What Is Boxing And Unboxing?

  • 7/30/2019 VB Interview Questions and answers

    11/17

    Boxing :

    Boxing is an implicit conversion of a value type to the reference type.

    Examples : Stuct Type, Enumeration Type

    UnBoxing :

    Unboxing is an explicit conversion from the reference to a value type.

    Examples : Class , Interface.

    68. How do you create threading in .NET? What is the namespace for that?

    System.Threading.Thread

    69. What is Method overloading?

    Method overloading occurs when a class contains two methods with the same name,

    but different signatures.

    70. What is Method Overriding?

    An override method provides a new implementation of a member inherited from a

    base class. The method overridden by an override declaration is known as the

    overridden base method.

    71. What is difference between inline and code behind?

    Inline code written along side the html in a page. Code-behind is code written in a

    separate file and referenced by the .aspx page.

    72. What is an abstract class?

    An abstract class is a class that must be inherited and have

    the methods overridden. An abstract class is essentially a

    blueprint for a class without any implementation.

    What is the difference between datagrid and

    gridview?

    Datagrid is used in windows

    application and gridview is

    used in web and in datagrid

    we cannot write the code for

    datagrid properties where as

    for grid view we can write

    the code like template

    column item template etc

    this will not be done in

    datagrid.

  • 7/30/2019 VB Interview Questions and answers

    12/17

    74. What is the use of System.Diagnostics.Process class?

    The System.Diagnostics namespace provides the interfaces, classes, enumerations

    and structures that are used for tracing.

    The System.Diagnostics namespace provides two classes named Trace and Debugthat are used for writing errors and application execution information in logs.

    75. What is the difference between static or dynamic assemblies?

    Assemblies can be static or dynamic.

    Static assemblies :

    can include .NET Framework types (interfaces and classes), as well as resources for

    the assembly (bitmaps, JPEG files, resource files, and so on).Staticassemblies are

    stored on disk in portable executable (PE) files.

    Dynamic assemblies :

    which are run directly from memory and are not saved to disk before execution. You

    can save dynamic assemblies to disk after they have executed.

    76. What are the difference between Structure and Class?

    Structures are value type and Classes are reference type.

    Structures can not have contractors or destructors. Classes can have both

    contractors and destructors.

    Structures do not support Inheritance, while Classes support Inheritance

    77. What is difference between Class And Interface?

    Class : is logical representation of object. It is collection of data and related sub

    procedures with defination.

    Interface : is also a class containg methods which is not having any

    definations.Class does not support multiple inheritance. But interface can support.

    78. What is the use of ErrorProvider Control?

    The ErrorProvider control is used to indicate invalid data on a data entry form.

    79. How many languages .NET is supporting now?

    When .NET was introduced it came with several languages. VB.NET, C#, COBOL and

    Perl, etc. 44 languages are supported.

    80. How many .NET languages can a single .NET DLL contain?

    Many.

    What ismetadata?

  • 7/30/2019 VB Interview Questions and answers

    13/17

    Metadata means data about the data i.e., machine-readable

    information about a resource, . Such information might include

    details on content, format, size, or other characteristics of a data

    source. In .NET, metadata includes type definitions, version

    information, external assembly references, and other standardized

    information.

    82. What is the difference between Custom Control and User Control?

    Custom Controls are compiled code (Dlls), easier to use, difficult to create, and can

    be placed in toolbox. Drag and Drop controls. Attributes can be set visually at design

    time.

    AUser Control is shared among the single application files.

    83. What keyword is used to accept a variable number of parameter in a

    method?

    params keyword is used as to accept variable number of parameters.

    84. What are different types of JIT ?

    There are three types of jit :

    pre - jit

    Econo - jit

    Normal - jit.

    85. What is difference between C# And Vb.net?

    C# is case sensitive while VB is not case sensitive.

    vb.net does not support xml while c# support xml

    vb.net supports with constructor while c# do not.

    86. What does assert() method do?

    In debug compilation, assert takes in a Boolean condition as a parameter, and shows

    the error dialog if the condition is false. The program proceeds without any

    interruption if the condition is true.

    87. Why string are called Immutable data Type?

    The memory representation of string is an Array of Characters, So on re-assigning

    the new array of Char is formed & the start address is changed . Thus keeping the

    Old string in Memory for Garbage Collector to be disposed.

  • 7/30/2019 VB Interview Questions and answers

    14/17

    88. What is the difference between Convert.toString and

    .toString() method?

    Convert.toString handles null while i.tostring() does not handles null.

    How many types of Transactions are there in COM + .NET

    ?

    There are 5 transactions

    types that can be used

    with COM+.

    Disabled

    Not Supported

    Supported

    Required

    Required New

    90. What is a DataTable?

    A DataTable is a class in .NET Framework and in simple words a DataTable object

    represents a table from a database.

    91. How many namespaces are in .NET version 1.1?

    124.

    92. What is a DataSet?

    A DataSet is an in memory representation of data loaded from any data source

    93. What is the difference between in-proc and out-of-proc?

    An Inproc is one which runs in the same process area as that of the client giving tha

    advantage of speed but the disadvantage of stability becoz if it crashes it takes the

    client application also with it.

    Outproc is one which works outside the clients memory thus giving stability to the

    client, but we have to compromise a bit on speed.

    94. What is the differnce between Managed code and unmanaged code?

    Managed Code: Code that runs under a "contract of cooperation" with the common

    language runtime. Managed code must supply the metadata necessary for the

    runtimeto provide services such as memory management, cross-language

    integration, code access security, and automatic lifetime control of objects. All codebased on Microsoft intermediate language (MSIL) executes as managed code.

  • 7/30/2019 VB Interview Questions and answers

    15/17

    Un-Managed Code:Code that is created without regard for the conventions and

    requirements of the common language runtime. Unmanaged code executes in the

    common language runtime environment with minimal services (for example, no

    garbage collection, limited debugging, and so on).

    95. What is difference between constants, readonly and, static?

    Constants: The value cant be changed.

    Read-only: The value will be initialized only once from the constructor of the class.

    Static: Value can be initialized once.

    96. What is the difference between Convert.toString and .toString() method?

    Convert.toString handles null while i.tostring() does not handles null.

    97. What are the advantages of VB.NET?

    The main advantages of .net are :

    .NET is a language independent

    Automatic memory management(garbage collection)

    Disconnected architecture

    Object Oriented.

    98. What is strong-typing versus weak-typing?

    Strong type is checking at the variables in compile time.

    Weak typing is checking the variables at run-time.

    99. What is the root class in .Net?

    system.object is the root class in .net .

    100. What is the maximum size of the textbox?

    65536

    101. What is managed code execution?

    The .Net framework loads and executes the .Net applications, and manages the state

    of objects during program execution. This also provides automatically garbage

    collections.

    102. What is the strong name in .net assembly?

    Strong Name is similar to GUID (It is supposed to be unique in space and time).

    In COM components. Strong name is only needed when we need to deploy assembly

  • 7/30/2019 VB Interview Questions and answers

    16/17

    in GAC.

    Strong names use public key cryptography (PKC) to ensure that no one can spoof it.

    PKC use public key and private key concept. Following are the step to generate a

    strong name and sign an assembly:

    103. How to run a Dos command in Vb.net?

    Shell("cmd.exe /c c:\first.exe < in.txt > out.txt")

    104. What are the assembly entry points?

    An assembly can have only one entry point from DllMain, WinMain or Main.

    105. What are remotable objects in .NET Remoting?

    Remotable objects are the objects that can be marshaled across the application

    domains. You can marshal by value, where a deep copy of the object is created and

    then passed to the receiver. You can also marshal by reference, where just a

    reference to an existing object is passed.

    106. What are the types of Authentication?

    There are 3 types of Authentication.

    Windows Authentication

    Forms Authentication

    Passport Authentication

    .

    107. What namespaces are necessary to create a localized application?

    System.Globalization

    System.Resources

    108. Which namespaces are used for data access?

    System.Data

    System.Data.OleDB

    System.Data.SQLClient

    109. What is a SESSION and APPLICATION object?

  • 7/30/2019 VB Interview Questions and answers

    17/17

    Session object store information between HTTP requests for a particular user.

    Session variables are used to store user specific information where as in application

    variables we cant store user specific information.

    while application object are global across users.

    110. What is static constructor?

    A static constructor is used to initialize a class. It is called automatically to initialize

    the class before the first instance is created or any static members are referenced.