Computer science

Subdecks (1)

Cards (198)

  • User-defined types
    New data types created from existing data types to extend the flexibility of the programming language
  • Non-composite types

    • Can be defined without referencing another data type
    • Can be a primitive type or a user-defined type
  • Enumerated
    A user-defined non-composite data type with a list of all possible values that is ordered
  • Enumerated type
    • TYPE TMonth = (Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec)
    • DECLARE ThisMonth : TMonth
    • ThisMonth ← May
    • ThisMonth > Feb
  • Pointer
    A user-defined non-composite data type that stores addresses/memory locations and indicates the type of data stored
  • Pointer type
    • TYPE TMyPointer = ^Integer
    • DECLARE IntegerPointer : TMyPointer
    • ValuePointedTo ← IntegerPointer^
  • Composite data types
    A user-defined data type that is a collection of data that can consist of multiple elements of different or the same data types
  • Set
    A data type that allows storing a finite number of different values that have no order
  • Record
    A collection of related items that may have different data types
  • Record type
    • TYPE TStudentRecord
    • DECLARE FirstName : STRING
    • DECLARE LastName : STRING
    • DECLARE Absences : INTEGER
    • DECLARE Class : STRING
    • ENDTYPE
    • DECLARE Student1 : TStudentRecord
    • Student1.FirstName ← "John"
    • Student1.LastName ← "Doe"
    • Student1.Absences ← 0
    • Student1.Class ← "A2 Level"
  • Class/object
    A data type that has properties and methods for an object
  • Choose and design an appropriate user-defined data type for a given problem
  • Serial file organisation
    • Records stored in chronological order/order they were added in
    • New records added to end of file
    • Sequential Access only
    • Reorganisation not needed when new record added
  • Sequential file organisation
    • Records (in the file) are ordered based on the key field
    • A new version (of the file) has to be created to update the file
  • Random file organisation
    • Records are stored in no particular order within the file
    • There is a relationship between the key of the record and its location within the file
    • Updates to the file can be carried out directly
  • Sequential access
    • Start at the beginning of the file
    • Check records linearly until the desired record is found
    • Process/update records as required
    • EOF found
  • Direct access
    Used for sequential and random files
  • Describe and use different hashing algorithms to read from and write data to a random/sequential file
  • Binary floating-point real numbers
    • Use two's complement form
    • Increase in precision as the number of bits in the mantissa has increased
    • Reduction in precision as the number of bits in the mantissa has decreased
    • Increase in range as the number of bits in the exponent has increased
    • Reduction in range as the number of bits in the exponent has decreased
  • Normalisation of floating-point numbers
    • To store the maximum range of numbers in the minimum number of bytes/bits
    • Minimises the number of leading zeros/ones represented
    • Maximises the number of significant bits/potential precision/accuracy of the number for the given number of bits
    • Enables very large/small numbers to be stored with accuracy
    • Avoids the possibility of many numbers having multiple representations
  • Real numbers can have a fractional part, but the fixed length of storage means binary numbers can't represent all fractions precisely
  • Underflow
    Following an arithmetic/logical operation, the result is too small to be precisely represented in the available system
  • Overflow
    Following an arithmetic/logical operation, the result is too large to be precisely represented in the available system
  • Protocols
    • Set a standard for communication
    • Enable communication/compatibility between devices from different manufacturers/platforms
  • If two devices were sending messages to each other but using different protocols, they would not be able to communicate properly
  • Protocol implementation as a stack
    Each layer has its own functionality
  • TCP/IP protocol suite
    • Four Layers: Application, Transport, Internet, Link
    • Application provides user services
    • Transport handles packets, sequences them, adds headers, sends to Internet layer
    • Internet identifies intended network and host, routes packets independently
    • Network Access handles how data is physically sent, ensures correct protocols are followed, enables connection to the physical medium
  • Protocols and their purposes
    • HTTP(S) for sending and receiving web pages/hypertext documents
    • FTP for sending and receiving files over a network
    • SMTP for sending/uploading emails
    • POP(3) for receiving/downloading emails
    • IMAP for receiving/downloading emails
    • BitTorrent for peer-to-peer file sharing
  • Circuit switching
    • A dedicated circuit is established before transmission starts and released after
    • Data is transferred using the whole bandwidth over the same route
    • Used where a dedicated path needs to be sustained, for real-time communication, private data networks
  • Circuit switching benefits
    • Whole bandwidth available
    • Dedicated communication channel increases quality
    • Data transmitted at fixed rate
    • No waiting time at switches
    • Suitable for long continuous communication
    • Fast data transfer
    • Data arrives in same order as sent
    • Data can't get lost
    • Better for real-time
    • Simple data transfer
  • Circuit switching drawbacks
    • Dedicated connection makes it impossible to transmit other data even if channel is free
    • Not very flexible
    • No alternative route in case of failure
    • Time required to establish physical link can be too long
    • Dedicated channels require whole bandwidth, can't be shared
  • Packet switching
    Data is split into packets, each given its own route, routing depends on congestion, packets may not arrive in order
  • Packet switching benefits
    • Ensures accurate delivery of message
    • Missing packets can be detected and re-sent
    • Resilient to network changes
    • Path available to other users, doesn't use whole bandwidth
    • Better security as packets hashed and sent by different routes
  • Packet switching drawbacks
    • Time delays to correct errors
    • Network problems may introduce errors in packets
    • Requires complex protocols for delivery
    • Unsuitable for real time transmission
  • Router function in packet switching
    • Examines packet header
    • Reads destination IP address
    • Accesses routing table to determine next hop
  • Types of electronic communication
    • email
    • text messages
    • documents
    • VOIP
  • Benefits of electronic communication
    • Accuracy - Ensures accurate delivery of the message
    • Completeness - Missing packets can be easily detected and a re-send request sent so the message arrives complete
    • Resilience - if a network changes the router can detect this and send the data another way to ensure it arrives
    • Path also available to other users // Doesn't use whole bandwidth //allows simultaneous use of channel by multiple users
    • Better security as packets hashed and sent by different routes
  • Drawbacks of electronic communication
    • Time delays to correct errors // Network problems may introduce errors in packets
    • Requires complex protocols for delivery
    • Unsuitable for real time transmission applications
  • Function of a router in packet switching
    1. Examines the packet's header
    2. Reads the IP address of the destination (from the packet header)
    3. Has access to a routing table
    4. Containing information about, e.g., available hops / netmask / gateway used
    5. And the status of the routes along the route
    6. Decides on the next hop / best route
    7. Sends the packet on its next hop
  • How packet switching is used to pass messages across a network, including the internet

    1. A large message is divided up into a group of smaller chunks of the same size called packets
    2. The packet has a header and a payload
    3. The header contains a source IP address, destination IP address (and sequence number)
    4. Each packet is dispatched independently
    5. And may travel along different routes / paths
    6. The packets may arrive out of order
    7. And are reassembled into the original message at the destination
    8. If packets are missing / corrupted a re-transmission request is sent