1.4 Data types, data structures and algorithms

Cards (11)

  • Give one similarity between ASCII and Unicode
    • Both (use binary) to represent characters
    • Both are character sets
    • The first 7/8 bits of Unicode is the same as ASCII (overlaps)
  • Give two differences between ASCII and Unicode
    • ASCII has fewer characters (128/256)
    • Unicode has more characters
    • ASCII is 7/8 bits whereas Unicode can be larger 16/32 / can have variable sized characters
    • ASCII limited to Latin / English / European characters
    • Unicode can represent other symbols (e.g. Chinese/Emojis)
  • Compare the efficiency of a binary search tree to a linked list when searching for data.
    • Binary tree more efficient than linked list
    • Does not need to check every value
    • tree removes half values each time
  • Describe a mask that could be applied to an 8-bit number to ensure that:
    • the most significant bit is always set to 1
    • all other bits remain unchanged
    • 1000 0000
    • OR
  • State the purpose of a D-type flip-flop circuit
    • Delay / store a value of 1 bit when a signal is given
  • Describe the inputs and outputs used by a D-type flip-flop circuit, explaining how the inputs are used to control the outputs.
    • Data input
    • Clock input
    • Q output When clock input goes high
    • Q changes to D
    • NOT Q is reverse of Q
  • The database previously stored reviews using the ASCII character set. ASCII uses 1 byte per character. It is decided to switch to the Unicode UTF-32 character set which uses 4 bytes per character.
    Give an advantage and disadvantage of changing character sets from ASCII to Unicode UTF-32.
    Advantage
    • More characters can be represented
    • may include foreign alphabets
    • may include emojis
    Disadvantage
    • Reviews take up more storage (4 times their previous storage size)
  • A programmer is writing software for a firewall. The following data is also stored about each website: • Access level needed (1-4) • If it is available all the time (true) or just lunch times and out of work hours (false). So a website which is available to users of access level 2 and above, all the time, would have the details [2, true] stored. A website accessible to users of access level 3 and above, only outside of work hours, would have the details [3, false] stored.
    State the name of a data structure that could be used to store a single site’s details.
    • tuple /record /list
  • Describe what is meant by the term ‘ASCII’.
    • American Standard Code for Information Interchange
    • A character set
    • Maps values to characters
    • Uses 7-bits/ 8-bits per character
  • Describe what is meant by the term ‘linked list'
    • A dynamic/data structure
    • Each node/item consists of data and pointer
    • Pointer gives location of next node.
  • A coach company offers tours of the UK. The tour is amended. The new itinerary is: London, Oxford, Manchester then York.
    Explain how Birmingham is removed from the linked list and how York is added. You may use the diagram below to illustrate your answer.
    • Oxford pointer changed to bypass Birmingham and point to Manchester.
    • A node is created holding the data York/York is placed is next free space/node/item
    • Manchester remains in original position and pointer changed to point to the York node.
    • The York node points to null (or terminator).