A Level OCR Computer Science 1.4.1 Data Types

0.0(0)
studied byStudied by 1 person
0.0(0)
full-widthCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/62

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

63 Terms

1
New cards

What is a primitive data type

Basic type is a data type provided by a programming language as a basic building block

2
New cards

What are the common primitive data types (5)

Integer

Floating point/ real

Character

String

Boolean

3
New cards

What do integers hold

Whole numbers

4
New cards

What do floating points/ reals hold

A number with a fractional part

5
New cards

What do characters hold

A single alphanumeric character or special symbol

6
New cards

What do strings hold

Multiple alphanumeric or special symbols

7
New cards

What do booleans hold

The value 0 or 1 sometimes represented by False or True

8
New cards

Why do we use binary

Because computers can only represent values as on or off; because they are reliant on electricity. It is also very reliable ; the computer always receives the correct data.

9
New cards

Why doe we use hexadecimal(4)

Much easier to read than a long string of binary

Quicker to write and take up less space

Less chance of making an error while typing

Very easy to convert to and from binary

10
New cards

What is hexadecimal used for (4)

Colours

MAC addresses

Assembly languages

Machine Code

11
New cards

Define Bit

the smallest unit of data in a computer, holds either a 0 or a 1

12
New cards

Define nibble

A sequence of 4 bits

13
New cards

Define Byte

A sequence of 8 bits

14
New cards

How many bits are required to hold a value of 2^n or below

n

15
New cards

What are the prefixes for bytes

Kilobyte - kB - 10^3

Megabyte - MB - 10^6

Gigabyte - GB - 10^9

Terabyte - TB - 10^9

Kibibyte - kiB - 2^10

Mebibyte - Mib

16
New cards

How do character sets work

Each single alphanumeric and special character is represented by an individual binary value

17
New cards

What is ASCII?

7 bit character set that can hold 128 characters used mostly for english

18
New cards

What is extended ASCII

8 bit character set that can hold 256 characters with extra characters for different langauages

19
New cards

What is Unicode?

16 or 32 bit character set that can hold characters for many languages

20
New cards

What is the comparison operator for equal

==

21
New cards

What is the comparison operator for not equal

<> or !=

22
New cards

What is the comparison operator for greater than

>

23
New cards

What is the comparison operator for less than

24
New cards

What is the comparison operator for greater than or equal

>=

25
New cards

What is the comparison operator for less than or equal

<=

26
New cards

What happens when the result of a binary cacluation is greater than the assigned number of bits can hold

Binary overflow error

27
New cards

What is the range of values a binary number can hold with n digits

0 - 2^n -1

28
New cards

What is the most significant bit of a binary number

The first bit

29
New cards

What is sign and magnitude

Method where the most significant bit represents either + (0) or - (1)

30
New cards

Why is sign and magnitude not used

Normal arithmetic does not work properly when using it, meaning more complicated circuits would have to be designed

31
New cards

What is two's complement?

Method by which the most significant bit is changed from positive to negative

32
New cards

How to convert a number to negative using twos complement

Traverse from right to left until you find the first 1, after this one flip the remaining bits

33
New cards

What is the range of a twos complement number with n bits

-(2^(n-1)) <-> 2^(n-1) -1

34
New cards

What is fixed point binary

Method of storing reals which uses a specified number of bits where the decimal point is fixed

35
New cards

Advantage of fixed point binary

Easier to process

36
New cards

Disadvantage of fixed point binary

Cannot represent the range or accuracy of numbers that may be required

37
New cards

How does the accuracy of a fixed point binary number vary with range

Inversely

38
New cards

What is floating point representation

A method where the decimal place in a number can vary based on the exponent.

39
New cards

What is the mantissa?

The part of a floating point number that holds the actual number

40
New cards

What is the exponent

The part of a floating point number that sets the position of the floating pint

41
New cards

How does floating point work

Floating point starts in between 1st and 2nd bit and exponent moves point to the right x times when the exponent is equal to x. If x is negative then to the left

42
New cards

What is normalisation

The process of moving the floating point to achieve the maximum level of precision for a given number of bits

43
New cards

How do we normalise

Make the first digit after the binary point a significant digit (e.g. 1 id msb is 0 and 0 if msb 1) and changing the exponent accordingly

44
New cards

What is bit manipulation

The changing of the values in a binary value using some sort of operation

45
New cards

How can we manipulate bits

Shifts

Bitwise operations

46
New cards

Why are bits manipulated

Error detection and correction algorithms

Data encryption

Data compression

47
New cards

What is a logical shift right

The shifting of bits to the right by one place, putting the least significant bit into the carry bit

48
New cards

What is a logical shift left

The shifting of bits to the right by one place, putting the most significant bit into the carry bit

49
New cards

What is the purpose of logical shifts

Right can be used to examine least significant bit

Right divides by 2 left multiplies by 2

50
New cards

What is the problem with logical shifts

Will not work with twos complement numbers as number may lose its negative nature

51
New cards

What is an arithmetic shift right

The shifting of bits to the right by one place, putting the least significant bit into the carry bit. The new msb is the value of the old msb

52
New cards

What is an arithmetic shift left

The shifting of bits to the left by one place, putting the second most significant bit into the carry bit to preserve the sign bit. A 0 fills on the left

53
New cards

What is a circular shift right

LSB moved into carry bit, carry bit moved into MSB

54
New cards

What is a circular shift left

MSB moved into carry bit, carry bit moved into LSB

55
New cards

When does and AND return true

when both inputs are true

56
New cards

When does an OR return true

When either or both inputs are true

57
New cards

When does a XOR return true

When either but not both inputs are true

58
New cards

When does a NOT return true

When the input is false

59
New cards

When does a NOT return false

When the input is true

60
New cards

What is a boolean mask

A set of numbers that is used with an original number and a boolean operator to set, clear or toggle the input of bits

61
New cards

What is an AND bitwise used for

Clear a particular bit, leaving others unchanged

62
New cards

What is an OR birwise used for

Set a particular bit leaving others unchanged

63
New cards

What is a XOR bitwise used for

Toggle a particular bit leaving others unchanged