1.4.1a - primitive data types (y12) Flashcards

1
Q

What is a data type?

A

The classification of data (e.g. integer, boolean, string).

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

What is an integer?

A

A whole number (e.g. -2, 0, 5).

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

What is a real/float?

A

A number with decimals (e.g. 3.14).

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

What is a character?

A

A single letter, number, or symbol.

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

What is a string?

A

A sequence of characters (e.g. “Hello”).

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

What is a boolean?

A

A value that is either TRUE or FALSE.

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

Why are data types important?

A

They define what operations can be performed on data.

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

What is casting?

A

Changing a variable from one type to another.

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

How do you cast to integer in Python?

A

int(x)

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

How do you cast to string in Python?

A

str(x)

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

What is data validation?

A

Checking that input data has the correct format/type.

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

What is overflow?

A

When a value exceeds storage capacity of its data type.

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

What is underflow?

A

When a value is too small for its data type to represent.

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

What is truncation?

A

Cutting off digits after the decimal point.

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

What is rounding?

A

Adjusting a number to the nearest whole or decimal place.

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

What is the difference between ASCII and Unicode?

A

ASCII uses 7/8 bits, Unicode supports more characters globally.

17
Q

What is a bit?

A

A binary digit – 0 or 1.

18
Q

What is a byte?

19
Q

How many values can 1 byte represent?

A

256 different values (0–255).

20
Q

What data type would you use for age?

21
Q

What data type would you use for price?

A

Float/Real.

22
Q

What data type would you use for a postcode?

23
Q

Why use booleans?

A

To store logical values and control decisions.