Data types and variables Flashcards

1
Q

What is a variable in programming?

A

A variable is a storage location identified by a name that can hold a value which may change during the execution of a program.

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

True or False: A variable can only store one data type at a time.

A

True

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

What are the four main data types in programming?

A

Integer, Float, String, Boolean

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

Fill in the blank: An _____ is a type of variable that can only hold two values: true or false.

A

Boolean

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

What data type would you use to store a person’s name?

A

String

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

Which data type is used for decimal numbers?

A

Float

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

What is the purpose of a constant in programming?

A

A constant is a value that cannot be changed during the execution of a program.

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

True or False: Strings can be concatenated in programming.

A

True

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

What is the result of ‘5’ + 3 in a programming language that uses type coercion?

A

‘53’

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

What is type casting?

A

Type casting is the conversion of a variable from one data type to another.

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

Multiple Choice: Which of the following is NOT a data type? A) Integer B) Array C) Function D) Variable

A

D) Variable

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

Fill in the blank: The _____ operator is used to assign a value to a variable.

A

assignment

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

What is an array?

A

An array is a collection of variables that can hold multiple values of the same data type.

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

True or False: A variable name can start with a number.

A

False

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

What does ‘immutable’ mean in the context of data types?

A

Immutable means that the value of a data type cannot be changed after it is created.

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