Data types Flashcards

(38 cards)

1
Q

What does an AND operator do? (Mask)

A

AND operator is used to clear a particular bit, leaves the other bits unchanged

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

AND 1 and 0 meaning

A

Use 1 to keep the number the same
Use 0 to change the number

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

What does an OR operator do? (Mask)

A

OR operator used to set a particular bit, leaves the other bits unchanged

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

OR 0 and 1 meaning

A

0 the keep the number the same
1 to change/set the number

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

What does a XOR operator do? (Mask)

A

XOR operator used to toggle a particular bit, leaves the other bits unchanged

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

XOR 0 and 1 meaning

A

1 toggles the number
0 keeps the number the same

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

And truth table

A

0+0=0
0+1=0
1+0=0
1+1=1

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

OR truth table

A

0+0=0
0+1=1
1+0=1
1+1=1

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

XOR truth table

A

0+0=0
0+1=1
1+0=1
1+1=0

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

What mask do you use to make lowercase

A

Apply OR mask
0010 0000

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

What mask do you use to make uppercase

A

AND mask
1101 1111

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

Normalised floating point rules

A

Mantissa always starts with:
01 for positive numbers
or
10 for negative numbers

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

Why should you use the correct data type

A

Different data types take up different amounts of memory. To optimise program performance it’s important to use the correct data type where possible

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

What are the different data types

A

Integer
Real/float
Boolean
Character
String

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

Define primitive data type

A

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

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

Define composite data type

A

Most languages allow more complex data types to be constructed from primitive data types

17
Q

Define integer

A

Integer data type represents any positive or negative whole nunber

18
Q

Define real

A

The real data type represents any positive or negative number including decimals or fractions

19
Q

Define character

A

The character data type represents a single character (symbol or letter)

20
Q

Define string

A

The string data type represents a collection of characters (not limited to letters)

21
Q

Define Boolean

A

The Boolean data type can be used to represent one of two truth values associated with logic

22
Q

Define casting

A

A way to convert one data type to another

23
Q

What is sign and magnitude

A

A way of representing negative numbers

24
Q

What does a positive number start with (S+M)

A

Positive numbers start with a 0

25
What does a negative number start with (S+M)
A negative number starts with a 1
26
What does the most significant bit represent (S+M)
It becomes a sign bit- so it no longer holds a value
27
What is the largest positive and negative number: (S+M)
Positive: 127 0111 1111 Negative: -127 1111 1111
28
Disadvantages of S+M
There is +0 and -0 Two different types of data that are being represented with one number Not useful for arithmetic
29
Advantage of S+M
Easy for humans to do
30
What do positive numbers start with (twos complement)
Always start with 0
31
What do negative numbers start with (twos complement)
Always start with a 1
32
What does the most significant bit represent (twos complement)
Represents a negative number
33
Positive binary number into negative twos complement method
1. Write out the positive version of the number 2. Starting from the right most bit copy each of the digits exactly as they appear up to and including the first 1 3. From this point swap every 1 for a 0 and every 0 for a 1
34
Advantage of twos complement
It is better for arithmetic
35
Define character set
A defined list of characters recognised by the computer hardware and software, with each character being represented by a single nunber
36
ASCII mean
American Standard Code for Information Interchange
37
How many ASCII bits
7
38
UNICODE bits
24 bit character set