Representing Data Flashcards

1
Q

In what Language do computers operate in

A

Binary, 0s and 1s , everything we need to represent must be transformed in these 0s and 1s

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

What is string concatenation

A

String contentation occurs when you use an addition operator between two strings to combine them into one.

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

How does the addition operator act in different ways

A

It can perform addition on strings by combining them directly or it can computer the sum of numbers.

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

Within binary what do the 1 and 0 represent

A

1 represents that an electrical signal has been read or transmitted whereas a 0 is the privation of an electrical signal

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

What is a 64 bit computer

A

When the computer handles strings of 64 bits for transferring data. This results in double transfer speeds than previous 32bit machines

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

How many bits did computer utilise in the 1980s when Sonic was released

A

8 bits

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

What are the basic types of data supported by programming languages

A
  • Integers - whole numbers
  • Decimals - fractions
  • Strings - sequences of characters
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

How many bits are utilised to represent a character in a string

A

8 bits represenmting 256 different chracters
* The ASCII dataset uses 8 bits to represent 256 different character

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

What is unicode

A

An alternative to ASCII useful for other languages and supports more than 8 bits per character allowing much more options

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

What is meant by a denary base number system

A

A number system that is commonly utilised by humans such that a number 123 = 1 x 100 + 2 * 10 + 3 * 1, it utilises 10^n+1 to move a position with 10 combinations per space

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

What is a base 2 number system

A

A base 2 number system utilises 2 possibilities per space and 2^n+1 to move each position up. Such that 0110 = 6

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

What are some benefits of utilising binary in a computer system

A

Much hardware that is used with computers such as HDD and CDs that engrave pits to represent 1 and absence of for 0.
Similarly systems experience a lot of noise which can alter the states, if there are more states this will result in a higher likelihood of errors

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

What is the range of an 8 bit number system

A

0 - 255

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

What is hexadecimal notation

A

It is taking each group of four bits and representing it with a single digit

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

Hexadecimal

A

0000 0 0
0001 1 1
0010 2 2
0011 3 3
0100 4 4
0101 5 5
0110 6 6
0111 7 7
1000 8 8
1001 9 9
1010 10 A
1011 11 B
1100 12 C
1101 13 D
1110 14 E
1111 15 F

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

How do we represent negative numbers in sign bit representation

A

Utilising the left most bit as a sign bit, 0 indicated positive and 1 indicated a negative.

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

What is the sign magnitude representation

A

It utilises the left most bit as a sign 0 being positive and 1 being negative, the rest of the bits represent their usual value

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

What are the benefits of using a sign magnitude bit

A

Allows us to see if a number is negative or positive in value by evaluating the left most bit

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

What happens to the range of bits when implementing sign magnitude bits

A

overall representation of numbers remains the same however two expressions for 0 and there is positive number impacted
2^8 = 0 -255 = 256 nums
2^8 = 2^8-1 = -127 – 127 = 256 nums
as 1 bit is used for sign magnitude

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

What is a negative implication of using the sign magnitude representation

A

There are two representations of zero such that positive 0 = 0000 and negative 0 would be expressed as 1000.
Therefore the n bit representation has only ((2^n) -1) different values

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

What is Twos complement

A

A more modern way of representing negative integers in a computer system such that the left most bit on represents a negative minimum value

22
Q

What is the range in twos complement

A

The range in twos complement would be (+2^(n-1) -1) to (2^(n-1))
such that in a 4 bit system with twos complement the range would be from 7 to -8

23
Q

What is overflow error?

A

In the computation of bit strings often there is a remainder bit that is ignored, skewing the result of the calculation.

24
Q

What are floating point numbers?

A

They are a solution to the problem that computers faced with expressing real numbers, that is continous data expressed in a limitted descrete format ignoring recurring decimals such as 0.3. These finite approximations are utilised instead.

25
Q

How will there be infintely many non represent able reals between any two floating point numbers

A

take some x and x’ such that they differ by the smalles amount allowed in our systems representation. Between x and x’ there will be a y which is a non representable real. between x and y there is another z and between y and x’ another a. This will result in a recursive issue and an infintely amount of on representable reals between two floating point numbers

25
Q

What is a rounding error

A

When utilising floating point numbers there is a small remainder often given by the computer rounding due to the previous issue that it cannot truly represent real numbers. If the rounding error becomes too noticeable due to multiple computiations we may actually recieve an unnacceptable result as a computation

26
Q

What is a numerically unstable calculation

A

When the rounding errors only affect the last few decimal places they can begin to grow during sequences of calculations resulting in the expected result being skewed

27
Q

Why would it be an issue to use floating point data types in an accounting software? What alternatives can we pose

A

The rounding error, numerically unstable calculations from floating point numbers can result in a level of uncertainty being introduced when it is unnecessary.
As an alternative we may introduce pennies stored as integers, at the end we can divide our results by 100 to limit uncertainty

28
Q

Explain this error posed by the program?
First number? 0.1
Second number? 0.2
Sum is 0.30000000000000004

A

As the computers do not have an exact representation of 1/10 it will approximate it to the closest value, in this case the value approximated too carries small decimal value which is expressed in the final calculation.

29
Q

What is the string data type in java

A

It is an array of characters

30
Q

Boolean values

A

True or False values often represented as a single byte, the smallest sequence of bits that can be fetched from RAM with the quickest efficiency

31
Q

Pigeonhole model of RAM

A

It is that the slots within the RAM act as slots for storing single bytes that are numbered and locations are noted to fetch and control what is transmitted to and fro them. Each pigeonhole is allocated a permanent number called its address

32
Q

What is a variable declaration

A

It is denoting the name and datatype of the variable before it is utilised

33
Q

What is a valid identifier

A

It is the name of the variable and must fit the code that is start with a letter. idenitifiers in java are case sensitive. If more than two words are utilised the second word and subsequent words are capitalised.

34
Q

What is the convention for writing class names?

A

That they begin with a capital letter

35
Q

What occurs at the declaration stage of a variable when denoting the variables type

A

It creates a box large enough to store values of the given type. And associates the idenitifier with the box storing a given value.

36
Q

What is the assignment stage of a variable

A

It is assigning a value of the given data type into the box we initialising, finally this process is known as intialisation, when the variable has been declared and assigned

37
Q

Operator precendence

A

It is the idea that some operators have precedence in performing over others such that 2 + 5 * 2 = 12 and not 14.

38
Q

What is the general convention when specifying order of calculations in java

A

Due to the 14 different operator precendence levels it is preferablet to utilise brackets

39
Q

How can you compare the lexicographical ordering of two strings in java

A

Utilising the first.compareTo(second) whicil will return a negative int if first is less than second, postive if greater and zero if theyre the same

40
Q

What is the difference between | and || in java

A

acts as a logical OR the || double stroke version represents a short circuit or where the left statement is evaluated first

41
Q

what is the difference between & and && in java

A

the && acts similarly as a logical AND with a short circuit feature evaualting the left statement first

42
Q

how does a conditional triadic operator work

A

predicate expression ? then expression: else expression
int b = 20 + ( (a < 0) ? -a : a); intialise b as twenty plus some conditional value

43
Q

What is the result of the assignment operator

A

It is that the value has been assigned

44
Q

What associative are the assignment operators

A

They are right associative which means that a string of assignments is evaulated right to left not left to right.

int a, b, c;
a = b = c = 35;
(a = (b = (c = 35)));

45
Q

What is a side effect of an expression

A

A side effect of an expression is that it appears to be other than it is , such that if we assign a = a +1 we are not mathemetically asserting a is itself plus 1 but a is assigned to the value of (a +1) which is 36 such that a = 36.

46
Q

What are op and becomes operators

A

They are methods of simplifying recalling a variable when assigning it a value

47
Q

Incrementing have special operators that are included within java

A

++ – are allowing incrementation and decrementation

48
Q

What is meant by prefix and postfix form

A

the same operators will act differently dependant upon the position of the operator
++ and –

49
Q

How does the prefix form work as

A

It will