0% found this document useful (0 votes)
33 views

Introduction To VB

The document discusses various topics related to VB.NET including its introduction as an object-oriented programming language part of the .NET framework for building Windows applications. It covers new features introduced in VB.NET 2012 like asynchronous programming and event handling. It also discusses language basics like ByVal and ByRef parameters, object-oriented principles like encapsulation and inheritance, exception handling using Try/Catch blocks, .NET assemblies, Windows Forms, database connectivity using ADO.NET, LINQ for querying data, multithreading using threads, and differences between VB.NET and other languages.

Uploaded by

qasimalijutt713
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
33 views

Introduction To VB

The document discusses various topics related to VB.NET including its introduction as an object-oriented programming language part of the .NET framework for building Windows applications. It covers new features introduced in VB.NET 2012 like asynchronous programming and event handling. It also discusses language basics like ByVal and ByRef parameters, object-oriented principles like encapsulation and inheritance, exception handling using Try/Catch blocks, .NET assemblies, Windows Forms, database connectivity using ADO.NET, LINQ for querying data, multithreading using threads, and differences between VB.NET and other languages.

Uploaded by

qasimalijutt713
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 38

Introduction to VB.

NET:
Question: What is VB.NET?
Answer: VB.NET is a programming language developed by
Microsoft. It is an object-oriented programming language that is
part of the .NET Framework, designed for building Windows
applications.
Features of VB.NET 2012:
Question: What are the new features introduced in VB.NET
2012?
Answer: Some of the features introduced in VB.NET 2012 include
asynchronous programming support with the Async and Await
keywords, simplified event handling with the AddHandler and
RemoveHandler statements, and improved support for dynamic
programming through the Dynamic Language Runtime (DLR).
Language Basics:
Question: Explain the difference between ByVal and ByRef in
VB.NET.

Answer: ByVal passes the value of a variable to a procedure,


while ByRef passes the reference to the variable. Changes made
to a variable passed ByRef in a procedure affect the original
variable.
Object-Oriented Programming (OOP):
Question: Describe the principles of OOP and how they are
implemented in VB.NET.
Answer: OOP principles include encapsulation, inheritance, and
polymorphism. In VB.NET, these principles are implemented
through classes and objects, allowing for the organization of code
into reusable and modular components.
Exception Handling:
Question: How is exception handling done in VB.NET?
Answer: Exception handling in VB.NET is done using Try, Catch,
and Finally blocks. Code that might cause an exception is placed in
the Try block, and if an exception occurs, the corresponding Catch
block is executed. The Finally block is used for code that must be
executed regardless of whether an exception occurs or not.
.NET Assemblies:
Question: What is an assembly in VB.NET?
Answer: An assembly is a compiled unit of code in VB.NET that
includes the Intermediate Language (IL) code, metadata, and
resources. Assemblies can be private or shared and are the
building blocks of .NET applications.
Windows Forms:
Question: Explain the role of Windows Forms in VB.NET.
Answer: Windows Forms is a graphical user interface (GUI)
framework in VB.NET for creating desktop applications. It provides
a set of controls and components that allow developers to design
interactive and user-friendly interfaces.
Data Access:
Question: How do you connect to a database in VB.NET?
Answer: To connect to a database in VB.NET, you use ADO.NET.
You create a connection to the database using SqlConnection,
create a command using SqlCommand, and execute queries to
retrieve or modify data.
LINQ (Language-Integrated Query):
Question: What is LINQ, and how is it used in VB.NET 2012?
Answer: LINQ is a feature in VB.NET that allows for querying data
from various sources using a unified syntax. It can be used to
query collections, databases, XML, and more. LINQ queries are
written in a declarative syntax, making it easier to express
complex queries.
Multithreading:
Question: How does VB.NET handle multithreading?
Answer: VB.NET handles multithreading through the
System.Threading namespace. The Thread class is used to create
and control threads. Synchronization mechanisms such as locks
and monitors are employed to ensure proper coordination
between threads.

Question: What is the difference between VB and VB.Net?


Answer:
Following are the differences between VB and VB.Net:
VB VB.Net
Platform dependent Platform Independent
VB is backward compatible VB.Net is not backward
compatible
Interpreted Compiler Language
Exception Handling by ‘On Exception Handling by
Error…..Goto’ ‘Try….Catch’
Cannot develop multi- Can develop multi thread
threaded applications applications

Question: What is the difference between C# and VB.Net?


Answer:
Following table gives differences between C# and VB.Net:
VB.Net C#
Optional Parameters are Optional Parameters are not
accepted accepted
Not case sensitive Case Sensitive
Nothing is used to release ‘Using’ is used to release
unmanaged resources unmanaged resources
Support of Both structured Unstructured error handling
and unstructured error
handling

Question: What is namespace?


Answer:
A namespace is an organized way of representing Class, Structures
and interfaces present in .NET language. Namespaces are
hierarchically structured index of a class library, available to
all .NET Languages.
Question: Which namespace are used for accessing the data?
Answer:
System.Data namespace is used for accessing and managing data
from the required data source. This namespace deals only with
the data from the specified database.

Question: What is JIT?

Answer:
JIT is termed as Just in Time compiler which is used as a part of
runtime execution environment. There are three types of JIT and
they are:
Pre-JIT – Compiles at the time of deployment of an application
Econo-JIT – Compiles called methods at runtime
Normal JIT – Compiles called methods at runtime and they get
compiled first time when called

Question: What is an assembly and its use?


Answer:
An assembly is one of the elements of a .NET application and it
termed as a primary unit of all .NET applications. This assembly
can be either DLL or executable file.
Question: What are the different types of assembly?
Answer:
There are two types of assembly –
Private – A private assembly is normally used by a single
application and it is stored in application’s directory.
Public – A public assembly or shared assembly is stored in Global
Assembly Cache(GAC) which can be shared by many applications
Question: What is the difference between Namespace and
Assembly?
Answer:
Assembly is physical grouping of all units and Namespace logically
groups classes. Namespace can have multiple assemblies.
Question: What is INTERNAL keyword in .Net Framework?
INTERNAL keyword is one of the access specifier which will be
visible in a given assembly i.e. in a DLL file. This forms a single
binary component and it is visible throughout the assembly.

Question: What are Option Strict and Option Explicit?


Answer:
.Net generally allows implicit conversion of any data types. In
order to avoid data loss during data type conversion, Option Strict
keyword is used and it ensures compile time notification of these
types of conversions.
Option Explicit is the keyword used in a file to explicitly declare all
variables using declare keywords like Dim, Private, Public or
Protected. If undeclared variable name persists, an error occurs at
compile time.

Question: What is the use of New Keyword?


Answer:
New keyword is used with the constructor in which it can be used
as a modifier or an operator. When it is used as a modifier, it
hides inherited member from the base class member. When it is
used as an operator, it creates an object to invoke constructors.

Question: What is ReDim keyword and its use?


Answer:
Redim keyword is exclusively used for arrays and it is used to
change the size of one or more dimensions of an array that has
been already declared. Redim can free up or add elements to an
array whenever required.
Question: What is jagged array in VB.Net?
Answer:
Jagged array is nothing but an array of arrays. Each entry in the
array is another array that can hold any number of items.

Question: What is Manifest?


Answer:
A Manifest is a text file that is used to store metadata information
of .NET assemblies. File type of Manifest can be saved as a type
PE. Assembly Name, Version, Culture and key token can be saved
as a Manifest.

Question: What are all the differences between Dispose and


Finalize()?
Answer:
Finalize method is called by Garbage collector which helps us to
make free of unmanaged resources. There are some other
resources like window handles, database connections are handled
by iDisposable interface.
Dispose method is handled by IDisposable interface to explicitly
release unused resources. Dsipose can be called even if other
references to the object are alive.

Question: What is Garbage Collection?


Answer:
Garbage collection is also known as automatic memory
management, which is used for automatic recycling of
dynamically allocated memory. Garbage collection is performed
by Garbage collector which will recycle memory if it is proven that
memory will be unused.

Question: What are the types of generations in garbage


collector?
Answer:
There are three types of generations in garbage collector.
Generation 0 – This identifies a newly created object that has
been never marked for collection.
Generation 1 – This identifies an object which has been marked as
collection but not removed.
Generation 2 – This identifies an object that has survived more
than one sweep of the Garbage collector.

Question: What is the use of Option explicit?


Answer:
Variable must be compulsorily declared when the Option Explicit
is termed as ON. If it is OFF, variables can be used without
declaration.
Question: What is the difference between System.String and
System.StringBuilder classes?
Answer:
System.string class is non-updatable and it will create new string
object instead of updating the same. But updation in the same
string object is possible for String. Stringbuilder class. So, the
operation on string builder is faster and efficient than the string
class.

Question: What is the difference between int and int32?


Answer:
Int32 represent 32-bit signed integer whereas int is not a keyword
used in VB.Net.

Question: What is hashtable?


Answer:
Hashtable is set to be items with key and value pairs. Keys are
referred as indexes and quick search can be performed for values
by searching through the keys.

Question: What are nested classes?


Answer:
A class that can be declared within the scope of another class.
These classes are considered within the scope of the enclosed
class and are available within that class or scope.

Question: What is Enumerator?


Answer:
An Enumerator or Enum is a value type with a set of constants
given to the set of the list. Enumeration is used when definition is
required for more than one number.

Question: What is Delegate?


Answer:
A delegate is defined as an object that can refer to a method.
Whenever a delegate is assigned to a method, it behaves exactly
like that method.
Question: What is Globalization?
Answer:
Globalization is nothing but making the application
Internationalize and localizing the application to other languages
or cultures. Culture is nothing but a combination of
Language(English) and the location like US or UK. In the context of
VB.NET and software development in general, globalization refers
to the process of designing and implementing applications that
can be easily adapted to various cultures and regions around the
world. The goal of globalization is to create software that can
accommodate different languages, date and time formats,
number formats, and other cultural conventions without requiring
modification of the source code.

Question: What is the difference between Dataset and


Datareader?
Answer:

DataReader Dataset
Datareader has read only Dataset can hold more than
access to the data and it is one table from the same
set to be forward only. data source. It even stores
relationships between
tables.
Datareader cannot persist Dataset can persist contents
contents as it is read only
Datareader is connected Dataset is disconnected
architecture architecture

Question: What is the difference between value and reference


types?
Answer:
Value types directly store the data and it is allocated to stack.
Reference type store a reference to the value’s memory address
and are allocated to heap.

Question: What is TRACE in VB.Net?


Answer:
TRACE allows the user to view how the code has been executed in
detail. This tells how the code is working.

Question: What is Authentication and Authorization?


Answer:
Authentication is the process of obtaining credentials from the
users and verifying the user’s identity. Authorization is the
process of giving access to the authenticated resources.
Authentication leads to Authorization.

Question: What are the types of Authentication?


Answer:
There are three types of Authentication and they are –
Windows Authentication
Forms Authentication
Passport Authentication
Question: What is Global Assembly Cache (GAC)?
Answer:
GAC is used where shared .NET assembly resides. It is used in the
following criteria:
If .Net assembly has special security requirements
If .Net application has to be shared with other applications

Question: What is CLR?


Answer:
CLR is abbreviated as Common Language Runtime and it forms
heart of the .NET framework. It is the responsibility of runtime to
take care of the code execution of the program. CLR takes care of
the following:
Garbage Collection
Code Verification
Code Access Security
IL (Intermediate Language)

Question: What is CTS?


Answer:
CTS is Common Type System which is used to communicate
smoothly between the languages. For example, if VB has Integer
data type and C++ has long data type and these data types are not
compatible.
In order to be compatible, CTS can be used as an interface
between two languages.

Question: What is CLS?


Answer:
Common Language Specification is a subset of CTS and it is used
to unite all languages in to one umbrella. This extends to support
all the .NET language into one unit.

Question: What is Managed code?


Answer:
Managed Code is used to run inside the CLR environment and it is
called as .NET run time. All Intermediate Language (IL) are set to
be Managed code.
38) What is serialization in .Net?
Serialization is defined as a process of converting an object to
stream of bytes. This is used mainly to transport objects.

Question: How many languages are supported by .Net?


Answer:
Following are the languages supported by VB.Net:
C#
VB.Net
COBOL
Perl

Question: What is the difference between Convert.tostring and


i.tostring method?
Answer:
Convert.tostring handles Null and i.tostring does not handle null.

Question: What are the two main parts of .NET?


Answer:
They are – Common Language Runtime (CLR) and .NET Framework
class library.

Question: What is the difference between thread and process?


Answer:
Thread is used to execute more than one program at a time.
Whereas, Process executes single program at a time.

Question: What is strong typing and weak typing?


Answer:
Strong type is checking the types of variables at compile time and
weak type is checking the types of system as late as possible
which is nothing but run time.

Question: How many .NET languages can a single .NET DLL


contain?
Answer:
Only one language will be supported by one DLL.

Question: What is the class that allows an element to be


accessed using Unique key?
Answer:
Hash table is the collection class that allows an element to be
accessed using Unique key.

Question: What is Code Security?


Answer:
.NET framework provides security features to secure code from
unauthorized users. There are two types of security in .NET:
Role based security – Authorizes User
Code access security – Protects system resources from
unauthorized calls

Question: Which DLL Is used for Microsoft .NET run time?


Answer:
Mscoree.dll is used for Microsoft .NET runtime DLL.

Question: How many classes a DLL can contain?


Answer:
Unlimited number of classes can be present in a DLL.

Question: How can we store decimal data in .NET?


Answer:
BinaryWriter is used to store decimal data in .NET.

Question: What is deep copy?


Deep copy is nothing but creating a new object and then copying
the non-static fields of the current object to new object.

You might also like