Computer Science, asked by rabhasnigdha9, 6 hours ago

Differentiate between the three commonly used data types in VB variables?

help please!​

Answers

Answered by AlexTheNerd
1

Answer:

Think variable as a container.

A container that hold different types of things like a trolley in supermart.

Think data types as the items in a supermarket.

When you visit a supermarket, you takes the trolley with you to holds different types of item.

Hence variable is use to declare any one of the eight primitive data types such as, byte, short, int, long, float, double, char or boolean.

Example:

private String name="Luigi";  

private int score=0;  

In the above example, name is variable of type string that holds the value “Luigi”. Similarly score is a variable of type int (integer) that holds the value 0.

The two fundamental data types in Visual Basic are value types and reference types. Primitive types (except strings), enumerations, and structures are value types. Classes, strings, standard modules, interfaces, arrays, and delegates are reference types. Every type has a default value.

It’s like the difference between food and flavor. Food is a thing, and flavor is an attribute of a thing.

A variable is an object that holds a value. The data type for the variable describes what type of value the variable holds.

A variable is a human-readable tag that usually represents an address in memory or a known value. A data type is a descriptor that explains how the data at the address in memory should be treated (and how many bytes the data consists of).

Both of these concepts are “high level” in that they are basically abstractions made to make programming easier. The program you make can pretend any area of memory is any data type the program wants it to be - the computer doesn’t care.

Your computer’s processor has many instructions to make using common “data types” fast and efficient. The most common data types are integers, floating point numbers, and pointers (which are basically numbers that represent another address in memory).

A variable holds (points to) data stored in computer memory making the data easier to work with, especially when you might not even know what that data is.

Data is held in computer memory. Data is words, numbers, characters.

Say you’re asking for someone’s name in a program you wrote.

What is your name?:

And some user types in Karen.

That name Karen was unknown until your user typed it in so in preparation for an unknown name you created beforehand a variable that will hold (point to) this unknown data that is stored in computer memory.

String username = "whatever user types in";  

Karen is now known as username in your program. Wherever you use username you will essentially be using the name Karen.

You can now display back to your user a greeting message using the variable which is pointing to the saved data and that data will be displayed to your user.

In your computer program:

 1. System.out.println ("Hello," + username);  

Displayed on screen to your user:

Hello, Karen.

Answered by tanushreebanerjeesnb
0

Answer:

mark the brainiest if you like the answer

Explanation:

Think variable as a container.

A container that hold different types of things like a trolley in supermart.

Think data types as the items in a supermart.

When you visit a supermart, you takes the trolley with you to holds different types of item.

Hence variable is use to declare any one of the eight primitive data types such as, byte, short, int, long, float, double, char or boolean.

Example:

private String name="Luigi";

private int score=0;

In the above example, name is variable of type string that holds the value “Luigi”. Similarly score is a variable of type int (integer) that holds the value 0.

Similar questions