Review Questions


1:

What does Visual Basic .NET have so many data types?

A1:

Many years ago, some dialects of BASIC only had one data type. However, one size fits all just does work very well where data is concerned . Some data is numeric, other data is text, plus many other types. By having data types that fit the data you find in real life, your programs are more efficient at processing that data.

2:

Why does Visual Basic .NET require you to define the type of a variable?

A2:

One important reason is that Visual Basic .NET needs to know how much storage is required to store the variable. Data definitions provide Visual Basic .NET with the information it needs to store and track the data as the program executes.

3:

Why is it that some data types that use less memory are not processed as efficiently as other data types that require more memory?

A3:

Every CPU has a set of registers that are used to process data. Most Windows PCs use CPUs that are best suited for 4-byte integer data and 8-byte floating point data. Data that doesn't fit these natural CPU register sizes often has to be padded or trimmed to fit the CPU registers; a process that takes time.

4:

What is a symbol table and what does it do?

A4:

A symbol table is a table of information that Visual Basic .NET maintains in memory about a program. Some of the more important responsibilities of the symbol table are to keep track of the names of the variables being used in the program and where each variable is located in memory.

5:

What is an lvalue ?

A5:

An lvalue (location value) is the memory location of where a data item is stored in memory. The lvalue for each variable in a program is maintained in the symbol table. Visual Basic .NET uses the lvalue to locate where any specific variable is stored in memory.

6:

What is an rvalue ?

A6:

An rvalue (read value, or sometimes called a register value) is the data that a variable contains. The lvalue is used to find the variable in memory, and the rvalue is what is stored at the memory location.

7:

Why does Visual Basic .NET have to know the data type of a variable?

A7:

Visual Basic .NET not only keeps the name of the variable and its lvalue in the symbol table, it also keeps that variable's data type. Because each data type requires a known amount of memory, Visual Basic .NET can use the lvalue to go to the memory address of the variable and the data type determines how many bytes Visual Basic .NET must fetch to get the data ( rvalue ) of the variable. Without the data type, Visual Basic .NET would not know how many bytes to fetch from memory to get the data associated with the variable.



Visual Basic .NET. Primer Plus
Visual Basic .NET Primer Plus
ISBN: 0672324857
EAN: 2147483647
Year: 2003
Pages: 238
Authors: Jack Purdum

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net