Lesson#7 Variables and Data Types Flashcards

1
Q

What is a variable?

A

A named storage location in your computer’s memory.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What two fields can you specify when declaring a variable?

A

Variable Name and Type of Data

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

After creating a variable how can you refer to it?

A

By using the specified variable name.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What are the 2 ways you can declare a variable?

A

Explicitly and Implicitly

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is the difference between Explicitly and Implicitly declared variables?

A

Explicitly declared variables are assigned a variable name prior to first use, Implicitly are not.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is meant by the term data type?

A

Refers to how a piece of data is stored.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What happens if you do not declare the data type of a variable?

A

It is automatically given a Variant data type.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is the basic structure of a variable declaration?

A

A keyword(Dim, Private, Public or Static), variable name and the ‘As’ keyword followed by the data type.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What are the 6 main data types you can work with?

A

Variant, String, Numeric, Date, Boolean and Object

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What does the Variant data type allow you to store?

A

Almost any kind of data apart from fixed-length strings.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What does the String data type allow you to store?

A

Text

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What does the Numeric data type allow you to store?

A

Numbers

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What does the Date data type allow you to store?

A

Dates and Times

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What does the Boolean data type allow you to store?

A

True and False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What does the Object data type allow you to store?

A

Object references and result in object variables.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What 3 types of textual data can String data types contain?

A

Letters, Numbers and Special Characters

17
Q

What are the 2 types of String data type?

A

Variable-length and Fixed-length

18
Q

In a Fixed-length string how do you specify the number of characters?

A

*

19
Q

If the assigned data in a Fixed-length string is longer than the length given what happens?

A

VBA truncates the data.

20
Q

If the assigned data in a Fixed-length string is shorter than the length given what happens?

A

VBA pads the data with trailing spaces

21
Q

What are the 7 main numeric data types?

A

Byte, Integer, Long, Single, Double, Currency and Decimal.

22
Q

What is the statement for assigning data to a variable?

A

VariableName = AssignedExpression

23
Q

What is variable scope?

A

Refers to the parts of a VBA a project in which you can use a variable.

24
Q

What is the default scope of a variable?

A

The procedure in which it’s declared

25
Q

What is the default lifetime of a variable?

A

The time in which the procedure it’s declared in is running.

26
Q

What are the 3 scopes a variable can have?

A

Procedure-level (local), module level (private) and global scope.

27
Q

What 2 differences do static variables have to regular procedure-level variables?

A

Longer lifetimes and aren’t reset when the procedure ends.