Chapter 6 - Data types Flashcards

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

What is a primitive data type?

A

One provided by a programming language

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

What are 4 primitive data types?

A

Integers,
Characters,
Booleans,
Strings

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

Def a character set

A

A set of characters represented in binary by a computer

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

What mask and operation would you use to clear bits?

A

an AND operation where 1 preserves the bit and 0 clears the bit

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

What mask and operation would you use to set bits?

A

an OR operation where a 1 sets a bit and a 0 leaves a bit

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

What mask and operation would you use to toggle bits?

A

an XOR operation where a 1 toggles a bit and a 0 preserves a bit

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

What is the difference between Kibi and Kilo?

A

Kibi represents 1024 and Kilo is 1000. Kibi is base 2 increasing in powers of 10 whereas Kilo is base 10 increasing in powers of 3.

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

Name 3 character sets

A

ASCII, UNICODE (UTF-16), UTF-32

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

What is the formula for finding the range of numbers representable by a number of bits ā€˜nā€™ using twos complement?

A
  • 2^(n-1) - 1 to 2^(n-1) - 1
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is the MSB in binary and where is it?

A

The MSB is the most significant bit and is the one on the far left.

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

How does sign and magnitude work when representing negative numbers?

A

The most significant bit is simply replaced with a sign bit. 0 being positive and 1 being negative

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

Why is floating point binary necessary when fixed point already exists?

A

It is much more flexible and accessible than fixed point and can create much larger numbers than fixed point binary can.

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

Why are fixed point binary numbers bad?

A

They have a reduced range and precision for the number of bits used

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

What will the first bit after the decimal point be in a normalised positive number?

A

The sign but will be 0 and the msb always 1

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

What will the first bit after the decimal point be for a normalised negative number?

A

The sign bit will always be 1 and the msb always 0

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