4. Data types, data structures and algorithms Flashcards
What is Polymorphism?
What is Binary?
Binary is the representation of data using 0’s and 1’s. If a number is being represented this is called Base-2.
What is Hexadecimal?
Hexadecimal is the representation of numbers using Base-16. Hexadecimal is commonly used as a compact representation of large numbers. For example Hexadecimal is used to represent colours, and memory addresses.
What is the difference between a Signed and Unsigned number?
A Signed number can store both positive and negative values, an Unsigned number can only store positive values.
Define the following data units: bit, byte, Kilobyte (Kb), Kibibyte (Kib), Megabyte (Mb), Mebibyte (Mib), Gigabyte (Gb), Gibibyte (Gib), Terabyte (Tb), Tebibyte (Tib).
bit - a single 0 or 1
byte - 8 bits
Kilobyte (Kb) - 1000 (10^3) bytes
Kibibyte (Kib) - 1024 (2^10) bytes
Megabyte (Mb) - 1,000,000 (10^6) bytes
Mebibyte (Mib) - 1,048,576 (2^20) bytes
Gigabyte (Gb) - 1,000,000,000 (10^9) bytes
Gibibyte (Gib) - 1,073,741,824 (2^30) bytes
Terabyte (Tb) - 1,000,000,000,000 (10^12) bytes
Tebibyte (Tib) - 1,099,511,627,776 (2^40) bytes
What is ASCII?
ASCII is the American Standard Code for Information Interchange. It is an encoding of American English characters using a 7-bit Binary encoding. The last bit is used as a Parity Bit. Extended-ASCII uses all 8-bits for encoding a character, doubling the number of available characters.
What is Unicode?
Unicode is a character encoding which builds on ASCII by supporting non-American text by using more bits per character. There are 8-bit (UTF-8), 16-bit (UTF-16) and 32-bit (UTF-32) versions.
What is an Array?
An Array is an ordered Data Structure which allows multiple values to be stored in a single Variable. Arrays are Static Data Structures, which means they are fixed in size when created. Arrays are highly efficient both in time (O(1)) and space.
What is a Record?
A Record is a Data Structure which allows a programmer to store related values together as named Attributes.
What is a Tuple?
A Tuple is an immutable ordered collection of values.
What is an Abstract Data Type?
An Abstract Data Type describes the behaviour of a Data Structure, but not how that behaviour is implemented.
What is the difference between a Static and Dynamic Data Structure?
A Static Data Structure is fixed in size or capacity when it is created, whereas a Dynamic Data Structure can increase in size to fit whatever Data is inserted.
What kind of Data Structure is described as First In First Out (FIFO), and what behaviours does it have?
A Queue is First In First Out, the data is removed from a Queue in the same order as it is added.
Data can be Enqueued, inserting at the rear of the Queue.
Data can be Dequeued, removing it from the front of the Queue.
Why is a Circular Queue preferable to a Linear Queue?
A Linear Queue is slow to Dequeue (O(n)) because all the data items must be shifted forwards. However, a Circular Queue uses two pointers to implement Dequeue faster (O(1)).
How do Priority Queues differ from Normal Queues.
Each inserted item into a Priority Queue has an associated Priority value. Items with higher Priority will be inserted ahead of items with lower Priority. So a Priority Queue is only First In First Out for items of equal Priority.