Variables and Data Types Flashcards

1
Q

When you create a veritable you must know the ____ you wish to use with it

A

Data. Is it a number? Boolean? Decimal?

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

What sorts of values can you assign a variable?

A

1) Intergers (Whole #s)
2) Decimals. (.5)
3) Floating point (1.5)
4) one character (a) or whatever
5) Multiple characters (String) “hello”
6) Boolean (true/false)

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

What is a Strongly Typed Language?

A

A language where you can not change the type of variable you are using.
If you assign a decimal variable, you CAN NOT use an integer or boolean.

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

What is a Weakly Typed Language?

A

A language where you can assign generic variables.

var = name can be whatever you want it to be.

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

Can you have spaces inside of a string literal?

A

Sure.

“Hello, world” is an example

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

Name the kinds of Data Types and give an example.

A

1) Strings - Written in quotes.
(ex) var carName=”Volco XC60”;
2) Numbers - Integers, decimals or floating(scientific)
(ex) var x1=34.00; or y=123e5; (12300000)
3) Booleans - True/False. Used in testing.
(ex) var x=true;
4) Arrays - Written with square brackets. Essentially variables with multiple possible values.
(ex) var cars=[“Ferrari”, “Acura”, “Cadillac”];
5) Object - They are like arrays but allow for more info. about one variable.
(ex) var darius = {firstName:”Darius”, age:”26”, sex:”male”};
6) typeof - not sure.. you can use these to find out what sort of variable you have.
(ex) typeof={name:’john’, age:”34’};
7) Undefined - Variable with no value.
(ex) var person;
8) Empty - variable with empty string.
(ex) var = “ “;

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