Data Types Flashcards

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

What is an Integer

A
  • A whole number
  • Zero is an integer
  • Negative numbers are integers
  • Can’t have a fractional part
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is a Real Number

A
  • Positive or negative numbers
  • Can have a fractional part
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is a Character

A
  • A single symbol used by a computer
  • The letters A to Z
  • The numbers 0​ to 9
  • Symbols like %, £, and,
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is a String

A
  • A collection of characters
  • Can be used to store a single character or many characters in succession
  • Don’t cut off leading 0​s like numeric types
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is a Boolean

A

Value restricted to True​ and False

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

What are the names for how binary is stored

A
  • Bit - single binary digit
  • Nibble - 4-bits grouped together
  • Byte - 8-bits or 2-nibbles grouped together
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What are the Binary Addition Rules

A
  • 0 + 0 = 0
  • 0 + 1 = 1
  • 1 + 0 = 1
  • 1 + 1 = 0 carry 1
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Convert the following Binary to Decimal

  • 0110 1010
  • 0000 1000
  • 0001 1001
  • 1100 0010
  • 0101 0100
A

0110 1010 - 106

0000 1000 - 8

0001 1001 - 25

1100 0010 - 194

0101 0100 - 84

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

Convert the following Decimal to Binary

  • 10
  • 84
  • 160
  • 53
  • 137
A

10 - 0000 1010

84 - 0101 0100

160 - 1010 0000

53 - 0011 0101

137 - 1000 1001

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

What are the two ways negative numbers are represented in binary

A
  • Sign magnitude
  • Two’s complement
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

How do you convert a Binary Number into a negative number using Sign Magnitude

A
  • A leading 1​ is added for a negative number
  • A leading 0​ is added for a positive number
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Convert the decimal number -21 into a two’s complement binary number (Method)

A

128 64 32 16 8 4 2 1

0 0 0 1 0 1 0 1

One’s Complement (Flip) - 1 1 1 0 1 0 1 0

Two’s Complement (+1) - 1 1 1 0 1 0 1 1

Answer = 1110 1011

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

Subtract the binary number

0000 1111 from 1001 0100

A

Two’s Complement 0000 1111 = 1111 0001

Add the two numbers - 1001 0100

+ 1111 0001

=[1] 1000 0101

Answer = 1000 0101

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

Compare Decimal and Hexadecimal Numbers

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

Convert the binary 1111 0101 into hexadecimal

A

Split into 4 - 1111 0101

Work out the value of both parts - 1111 = 15 0101 = 5

Convert into Hexadecimal - 15 = F 5 = 5

Answer = F5

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

What is the Mantissa and Exponent of 123

A

Mantissa - 1.23

Exponent - x 10^2

17
Q

Convert the decimal number 50 into a two complement floating point binary number using a 8-bit Mantissa and a 4-bit Exponent

A

Write in Binary - 1 1 0 0 1 0

Normalise the number (reposition decimal point in front of first 1) - 0.110010 x 2^6

Answer =

Mantissa = 01100100 Exponent = 0110

18
Q

Convert the decimal number 0.375 into a two’s complement floating point binary number using a 4-bit Mantissa and 4-bit Exponent

A

Write in Binary - 0 . 0 1 1

Normalise the number - 0. 1 1 x 2^-1

Answer =

Mantisaa = 0110 Exponent = 1111

19
Q

Convert the decimal number -21 into a two’s complement floating point number using a 8-bit Mantissa and 4-bit Exponent

A

Write in Binary - 1 0 1 0 1

Normalise the number - 0. 1 0 1 0 1 0 0 x 2^5

Two’s Complement - 1. 0 1 0 1 1 0 0

Answer =

Mantissa = 1010 1100 Exponent = 0101

20
Q

Convert the floating point number 011100 001 into decimal

A

Convert Exponent into Decimal = 1

Truncate (opposite of Normalise) the Mantissa = 0. 1 1 1

Move point back 1 space = 1. 1 1

Convert into Decimal - 1.75

Answer = 1.75

21
Q

How do you add floating point numbers

A
  • To add floating point binary numbers, their exponents need to be the same
  • Then add the mantissas
  • Finally, normalise the result if required
22
Q

How do you subtract floating point numbers

A
  • Involves converting to two’s complement and adding
  • The exponents must be the same
  • Use binary addition on the mantissas
  • Normalise the result if required
23
Q

What is a Logical Shift

A
  • A logical shift involves moving all of the bits in a binary number a specified number of places to the right or to the left
  • Can be thought of as adding a number of leading or trailing zeros
  • The result is a multiplication (or division if shifting right) by two to the power of the number of places shifted
  • A logical shift left by one place has the effect of doubling the initial number
24
Q

What happens when you mask a binary number

A

When you use binary numbers by combining them with a logic gate

25
Q

What is a Character Set

A
  • A published collection of codes and corresponding characters
  • Can be used by computers for representing text
  • Two widely used character sets are ASCII and Unicode
26
Q

What is ASCII Code

A
  • American Standard Code for Information Interchange
  • The leading character set before Unicode
  • Uses 7 bits to represent 128 different characters
  • ASCII soon came into trouble when computers needed to represent other languages with different characters
27
Q

What is Unicode

A
  • Solves the problem of ASCII’s limited character set
  • Uses a varying number of bits allowing for over 1 million different characters
  • Many characters have yet to be allocated
  • Enough capacity to represent a wealth of different languages, symbols, and emoji