1.4 Data Flashcards
Data Types Data Structures Boolean Algebra
What data type should be used for storing a phone number like 07574893758?
- String
Perform an AND mask on the binary numbers:
10101101
01011011
00001001
What data type stores a collection of characters?
String
Add the two binary numbers:
01011011
00111010
Give your answer in decimal.
149
What is the decimal 45 in binary? Give your answer as a byte.
00101101
What is the hexadecimal 2E in decimal?
46
What is the hexadecimal in binary? Give your answer as a byte.
01000101
Which data type stores just TRUE and FALSE?
Boolean
What is -5 in sign magnitude binary? Give your answer as a nibble.
1101
What does the binary 01101100 represent in hexadecimal?
6C
What is the effect of a logical shift left by one place?
The value is doubled
What is the two’s complement binary 10101101 in decimal?
-83
The binary 0011010000110 is a floating point number with a single-bit sign, 8-bit mantissa and 4-bit exponent. What is the number in decimal?
52
Perform a logical shift right two places on the binary number 01101010 and convert your result to decimal.
26.5
Perform an XOR masking on the binary numbers:
01010101
10111011
11101110
Which of the following is not a character? A) 8 B) R C) % D) 43
- D) 43
The binary 1100110000011 is a floating point number with a single bit sign, 8 bit mantissa and 4 bit exponent. What is the number in decimal?
-9.5
What is an array?
- An ordered, finite set of elements of a single type.
What type of array is a linear array?
- A one dimensional array
How can you visualise a two dimensional array?
- You can visualise it as a spreadsheet/table
How can you visualise a three dimensional array?
- A three dimensional array can be visualised as a multi-page spreadsheet
What is a record also known as?
- A row in a file
What is a record made up of?
- A record is made up of fields
How can you select a field from a record using pseudocode?
-recordName.fieldName
What is the definition of a list?
- A data structure consisting of a number of items, where the items can occur more than once.
What are the main differences between arrays and lists?
- Lists can store data non-contiguously whereas array store data in order.
- Lists can store data of more than one data type.
What is a tuple?
- An immutable, ordered set of values of any type.
What is the difference between a tuple and an array?
- Tuples are initialised using regular brackets instead of square brackets.
What is a stack?
- A last in first out data structure, where items can only be removed from and added to the top of the list.
Give an example of where stacks may be used.
- Back button in a web page
- Undo buttons (ctrl z)
What is a queue?
- A first in first out data structure, where items are added to the end of the queue and removed from the front of the queue.
What does the operation isEmpty() do?
- Check to see if the stack is empty
What does the operation push(value) do?
- Adds a new value to the top of the stack
What does the operation peek() do?
- Returns the top value of the stack without removing it
What does the operation pop() do?
- Returns and removes the value at the top of the stack
What does the operation size() do?
- It returns the size of the stack
What does the operation isFull() do?
- Checks to see if the stack is full.
What does the operation enQueue(value) do?
- Adds the value to the end of the queue
What does the operation deQueue() do?
- Removes the item from the end of the queue
What does the operation isEmpty() do?
- It checks to see if the queue is empty
What does the operation isFull() do?
- Checks to see if the queue is full
Simplify the following Boolean expression:
!B . !(A+B)
- !B . !A
What Boolean operation is represented with an overline?
- NOT
Which has the highest order of precedence? AND, OR or NOT?
NOT
Complete the Boolean identity:
C . C =?
C
Which Boolean operation is represented with a dot?
AND
Simplify the following Boolean expression:
(C + (B + !B)) . D
D
Complete the Boolean identity:
B . 1 = ?
B
Apply one of DeMorgan’s Laws to the following Boolean expression:
!A . !B
!(A+B)
Which Boolean operation is represented with a plus?
OR
Apply one of DeMorgan’s Laws to the following Boolean expression:
!(A . C)
!A + !C
Apply a distributive rule to the following Boolean expression:
B , (A+C)
B.A + B.C