You are on page 1of 11

Vb.

Net Important question


1. What is .net?
VB.NET stands for Visual Basic.NET, and it is a computer programming language developed by
Microsoft. It was first released in 2002 to replace Visual Basic 6. VB.NET is an object-oriented
programming language. This means that it supports the features of object-oriented
programming which include encapsulation, polymorphism, abstraction, and inheritance.

2. Define the following terms: MSIL, CLR, and FCL.


The Microsoft Intermediate Language (MSIL) is a set of instructions that are platform
independent and consequently, it can be executed on any of the Common Language
Infrastructure supported environments such as the Windows .NET runtime.

(CLR): The execution process that includes the creation of the MSIL and the conversion of the
MSIL into machine code by the JIT compiler.

The Framework Class Library or FCL provides the system functionality in the .NET Framework as
it has various classes, data types, interfaces, etc. to perform multiple functions and build
different types of applications such as desktop applications, web applications, mobile
applications, etc.

3. Explain the .net framework architecture.


The architecture of the .Net framework is a kind of programming model for the Net platform
under which it offers a managed performance environment, development, and deployment in
the simplest way. And the integration process with a wide range of coding languages.
Furthermore, the.Net framework architecture is based on some key components that include;

· CLS- Common Language Specification

· CTS- Common Type Specification

· FCL- .Net Framework Class Library

· CLR- Common Language Runtime

· CLI- Common Language Infrastructure

4. What are the design features of .net framework?


a) .Net Familiarized a unified programming environment
b) .Net Dedicated programmers to object-oriented technologies
c) .Net simplified windows programming
d) .Net improved security
e) .Net improved developer productivity through standards
f) .Net improved web-based development
g) .Net simplified deployment of application
5. Explain Namespaces
Namespaces organize the objects defined in an assembly. Assemblies can contain multiple
namespaces, which can in turn contain other namespaces. Namespaces prevent ambiguity and
simplify references when using large groups of objects such as class libraries.
For example, the .NET Framework defines the ListBox class in the System.Windows.Forms
namespace. The following code fragment shows how to declare a variable using the fully
qualified name for this class:
Dim LBox As System.Windows.Forms.ListBox

6. Explain in brief different components of Visual Studio IDE


The components of the IDE screen of Visual Basic. IDE stands for Integrated Development Environment.
The main functions include writing, compiling and debugging code, monitoring resources.
The IDE in VB (Visual Basic) is ‘Visual Studio’. It consists of the following components. Those are
Toolbar
Menu bar
Project explorer
Properties window
Form layout window
Object designer
Form designer
Toolbox

7. Write short notes on : a. CLR b. FCL

a) The Common Language Runtime (CLR) is programming that manages the execution of programs
written in any of several supported languages, allowing them to share common object-oriented
classes written in any of the languages. It is a part of Microsoft's .NET Framework. The CLR is
somewhat comparable to the Java virtual machine that Sun Microsystems provides for running
programs compiled from the Java language. Microsoft refers to its CLR as a "managed execution
environment." A program compiled for the CLR does not need a language-specific execution
environment and can easily be moved to and run on any system with Windows 2000 or
Windows XP.

b) The Framework class library (FCL) is a comprehensive collection of reusable types including
classes, interfaces and data types included in the .NET Framework to provide access to system
functionality.
The .NET FCL forms the base on which applications, controls and components are built in .NET. It
can be used for developing applications such as console applications, Windows GUI applications,
ASP.NET applications, Windows and Web services, workflow-enabled applications, service
oriented applications using Windows Communication, XML Web services, etc.
8.Explain JIT Compiler
Just-In-Time compiler(JIT) is a part of Common Language Runtime (CLR) in .NET which is responsible for
managing the execution of .NET programs regardless of any .NET programming language. A language-
specific compiler converts the source code to the intermediate language. This intermediate language is
then converted into the machine code by the Just-In-Time (JIT) compiler. This machine code is specific to
the computer environment that the JIT compiler runs on.

9.Explain Variable declaration and different datatypes in vb. Net


A variable is nothing but a name given to a storage area that our programs can manipulate.
Variable Declaration in VB.Net
The Dim statement is used for variable declaration and storage allocation for one or more variables. The
Dim statement is used at module, class, structure, procedure or block level.

Data
Type Size Range

Boolea It depends on the Platform. True or False


n

Byte 1 byte 0 to 255

Char 2 bytes 0 to 65535

SByte 1 byte -128 to 127

Short 2 bytes -32,768 to 32,767

10.Explain type conversion in vb. Net


The process of changing a value from one data type to another type is called conversion.
Ex: Dim k As Integer
Dim q As double
k = 432
q=k

11.Explain function and sub procedure with example


A procedure is a block of Visual Basic statements enclosed by a declaration statement (Function, Sub,
Operator, Get, Set) and a matching End declaration. All executable statements in Visual Basic must be
within some procedure.
Sub Procedures perform actions but do not return a value to the calling code.
Event-handling procedures are Sub procedures that execute in response to an event raised by user
action or by an occurrence in a program.
Function Procedures return a value to the calling code. They can perform other actions before returning.

12.Explain string and different string operations


String is a sequential collection of characters that is called a text. The String keyword is used to create a
string variable that stores the text value. The name of the string class is System.String that contains the
various function of string.
1. Compare(): It is used to compare two specified string objects, and if the string is less than another
string object, it returns an integer value.
2. Concat(): The Concat() function is used in string class to join two or more strings or append one string
to the end of another string.
3. Contains(): It is used to validate whether the specified text or parameter exists in the current string. If
the text is existing in the string, it returns a true Boolean value; otherwise, it returns false.

13.Explain different mathematical function in vb. Net


1. Abs() Function
The Abs Function is used to returns the absolute value of a specified number.
Syntax
Math.Abs(n)
2. Min() Function
The Min function is used to find out the minimum value from two number.
Syntax
Math.Min(n1, n2)
3. Max() Function
The Min function is used to find out the maximum value from two number.
Syntax
Math.Min(n1, n2)

14. Menu Items


A menu is used as a menu bar in the Windows form that contains a list of related commands, and it is
implemented through MenuStrip Control. The Menu control is also known as the VB.NET MenuStrip
Control. The menu items are created with ToolStripMenuItem Objects. Furthermore, the
ToolStripDropDownMenu and ToolStripMenuItem objects enable full control over the structure,
appearance, functionalities to create menu items, submenus, and drop-down menus in a VB.NET
application.

15. Timer Controls


The timer control is a looping control used to repeat any task in a given time interval. It is an important
control used in Client-side and Server-side programming, also in Windows Services.
Properties Description

Name The Name property is used to set the name of the control.
Enabled The Enables property is used to enable or disable the timer control. By default, it is True.

Interval An Interval property is used to set or obtain the iteration interval in milliseconds to raise the
timer control's elapsed event. According to the interval, a timer repeats the task.

Events Events properties are used to get the list of event handler that is associated with Event
Component.
CanRaiseEven It is used to get a value that represents whether the component can raise an event.
ts

16. Different Form Controls


Visual Basic Form is the container for all the controls that make up the user interface. Every window you
see in a running visual basic application is a form, thus the terms form and window describe the same
entity. Visual Studio creates a default form for you when you create a Windows Forms Application

S.N Properties Description

1 CancelButton The button that's automatically activated when you hit the Esc key.
Usually, the Cancel button on a form is set as CancelButton for a form.

2 BackColor Sets the form background color.

3 AutoScrollMinSize This property lets you specify the minimum size of the form, before the scroll
bars are attached.

4 AutoScrollPosition The AutoScrollPosition is the number of pixels by which the two scroll bars were
displaced from their initial locations.

Sr.No. Method Name & Description

1 Activate
Activates the form and gives it focus.

2 ActivateMdiChild
Activates the MDI child of a form.

3 AddOwnedForm
Adds an owned form to this form.

4 BringToFront\Brings the control to the front of the z-order.

17. MDI Forms


MDI stands for Multiple Document Interface applications that allow users to work with multiple
documents by opening more than one document at a time. Whereas, a Single Document Interface (SDI)
application can manipulate only one document at a time. For example, Microsoft Paint and Notepad are
both SDI applications.
The MDI applications act as the parent and child relationship in a form. A parent form is a container that
contains child forms, while child forms can be multiple to display different modules in a parent form.
VB.NET has following rules for creating a form as an MDI form.
1.MidParent: The MidParent property is used to set a parent form to a child form.
2.ActiveMdiChild: The ActiveMdiChild property is used to get the reference of the current child form.
3.IsMdiContainer: The IsMdiContainer property set a Boolean value to True that represents the creation
of a form as an MDI form.
4.LayoutMdi(): The LayoutMdi() method is used to arrange the child forms in the parent or main form.
5.Controls: It is used to get the reference of control from the child form.

18.Exception Handling
A C++ exception is a response to an exceptional circumstance that arises while a program is running,
such as an attempt to divide by zero.
Exceptions provide a way to transfer control from one part of a program to another. C++ exception
handling is built upon three keywords: try, catch, and throw.
•throw − A program throws an exception when a problem shows up. This is done using a throw
keyword.
•catch − A program catches an exception with an exception handler at the place in a program where you
want to handle the problem. The catch keyword indicates the catching of an exception.
•try − A try block identifies a block of code for which particular exceptions will be activated. It's followed
by one or more catch blocks.
Assuming a block will raise an exception, a method catches an exception using a combination of the try
and catch keywords. A try/catch block is placed around the code that might generate an exception.

19. File Handling


A file is a collection of data stored in computer memory with a specific name and a defined folder path.
The term File Handling in VB.NET is used to perform various operations like create a file, read a file,
write to the file, closing the file, and more. Furthermore, when a file is opened for reading and writing, a
stream is created.
A stream is a sequence of bytes that passes data to a file to read or write. In VB.NET file handling, there
are two types of stream such as Input Stream or Read Stream and Output Stream or Write Stream.
In VB.NET, we use the System.IO namespace, that has different classes to perform various input and
output operations with files, such as the FileStream class used to perform any operation like opening a
file, closing a file, deleting a files, reading from or writing to a file, etc.

20. Crystal Reports


Crystal Report is a Reporting application that can generate reports from various Data Sources . We can Create
Reports , Print and Print Preview of reports from Crystal Reports . Crystal Reports are compatible with most
popular development environments like VB.NET etc. and SQL Server also .
Open Visual Studio .NET and select a new Visual Basic .NET Project.
Create a new Crystal Reports for Product table from the above database crystalDB. The Product Table has three
fields (Product_id,Product_name,Product_price) and we are showing the whole table data in the Crystal Reports.
From main menu in Visual Studio select PROJECT-->Add New Item . Then Add New Item dialogue will appear and
select Crystal Reports from the dialogue box.
Select Report type from Crystal Reports gallery.
Accept the default settings and click OK.
Next step is to select the appropriate connection to your database. Here we are going to select OLEDB connection
for SQL Server
Select OLE DB (ADO) from Create New Connection.
Select Microsoft OLE DB Provider for SQL Server .

21.Explain ASP.Net features


1. High Performance:Due to its ASP.NET Core and Kestrel web server, it’s remarked as the fastest and
quick web application framework, which is available in the market. Due to its new Kestrel web server, it
is more fast and lightweight.
2. Cross-Platform and Container Support:As we say it supports cross-platform means it supports
Windows, macOS, and Linux. So if we create ASP.NET application then we can directly deploy it on these
platforms.
3. Asynchronous via Async/Await:Asynchronous programming patterns are now implemented in all .net
frameworks classes and 3rd party libraries.
4. Rich Development Environments:It provides a rich development environment by which we can easily
drag and drop the components (radio buttons, checkboxes, etc.) and create the application.
5. Language Independent:The framework is language independent that is developers can use various
languages like C#.
6. Supports for Web Sockets:Sockets are used to create a client – server-based Applications. By socket
normally we can create web-based client-server applications. These provide back and forth
communication of the browser.
7. Action Filters:These filters are used to implement error handling, authorization, caching or to any
custom logic which we would like to implement. There is a logic been implemented which will be
executed before and after controller action.
8. Globalization and Localization:We host the web application and it can be accessed from anywhere
globally. So language, date and time format, number format, the currency must be different for different
regions or countries. ASP.NET supports globalization so that different countries’ clients or people also
can understand and they can access this application. ASP.NET customize our application for different
languages with the help of resource files. These files act as a central repository where all the texts are
placed.
9. Security:As it supports the .net framework so it will provide security for our application. Applications
have its individual identity, so before running this .net will check its identity of those objects. It will also
check the operating system security. Due to its pre-application configuration and feature of built-in
windows authentication, our developed application is safe and secure.

22.Validation Controls
An important aspect of creating ASP.NET Web pages for user input is to be able to check that the
information users enter is valid. ASP.NET provides a set of validation controls that provide an easy-
to-use but powerful way to check for errors and, if necessary, display messages to the user.
There are six types of validation controls in ASP.NET
1. RequiredFieldValidation Control
2. CompareValidator Control
3. RangeValidator Control
4. RegularExpressionValidator Control
5. CustomValidator Control
6. ValidationSummary
7. The below table describes the controls and their work.

33. Write a note on page life cycle.


An Asp.Net page is run through a series of phases during its creation and disposal. These include
initialization, instantiating controls, restoring and maintaining state, running event handler code,
and rendering.
When a page is requested, it is loaded into the server memory , processed, and sent to the browser.
Then it is unloaded from the memory . At each of these steps, methods and events are available,
which could be overridden according to the need of the application. In general terms, the page goes
through the stages of the following:
 Page request
 Start
 Initialization
 Load
 Postback event handling
 Rendering
 Unload
1. Page request : This stage occurs before the lifecycle begins. When the user requests a page,
ASP.NET parses and compiles that page.
2. Start : At this stage, the Request and Response objects are set. If the request is an old request or
post back, the IsPostBack property of the page is set to true. The UICulture property of the page is
also set.
3. Initialization : During page initialization, controls on the page are available and each control's
UniqueID property is set. A master page and themes are also applied to the page if applicable. If the
current request is a postback, the postback data has not yet been loaded and control property
values have not been restored to the values from view state .
4. Load : During this phase, if page request is postback, control properties are loaded with
information.
24. What is function. Explain Call by value and call by Reference with example.
The Function statement is used to declare the name, parameter and the body of a function. The
syntax for the Function statement is −
[Modifiers] Function FunctionName [(ParameterList)] As ReturnType [Statements] End Function
Call by Value means calling a method with a parameter as value. Through this, the argument value is
passed to the parameter.
While Call by Reference means calling a method with a parameter as a reference. Through this, the
argument reference is passed to the parameter.
In call by value, the modification done to the parameter passed does not reflect in the caller's scope
while in the call by reference, the modification done to the parameter passed are persistent and
changes are reflected in the caller's scope.

25. Explain steps to create a VB.net application.


Creating a New Project
1. In the Visual Studio.NET environment, select File | New | Project from the menu.
2. Select Visual Basic on the left and then Console Application on the right.
3. Specify the name of your project and enter the location in which to create the project. Visual
Studio will create the project directory automatically.
4. Click OK

26.Define .net framework


.NET Framework is a software development framework for building and running applications on Windows.
.NET Framework is part of the .NET platform, a collection of technologies for building apps for Linux, macOS,
Windows, iOS, Android, and more.

27.Name any two types of application created with vb.net


Standard EXE ActiveX control Data project

28.Explain difference between static and dynamic arrays


The key difference between static and dynamic arrays is that you can't change the size of a static array. VB.NET
supports both syntax forms, but in all cases it creates dynamic arrays.

29.Define Generic
A generic type is a single programming element that adapts to perform the same functionality for a variety of
data types. When you define a generic class or procedure, you do not have to define a separate version for
each data type for which you might want to perform that functionality.

30.Difine constant and how to declare a constant value in vb.net


A constant is a meaningful name that takes the place of a number or string that does not change. Constants
store values that, as the name implies, remain constant throughout the execution of an application.
You use the Const statement to declare a constant and set its value. By declaring a constant, you assign a
meaningful name to a value. Once a constant is declared, it cannot be modified or assigned a new value.

31.Mention the ASP.NET HTML controls

Controls Name Description


Button It is used to create HTML button.

Reset Button It is used to reset all HTML form elements.

Submit Button It is used to submit form data to the server.

Text Field It is used to create text input.

Text Area It is used to create a text area in the html form.

32.Define ASP.NET
ASP.NET is a web development platform, which provides a programming model, a comprehensive software
infrastructure and various services required to build up robust web applications for PC, as well as mobile
devices.

33.Define SQL
Basically, SQL stands for Structured Query Language which is basically a language used by databases. This
language allows to handle the information using tables and shows a language to query these tables and other
objects related (views, functions, procedures, etc.). Most of the databases like SQL Server, Oracle, PostgreSQL,
MySQL, MariaDB handle this language (with some extensions and variations) to handle the data.

34.Define XML
XML stands for extensible markup language. A markup language is a set of codes, or tags, that describes the
text in a digital document. The most famous markup language is hypertext markup language (HTML), which is
used to format Web pages.

35.Explain different types Control statements

Control Description
Statement

Exit statement Terminates the loop or select case statement and transfers execution to the


statement immediately following the loop or select case.

Continue Causes the loop to skip the remainder of its body and immediately retest its
statement condition prior to reiterating.

GoTo statement Transfers control to the labeled statement. Though it is not advised to use
GoTo statement in your program.
36.Explain Navigation Controls
Basically ASP.NET 2.0 has three navigation controls:
(1) Dynamic menus: It was the very difficult task to maintain the menu of a large website and time
consuming. It is used to display the Menus. You can use it as easy as other Navigation controls.
(2) Tree Views: A Tree View control displays a hierarchical list of items using lines to connect related items in
a hierarchy. Each item consists of a label and an optional bitmap.
(3) Site Map Path: Use of this control is very simple. You can add this control to your page then view your
page in browser. The Sitemap Path control displays the navigation path of the current page

37.Explain LINQ
LINQ is a data querying API that provides querying capabilities to . NET languages with a syntax similar to a SQL.
LINQ queries use C# collections to return data. LINQ in C# is used to work with data access from sources such as
objects, data sets, SQL Server, and XML.

You might also like