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

What Is Data Type

Uploaded by

ashuuikey2002
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views

What Is Data Type

Uploaded by

ashuuikey2002
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Que:-What is data type ? Explain the different data types of vb.net?

When a variable is declared, we also have to write its data type,


because the value stored in any variable depends on its data type.
Whatever is the data type of the variable, only that type of value can
be stored in it. In programming, data types define the type of data.
Data Types Along with the type of data to be stored, its data storage
length is also mentioned. Variables in Visual Basic are divided into
the following five categories:-

numeric
string
Boolean
date
Object
Numeric Variables:- Numbers in which decimal point is not used
are called Integer numbers. This includes data types that store
numbers. These are used to perform mathematical operations. It
includes the following data types-

Short (Int16):- It is used to store Integer Value. In this, value can be


stored from -32768 to 32767 and it takes 2 bytes in memory.
Dim a As Short
a = 10000
Integer (Int32):- It is used to store Integer Value. In this, value can
be stored from -2147483648 to 2147483647 and it takes 4 bytes in
memory.
Dim a As Integer
a = 1000000

Long (Int64):- It is used to store Integer Value. In this, more values


than integer can be stored and it takes 8 bytes in memory.

Floating point Numbers:- Numbers in which decimal point is used


are called Floating point Numbers.

Single-It stores single precision floating number. It can store values


from -3.402823E38 to -1.401298E-45 and from 1.401298E-45 to
3.402823E38. It takes 4 Byte Memory.
Double-It stores Double Precision Floating no. It can store values
from -1.797693134486232E308 to -4.94065645841247E-324 and
from 4.94065645841247E-324 to 1.797693134486232E308. It
takes 8 Byte Memory.
Decimal-It can store positive and negative values from 0 to
7.9228162514264337593543950335. It takes 16 bytes in memory.
Byte:- This is also a numeric data type in which values from 0 to 255
are stored. It takes 2 bytes in memory.
2.String:-A group of characters is called string, it is used to store
characters. There are following 2 types in this.

String-It is used only to store text. It stores the set of characters. Up


to 2 GB text can be stored in it.
Char -It is used to store single character. And takes 2 Byte space in
memory.
3.Boolean:- This data type is used to store True or False value.
Mostly it is used to check conditions.

4.Date:- This data type is used to store date and time. In this, #
character is used to store date or time.

Dim an As Date

a = #1/4/2005#

5.Object:- It is a common data type which is used to store all types


of values with common features of all data types.

You might also like