13: Data Types Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

What are 5 kinds of data type?

A

String, character, float, boolean, integer

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

What is meant by a primitive data type?

A

Any basic data type provided by a language as a fundamental building block

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

What is an integer?

A

Any positive or negative whole number

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

What is a real/float?

A

Any positive or negative real-world quantity that can be expressed as a number

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

What is a string?

A

A collection of characters

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

What is a boolean data type?

A

Used to represent one of two truth values associated with logic and Boolean algebra: True and False

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

What is meant by casting?

A

Converting from one data type to another

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

What are the highest and lowest numbers that can be represented using Sign and Magnitude?

A

127 and -127

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

What are some rules to follow to represent a number in two’s complement?

A
  • Write out positive version of the number
  • Starting from the right-most digit (LSB) copy each of the digits exactly as they appear, up and including the first 1
  • From that point on, swap the digits
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

How do you do binary subtraction?

A
  • Make the second number using two’s complement

- add

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

What is the advantage of using floating point binary instead of normal binary?

A

gives greater flexibility as the range and precision of the numbers that can be stored in the same number of bits

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

How does range relate to accuracy in floating point binary?

A
  • the more bits assigned to the whole number part of the mantissa, the larger the number that can stored, but at the cost of accuracy of the fractional part
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is the mantissa?

A

Number itself

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

What is the exponent?

A

The position of the binary point in the number

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

What do positive normalised numbers start with?

A

01

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

What do negative normalised numbers start with?

A

10

17
Q

What steps would you take to convert 3.5 into a normalised floating point binary number?

A
  • Write out 3.5 on a standard fixed-point number line
  • Move the binary point so it moves between the 0 and the 1 (it is positive)
  • As the binary point moved 2 to the left, the exponent must be -2