IB CS Revision Notes
IB CS Revision Notes
1: Systems in Organisations
Topic 1.1.1: Identify the context for which a new system is planned
Considerations
Two important considerations when considering a new system’s context are:
The extent of the new system
The limitations of the new system
Example: What would be the context of introducing a new payment system for school trips?
Questions to consider:
Floppy disks
Parallel printer cables
Connections like PS2 and USB 1.0
Software:
Windows XP
Movie Maker
Computer Systems:
Amiga
Commodore 64
Merger
A combination of two entities or more, especially companies, into one.
Famous mergers
SaaS (Software-as-a-Service)
SaaS is a software distribution model in which a third-party provider hosts application and
makes them available to customers over the Internet.
SaaS does away with the traditional software installation, maintenance and management
approaches in favour of delivering cloud-based applications via the internet. With SaaS,
service provider partners shoulder the burdens of security, availability and performance.
Examples
Benefits of SaaS
SaaS is great for any organisation that wants to minimize its IT responsibilities and
costs.
SaaS is particularly well suited for small businesses. Instead of investing in additional
in-house server capacity and software licenses, companies simply can adjust their
SaaS subscription on a monthly basis.
There’s also a reduction in staff workload. In-house IT workers are liberated from the
tasks associated with on-premise hardware and software.
Because the IT infrastructure resides in the service provider’s data centre, the
organization can get back up and running immediately in the event of a service
outage or more dramatic disruption.
Drawbacks of SaaS
Companies that adopt multiple SaaS applications or plan to connect hosted software
with existing on-premise apps may encounter software integration headaches along
the way.
Security is another common concern: whenever sensitive company data and business
processes are entrusted to a third-party service provider, issues such as identity and
access management must be addressed.
Businesses must also consider the government compliance regulations inherent to
storing customer data in a remote data centre, i.e. laws might be different in different
countries.
Simpler is better
Users are non-technical people; they only need to know how to use the system.
Therefore, the user documentation does not involve detailed explanations of how
the system works.
Quality is important
The quality of the user documentation can greatly affect the rate of implementation of (how
fast users start using) the new system.
Formal classes
Users sitting in a classroom listening to an instructor who shows and explains
how to use the system.
This type of training is useful to train large amounts of staff as it is effective
and relatively cheap, but if the size of the classes is too big, there is little time
to deal with individual problems and questions.
Advantages:
Structured learning environment
Expert on hand to answer questions
Curriculum designed to teach all aspects, including ones that might be
misunderstood or difficult to grasp
Disadvantages:
Expensive – teachers, buildings and facilities needed
Rigid schedule and curriculum
Not much personalisation possible
Remote/Online training
An instructor training one user or a small group of users by some kind of
remote connection (Skype, Google Hangouts, Face time, etc.).
This is the most effective way of training as training can be suited to user's
needs and abilities, while being instructed by a professional that caters to
specific needs.
Advantages:
Structured learning environment
Expert on hand to answer questions
Curriculum designed to teach all aspects, including ones that might be
misunderstood or difficult to grasp
Flexible locations
Disadvantages:
Expensive – teachers & internet connection needed
Has to be computer-based
Redundancy:
Data redundancy is a condition created within a database or data storage
technology in which the same piece of data is held in two separate places.
This can mean two different fields within a single database, or two
different spots in multiple software environments or platforms.
Whenever data is repeated, this basically constitutes data redundancy.
Removable media:
Removable media is any type of storage device that can be removed from
a computer while the system is running.
Examples of removable media include CDs, DVDs and Blu-Ray disks, as
well as tapes and USB drives.
Removable media makes it easy for a user to move data from one
computer to another.
Offsite storage
An offsite backup is a backup process or facility that stores backup data or
applications external to the organization or core IT environment.
It is similar to a standard backup process but uses a facility or storage
media that is not physically located within the organization’s core
infrastructure.
Online storage
Cloud backup is a type of service through which cloud computing
resources and infrastructure are used to create, edit, manage and restore
data, services or application backup.
This is done remotely over the internet.
Cloud backup may also be called online backup or remote backup.
Update
An update is a software file that contains fixes for problems found by other users or the
software developer.
Installing an update fixes the code and prevents the problems from happening on your
computer.
Because updates fix problems with a program, they are almost always free and available
through the program or the company’s website.
Patches
A patch is a software update comprised code inserted (or patched) into the code of
an executable program.
Typically, a patch is installed into an existing software program.
Patches are often temporary fixes between full releases of a software package.
Patches may do any of the following:
Fix a software bug
Install new drivers
Address new security vulnerabilities
Address software stability issues
Upgrade the software
How to get updates
Manually (download and install them yourself)
Pro: Full control
Con: Time consuming
Automatically (software automatically contacts the developer, downloads and installs any
updates)
Pro: Don’t have to think/worry about updates, always up to date
Con: No control – bad update might crash the system
Continuous delivery
Continuous delivery is a software engineering approach in which teams produce
software in short cycles, ensuring that the software can be reliably released at any
time.
It aims at building, testing, and releasing software with greater speed and frequency.
The approach helps reduce the cost, time, and risk of delivering changes by allowing
for more incremental updates to applications in production.
Agile development
Agile software development describes an approach to software development under
which requirements and solutions evolve through the collaborative effort of self
organizing and cross-functional teams and their customers/end users.
It advocates adaptive planning, evolutionary development, early delivery, and
continual improvement, and it encourages rapid and flexible response to change.
Hardware
Computer hardware refers to the physical parts of a computer and related devices.
Internal hardware devices include motherboards, hard drives, and RAM.
External hardware devices include monitors, keyboards, mice, printers, and
scanners.
The internal hardware parts of a computer are often referred to as components,
while external hardware devices are usually called peripherals.
Peripherals
A computer peripheral is any external device that provides input and output for the
computer.
For example, a keyboard and mouse are input peripherals, while a monitor and
printer are output peripherals.
Computer peripherals, or peripheral devices, are sometimes called I/O devices
because they provide input and output for the computer.
Network
A network consists of multiple devices that communicate with one another using a
transmission medium.
It can be as small as two computers or as large as billions of devices.
While a traditional network is comprised of desktop computers, modern networks
may include laptops, tablets, smartphones, televisions, gaming consoles, smart
appliances, and other electronics.
Many types of networks exist, but they fall under two primary categories: LANs and
WANs
Software
Computer software is a general term that describes computer programs or sets of
instructions.
Related terms such as software programs, applications, scripts, and instruction sets
all fall under the category of computer software.
Software can be difficult to describe because it is "virtual," or not physical like
computer hardware.
Instead, software consists of lines of code written by computer programmers that
have been compiled into a computer program.
Software programs are stored as binary.
Human resources
Human resources is used to describe both the people who work for a company or
organization and the department responsible for managing resources related to
employees.
They are often referred to as the end-users of a system
Client
In the real world, businesses have clients.
In the computer world, servers have clients.
The "client-server" architecture is common in both local and wide area networks.
For example, if an office has a server that stores the company's database on it, the
other computers in the office that can access the database are "clients" of the
server.
Server
A server is a computer that provides data to other computers.
It may serve data to systems on a local area network (LAN) or a wide area network
(WAN) over the Internet.
Many types of servers exist, including web servers, mail servers, and file servers.
Each type runs software specific to the purpose of the server.
For example, a Web server may run Apache HTTP Server or Microsoft IIS, which both
provide access to websites over the Internet.
A mail server may run a program like Exim or iMail, which provides SMTP services for
sending and receiving email.
A file server might use Samba or the operating system's built-in file sharing services
to share files over a network.
While server software is specific to the type of server, the hardware is not as
important. In fact, a regular desktop computers can be turned into a server by
adding the appropriate software.
Client-Server Model
The client-server model describes how a server provides resources and services to
one or more clients.
Examples of servers include web servers, mail servers, and file servers.
Each of these servers provide resources to client devices, such as desktop
computers, laptops, tablets, and smartphones.
Most servers have a one-to-many relationship with clients, meaning a single server
can provide resources to multiple clients at one time.
When a client requests a connection to a server, the server can either accept or
reject the connection.
If the connection is accepted, the server establishes and maintains a connection with
the client over a specific protocol.
Router
A router is a hardware device that routes data (hence the name) from a local area
network (LAN) to another network connection.
It can be a separate hardware device or software loaded onto a server.
DNS server
Stands for Domain Name System server
Domain names serve as memorisable names for websites and other services on the
Internet.
However, computers access Internet devices by their IP addresses, not domain
names (also called web addresses).
DNS translates domain names into IP addresses, allowing you to access an Internet
location by its domain name.
Firewall
A physical firewall is a wall made of brick, steel, or other inflammable material that
prevents the spread of a fire in a building.
In computing, a firewall acts as a barrier between a trusted system or network and
outside connections, such as the Internet.
However, a computer firewall is more of a filter than a wall, allowing trusted data to
flow through it.
A firewall can be created using either hardware or software
Topic 1.2.3, 1.2.11 & 1.2.16: Discuss the social, ethical, moral,
economic and environmental issues associated with a networked
world, new IT systems and interaction between humans and
machines
What is a social issue?
A social issue is a problem that influences a considerable number of the individuals
within a society
Examples of social issues are:
Crime
Health
Education
Media & Propaganda
Poverty
Terrorism
Utilitarianism
When designing a new system, we usually try to design it for the greatest good for
the greatest number of people.
This is approach is called utilitarianism.
Topic 1.2.5: Describe methods of obtaining requirements from
stakeholders
What does the client want?
Before designing a new system, it is crucial to determine exactly what the client’s
requirements are.
There are several ways/methods of obtaining these requirements.
Direct Observation
Involves walking around the organisation watching how things are done with his/her own
eyes.
Advantages:
Possibility of gathering first-hand, unbiased information
Disadvantages:
Often people might not work the way they normally do when being observed
Interviews
Involves the interviewing key people within the system to find out how it works.
Advantages:
Allows a lot of very detailed information to be gathered
People can be asked about what they don't like on the system
Disadvantages:
Takes a long time
Questionnaires/Surveys
Involves handing out questionnaires for people to fill out
Advantages:
Large amount of data from a large group can be gathered
Takes little time to analyse (if done electronically)
Simple
Disadvantages:
Takes a long time
Information gathered is limited by questionnaire, can be biased
Quality of responses not ensured
Collecting documents
Involves looking in the documents currently being used in the system to try to find out how
the present system works
Advantages:
Detailed information about the present system can be gathered
It can be seen where the old system has problems
Disadvantages:
Time consuming
Just looking at the forms/outputs may be confusing
Competing products
Look at what the competitors are doing. The aim is not copy them, but to get an idea of
what is possible/being done at the moment.
Intellectual property
Intellectual property is something unique that you physically create. For example, an idea
for an app doesn’t count, but the lines of code you’ve written do.
Organisational abilities
A big consideration before creating a new system is determining what the organisation
would be capable of.
Can they afford a new system/new equipment?
Can the staff use the new system? Training needed?
Can they have any ‘downtime’ to upgrade?
Literature search
Finally, have you consulted literature to see what else might be out there?
In IB terms, the term “literature” refers to book, magazines, web sites, journals,
videos, academic papers
3. Structure chart
Diagram representing the organization of a system, usually with showing the
different parts in hierarchical order.
Purpose of prototypes
Fail early and inexpensively – by building a prototype, you can quickly weed out the
approaches that don’t work to focus on the ones that do.
Gather more accurate requirements – interviews and focus groups can fall short
because many people find it difficult to conceptualize a product before they see it.
By developing a working prototype, you can demonstrate the functionality to help
solidify requirements for the final design.
Technically understand the problem – by developing a functional prototype, you are
forced to address both the foreseen and the unforeseen technical challenges of a
device’s design.
Topic 1.2.9: Discuss the importance of iteration during the design
process
Iteration: The action/process of iterating or repeating
Accessibility
Refers to the design of products, devices, services, or environments for people with
disabilities or specific needs e.g. Braille keyboards, eye-typers, screen readers, voice
synthesizers.
Usability
The ease of use and learnability of a human-made object. The object of use can be a
software application, website, machine, process, or anything a human interacts with.
Possible Issues:
What would happen if someone can’t access the system?
What would happen if they can only access certain parts?
What happens if they misunderstand what the system requires as input?
What would happen if they can’t access the output?
You must be able draw and label both of these block models from memory.
Programs are loaded from storage, into memory (RAM) and executed one instruction at a
time by the CPU
Busses
Busses are the connecting wires that connect the CPU to other devices, carrying instructions
to/from components (built into the motherboard).
The three most important busses are:
Data bus (links RAM to CPU via MDR)
Control bus (links RAM to CPU via CU)
Memory bus (links RAM to CPU via MAR)
RAM ROM
Volatile Non-volatile
Contains user’s programs and data that Contains the BIOS
has been loaded since ‘booting up’
Usually upgradeable, can be increased Usually part of motherboard, difficult to
upgrade
Topic 2.1.3: Explain the use of cache memory
Definition: cache
A type of small, high-speed memory inside the CPU used to hold frequently used data, so
that the CPU needs to access the much slower RAM less frequently
2. Decoding the
instruction
Once the instruction has been fetched, the CPU will need to understand the
instruction to action it. This is called decoding
Example: A single piece of program code might require several instructions. Look at this Java
code:
First, the computer needs to load in the value of the variable length into the immediate
access store (registers).
Next it needs to load in the value of the variable width.
Then it needs to multiply the two numbers together, and finally it needs to store the result
in the variable area.
OS vs Application features
Certain parts of the interface are provided by libraries in the OS and certain parts are
specific to each application.
For example: the menu bar and buttons are standard, but the specifics/pictures are
up to the individual application.
Topic 2.1.9: Define the terms: bit, byte, binary, denary/decimal and
hexadecimal
Definition: bit
Computers use binary - the digits 0 and 1 - to store data. A binary digit, or bit, is the smallest
unit of data in computing. It is represented by a 0 or a 1.
Definition: byte
Bits can be grouped together to make them easier to work with. A group of 8 bits is called a
byte.
Definition: binary
Computers use binary - the digits 0 and 1 - to store data
Because it only has 2 symbols (0 & 1) it is also called BASE-2 numbering
Binary also refers to the format in which numbers are transmitted and calculated in a
computer system.
How to convert from binary to denary:
128 64 32 16 8 4 2 1
0 1 1 0 0 0 0 0
96 = 01100000
Definition: hexadecimal
Hexadecimal is a numbering system with 16 symbols: 0123456789ABCDEF
It is, therefore, often referred to as BASE-16 numbering.
Hex, as it is often called, is used to represent very large numbers quickly, such as
those used in colour representation.
Hexadecimal to Denary
Binary to Hexadecimal
ASCII vs Unicode
Different data types take up more space
Topic 2.1.11: Define the Boolean operators: AND, OR, NOT, NAND,
NOR and XOR
What is logic?
It’s how a machine will solve problems
Machines (at basic level) do not understand semantics like humans – no grey areas.
This is a useful tool to practise boolean algebra, a skill that is needed for IB Computer
Science
Topic 3: Networks
Topic 3.1.1: Identify different types of networks
Definition: Network
A computer network is a group of computer systems and other computing hardware
Extranet
An extranet is a controlled private network allowing customers, partners, vendors,
suppliers and other businesses to gain information, typically about a specific
company or educational institution, and do so without granting access to the
organization's entire network.
An extranet is often a private part of a website.
It is restricted to select users through user IDs, passwords and other authentication
mechanisms on a login page.
Data integrity
Data integrity, in the context of networking, refers to the overall completeness,
accuracy and consistency of data.
Data integrity must be imposed when sending data through a network.
Flow Control
Flow control is the mechanism that ensures the rate at which a sender is
transmitting is in proportion with the receiver’s receiving capabilities.
Flow control is utilized especially in cases where the sending device can send data
much faster than the receiver can digest.
Deadlock
A deadlock is a situation where two nodes or processes are trying to access the same
node at the same moment, causing neither to be able to proceed.
It is then up to the relevant protocol to stop both, and requeue them so that they
can happen sequentially, letting traffic flow.
Congestion Control
Congestion refers to a network state where a node or link carries so much data that
it may deteriorate network service quality, resulting in queuing delay, frame or data
packet loss and the blocking of new connections.
In modern networks, avoiding congestive collapse involves the application of
network congestion avoidance techniques along with congestion control.
Error checking
Error checking or detection refers to the techniques used to detect noise or other
impairments introduced into data while it is transmitted from source to destination.
Error detection often makes use of parity bits, bits at the end of a packet that are
calculated to be either a 1 or 0.
Video link:
https://www.youtube.com/watch?v=ewrBalT_eBM&feature=iv&src_vid=WwyJGzZmBe8&annotatio
n_id=annotation_667002
(this explains packet switching in detail, very important for paper 1)
Video link:
https://www.youtube.com/watch?v=IlAJJI-qG2k
(this explains undersea cabling, the basis of the internet.)
Disadvantages
Interference
As 2.4GHz spectrum is often crowded
Limited Range
WEP
this encryption is not difficult to hack and WPA2 has solved this problem
Access Points – these can be
these can be used to steal data
Health Concerns
Software components
Network Operating System (with drivers)
Protocol stack (TCP/IP)
Applications (Browser/File explorer)
3G (Third Generation)
The primary way mobile phones access the internet today
Allows the tunnelling of phone lines (mobiles don't have to switch back to phone
network when receiving a call
Relatively fast
Authentication
Is someone who they claim to be?
One factor authentication: Something you know? (password/pin number)
Two factor authentication: Something you have? (card, E key)
Three factor authentication: Something you are? (touch ID, iris scanner)
Firewalls
Hardware or Software (or hybrid of both).
Controls incoming and outgoing network traffic.
Analyse data packets based on pre-determined set of rules.
Physical security
Locked doors
Security personnel
Cages / sealed units
Reinforced/secure rooms
Walls with barbed wire
Ravenous guard dogs
Encryption
UserID (and passwords)
PSK (pre-shared key)
WEP (dead)
WPA / WPA2
Warning: This part of the course has a high emphasis on programming, so a lot of it will be
learnt by practising Java. So, not all parts of the syllabus will be covered here.
Pseudocode is very important in this topic. Go through the IB Computer science
pseudocode booklet to learn the correct pseudocode standards. Here is a link:
https://computersciencewiki.org/images/c/c6/IB-Pseudocode-rules.pdf
https://computersciencewiki.org/images/3/3e/Approved_notation_for_developing_pseudocode.pdf
Topic 4.1.1 – 4.1.3: Thinking procedurally
This will include identifying steps and putting them in the correct order e.g. recipes,
instructions.
Working out the order
For this part of the course practice some java problems on coding bat
Topic 4.1.4 – 4.1.8: Thinking logically
Topic 4.1.9 – 4.1.13: Thinking ahead
Inputs vs Outputs
Concurrent processing system one job uses several processors to execute sets of
instructions in parallel.
Increases computation speed
Increases complexity of programming language and hardware (machinery &
communication among machines)
Reduces complexity of working with array operations within loops, of performing
matrix multiplication, of conducting parallel searches in databases, and of sorting or
merging files.
You must be able to evaluate the use of concurrent processing. Refer to time
(saved/wasted), cost, is concurrency possibly, consequence of not using concurrency.
2. Binary search
Binary search, also known as half-interval search, is a search algorithm that
finds the position of a target value within a sorted array.
It works by comparing the target value to the middle element of the array;
If they are unequal, the lower or upper half of the array is eliminated
depending on the result and the search is repeated in the remaining sub-
array until it is successful.
It only applies to SORTED arrays (where there are usually no duplicate values,
or duplicates do not matter)
Video link: https://www.youtube.com/watch?v=D5SrAga1pno
(explains binary search in detail)
Pseudocode:
3. Bubble sort
Bubble sort is a simple sorting algorithm that repeatedly steps through the
list to be sorted, compares each pair of adjacent items and swaps them if
they are in the wrong order.
The pass through the list is repeated until no swaps are needed, which
indicates that the list is sorted.
The algorithm, which is a comparison sort, is named for the way smaller
elements "bubble" to the top of the list.
Although the algorithm is simple, it is too slow and impractical for most
problems.
Video link: https://www.youtube.com/watch?v=8Kp-8OGwphY
(explains bubble sort)
Pseudocode:
4. Selection sort
Selection sort is a sorting algorithm and it is inefficient on large lists
Selection sort is noted for its simplicity, and it has performance advantages
over more complicated algorithms in certain situations, particularly where
memory is limited.
The algorithm divides the input list into two parts: the sublist of items already
sorted, which is built up from left to right at the front (left) of the list, and the
sublist of items remaining to be sorted that occupy the rest of the list.
Initially, the sorted sublist is empty and the unsorted sublist is the entire
input list.
The algorithm proceeds by finding the smallest (or largest, depending on
sorting order) element in the unsorted sublist, exchanging (swapping) it with
the leftmost unsorted element (putting it in sorted order), and moving the
sublist boundaries one element to the right
Video link: https://www.youtube.com/watch?v=f8hXR_Hvybo
(explains selection search in detail)
Pseudocode:
Standard operations for collections are all must be learnt, these are located in the IB
pseudocode booklet
Basic comparisons
A binary search is faster - O(log N ), but can only be performed in a SORTED list
A sequential search is slower - O(N) but can be performed whether the list is sorted
or not
A bubble sort can "quit early" if no swaps are made in a pass. But it makes lots of
swaps.
A selection sort must always perform N passes - it cannot "quit early". But it makes
fewer swaps - maximum of N swaps
Both bubble and selection sort are O() = equally complex
Flowchart symbols
What affects run time of an algorithm?
computer used, the hardware platform
efficiency of compiler
competence of programmer (programming skills)
complexity of underlying algorithm
size of the input
Definition: Complexity
Complexity of an algorithm is a measure of the amount of time and/or space
required by an algorithm for an input of a given size (n).
Time for an algorithm to run t(n) is characterised by the size of the input.
We usually try and estimate the WORST CASE, and sometimes the BEST CASE, and
very rarely the AVERAGE CASE.
Tyranny of growth
A = ( n) {log to base 2 of n}
B = n {linear in n}
C = (n * (log2 n)) {n log n}
D = (n²) {quadratic in n}
E = (n³) {cubic in n}
F = () {exponential in n}
G = () {exponential in n}
H = (n!) {factorial in n}
Fundamental vs Complex
Fundamental:
Complex:
Compound operation:
Translation
Compiler: If the translator translates a high-level language into a lower level
language (done in a batch)
Interpreter: the translator translates a high-level language into an intermediate code
which will be immediately executed by the CPU (done line by line)
Assembly: the translator translates assembly language to machine code (mnemonics
to binary)
Levels of language
Definition: Variable
Variables are storage location for data in a program.
They are a way of naming a memory location for later usage (to put a value
into/retrieve a value).
Each variable has a name and a data type that is determined at its creation (and
cannot be changed)
Definition: Constant
A constant is an identifier with an associated value which cannot be altered by the
program during normal execute -the value is constant.
This is contrasted with a variable, which is an identifier with a value that can be
changed during normal execution – the value is variable.
Definition: Operator
A character/set of characters that represents an action
Types:
Boolean operators (AND, OR, &&, ||) for working out true/false situations
Arithmetic operators (+, -, ++, --, /, %, div, mod) for doing simple
mathematical calculations
Assignment operators , which assign a specified value to another value and (
=)
Relational operators , which compare two values (, >=, <=, ==, !=, .equals() )
Definition: Object
In Object-oriented programming (OOP), an object is an instance of a class.
Objects are an abstraction: they hold both data (states), and ways to manipulate the
data (behaviours).
Manageable tasks
Breaking down a programming project into modules makes it more manageable.
These individual modules are easier to design, implement and test.
Then you can use these modules to construct the overall program.
Distributed development
Modular programming allows distributed development.
By breaking down the problem into multiple tasks, different developers can work in
parallel.
And this will shorten the development time.
Code reusability
A program module can be reused in programs.
This is a convenient feature because it reduces redundant code.
Modules can also be reused in future projects.
It is much easier to reuse a module than recreate program logic from scratch.
Program readability
Modular programming leads to more readable programs.
Modules can be implemented as user-defined functions.
A program that has plenty of functions is straightforward.
But a program with no functions can be very long and hard to follow.
Some good
real-life
examples of recursion are snowflakes and
fractals as they are an infinite repeat of the
same thing over and over.
2D Array (grids/tables)
Topic 5.1.6: Describe the characteristics and applications of a stack
Stacks – all about the PUSH and POP
LIFO – Last in, first out
The way a stack data structure works is items pushed on and popped off to add and remove
from the stack. This means that the last item to be added to the stack is the first value to be
removed, like a stack of plates.
You will need to know how to use stacks in pseudocode algorithms, so learn how to do
this with practise questions and the pseudocode guide.
Example 1: Write an algorithm that will move all the elements from a linear integer array
LINE to a stack called S.
Example 2: Write an algorithm that will print all the String values of a stack called S
You will need to know how to use queues in pseudocode algorithms, so learn how to do
this with practise questions and the pseudocode guide.
Example 2: Write an algorithm that will print all the String values kept in a queue called Q.
Topic 5.1.10: Explain the use of arrays as static stacks and arrays
Arrays are static data structures (can’t change size)
Stacks & queues are dynamic data structures (can change size)
You can use an array to behave like a stack or a queue, provided you give it enough
elements to allow the stack or queue to function.
Update the next link of a new node, to point to the current head node.
Update the next link of the current tail node, to point to the new node.
Topic 5.1.14: Describe how trees operate logically (both binary and
non-binary)
Binary tree
A binary tree is made of nodes, where each node contains a "left" pointer, a "right"
pointer, and a data element.
The "root" pointer points to the topmost node in the tree.
The left and right pointers recursively point to smaller "subtrees" on either side.
A null pointer represents a binary tree with no elements -- the empty tree.
The formal recursive definition is a binary tree is either empty (represented by a
null pointer), or is made of a single node, where the left and right pointers (recursive
definition ahead) each point to a binary tree.
Definitions
Parent: A node in a tree that has children (left, right or both)
Left child: A node on the left-hand side below a parent node
Right-child: A node on the right-hand side below a parent node
Root: The top node in a tree
Subtree: A parent with children with-in another parent child relationship
Leaf: A node with no children
Processor: Speed
What it does:
Processor does all calculations in a computer system.
Speed is measurement of how many calculations can be done per second (1Ghz = 1
billion calculations per second)
Common capacities:
Gigahertz (GHz): 1/1.2/2/2.4/3.2
Effect on system if too limited:
Processor will take longer to perform tasks
Screen resolution
What it does:
Measurement of number of pixels in height x width of display
Common capacities:
1024×768 (XGA)
1366×768 (HD 720p)
1920x1080 (HD 1080p)
4096x2304 (4K)
Effect on system if too limited:
If resolution is too limited, the number of pixels that can be displayed is less – display
might be pixelated (blocky)
Lower resolutions = smaller file size but poorer quality images
Sound processor
What it does:
Sound reproduction is done by a separate processor, freeing up the CPU to do other
calculations.
Can also contain a bank of ‘sampled’ sounds to reproduce better quality music/audio
Common capacities:
Home theatre systems
Cinemas
Effect on system if too limited:
CPU is taxed with having to processes sounds, slows down system overall.
Overall quality is not as high as in a system with a dedicated sound processor
PCs (Desktop)
Processor: Single processor (multiple cores) 1-4 GHz
Primary memory: 2-16 GB
Secondary memory: 256 GB to 2 TB
Common use:
Used in companies/schools (where portability is not needed)
Can be expanded by adding expansion cards (graphics cards)
Used to be the most common type of personal computer
Sub-laptops (netbooks)
Processor: Single/multiple core (1-2 GHz)
Primary memory: 1-2 GB
Secondary memory: Normally SSD – 16- 128 GB
Common use:
Fuelled by ‘netbook boom’ of early 2000s (before tablets)
Runs stripped down OS (Linux, Chrome OS)
Portability and battery life are key features
Cell phones/mobiles
Processor: Single/Multicore
Primary memory: 1-3 GB
Secondary memory: Usually limited, but can be upgraded (MicroSD card)
Common use:
Most common personal computing device in the world
Getting more capable, rivalling PCs/laptops
Biggest constraint is screen size and input options (lack of physical keyboard)
Tablets
Processor: Single/Multicore
Primary memory: 1-4 GB
Secondary memory: Usually limited, but can be upgraded (MicroSD card)
Common use:
Very common for media consumption
Getting more capable, rivalling PCs/laptops
Biggest constraint is lack of physical keyboard
Digital Camera
Processor: Single core
Primary memory: Limited
Secondary memory: Expandable through use of memory cards (SD/Compact flash/Memory
Stick)
Common use:
For higher end photography
Most digital cameras now integrated in mobile phones/laptops/tablets
Multi-user system
Either many users on the same machine
Or many users connected to the same network
Multi-programming system
Multi-programming system = system that can have different programs (apps)
installed
Single programming system = can only run one program/set of programs
Virtual memory
Virtual memory is a feature of an operating system (OS) that allows a computer to
compensate for shortages of physical memory by temporarily transferring pages of
data from random access memory (RAM) to disk storage.
Provides an interface
User interface is used to interact with the computer to performs various tasks. User
gives commands to computer and enters the data into computer. The operating
system then translates the input/output and sends it to the correct memory
address/folder address to be processed.
Types of Operating Systems: Based on the user interface, there are two types of
operating systems.
Graphical User Interface Operating System (Windows)
Command Line Operating System (Linux Terminal)
terminals
Time-slicing
With a multi-user system, a time-slice is the set amount of processing time each
user gets.
With a single-user system, a time-slice is the set amount of processing time each
program gets.
Slices (also called threads) are alternately processed to give the illusion of many
tasks happening at once.
Interrupt handling
An interrupt handler is a function in of the OS or a device driver, whose execution is
triggered by the reception of an interrupt.
In general, interrupts are used to handle high-priority conditions that require the
interruption of the current code the processor is executing.
For example, pressing a key on a keyboard, or moving the mouse, triggers interrupts that call
interrupt handlers which read the key, or the mouse's position, and copy the associated
information into the computer's memory.
Policies
The policies what is to be done while the mechanism specifies how it is to be done.
For instance, the timer construct (limiting the time a process can use the CPU for)
thereby ensuring CPU protection is mechanism.
On the other hand, the decision of how long the timer is set for a particular user is a
policy decision.
The separation of mechanism and policy is important to provide flexibility to a
system.
Multitasking
Multitasking, in an operating system, is allowing a user to perform more than one
computer task (such as the operation of an application program) at a time.
The operating system is able to keep track of where you are in these tasks and go
from one to the other without losing information.
Almost all of today's operating systems can do this.
When you open your Web browser and then open Word at the same time, you are
causing the operating system to do multitasking
Virtual memory
Virtual memory is a feature of an operating system (OS) that allows a computer to
compensate for shortages of physical memory by temporarily transferring pages of
data from random access memory (RAM) to disk storage.
Eventually, the OS will need to retrieve the data that was moved to temporarily to disk
storage -- but remember, the only reason the OS moved pages of data from RAM to disk
storage to begin with was because it was running out of RAM
Paging
When using virtual memory, the OS needs to retrieve the data that was moved to
temporarily to disk storage; the only reason the OS moved pages of data from RAM to disk
storage to begin with was because it was running out of RAM.
To solve the problem, the operating system will need to move other pages to hard disk so it
has room to bring back the pages it needs right away from temporary disk storage.
This process is known as paging or swapping and the temporary storage space on the hard
disk is called a page file or a swap file.
Swapping, which happens so quickly that the end user doesn't know it's happening, is
carried out by the computer’s memory manager unit (MMU).
The memory manager unit may use one of several algorithms to choose which page should
be swapped out, including Least Recently Used (LRU), Least Frequently Used (LFU) or Most
Recently Used (MRU).
Interrupt
An interrupt is a signal to the processor emitted by hardware or software indicating
an event that needs immediate attention.
An interrupt alerts the OS to a high-priority condition requiring the interruption of
the current code the processor is executing.
The OS responds by suspending its current activities, saving its state, and executing a
function called an interrupt handler to deal with the event.
This interruption is temporary, and, after the interrupt handler finishes, the
processor resumes normal activities.
There are two types of interrupts:
hardware interrupts
software interrupts
Polling
Polling is the process where the computer or controlling device waits for an external device
to check for its readiness or state, often with low-level hardware.
For example, when a printer is connected via a parallel port, the computer waits until the
printer has received the next character.
Alternative to polling: interrupts (signals generated by devices or processes to indicate that
they need attention)
Although polling can be very simple, in many situations (e.g., multitasking operating
systems) it is more efficient to use interrupts because it can reduce processor usage and/or
bandwidth consumption.
For the techniques above you must know when and why they are used for your exam
Advantages
Security: A dedicated operating system ensures a higher level of security.
Example: Banks would require a dedicated operating system to prevent
cyber-attacks on financial transactions
Customisability: Dedicated operating systems custom made to do a specific function
at maximum efficiency.
Example: A ‘dumb phone’ OS
Modify priorities: can make running some devices easier to use or better suited to
their audience. By having a custom OS, you can eliminate certain aspects of the OS
which are not needed, reducing the size of the OS, therefore reducing the amount of
secondary memory and RAM being used.
Example: Raspbian Linux on Raspberry Pi
Drive letters
A ‘drive letter; is a single alphabetic character A through Z that has been assigned to
a physical drive or drive partition in the computer.
For example, a computer with a floppy drive has a drive letter of A: assigned to the
drive.
All computers with a hard drive will
always have that default hard drive
assigned to a C: drive letter
CD-ROM or other drive is the next
drive letter (e.g. D:) etc.
Automated doors
Taxi meter
Video link: https://youtu.be/2iAgggixkO8
(explanation of GPS)
Types of sensors
Topic 7.1.3: Evaluate different input devices for the collection of
data in specified situations
When to use what input device?
Will depend on scenario – below the most common types
Sensors record analogue signals which are then converted to digital signals for processing in
the microprocessor. The processor’s digital output can then be converted to analogue
signals again (if needed).
Tagging prisoners
Arguments for:
Allows non-dangerous criminals to move
Reduces number of people needed to be in prison
Allows for tracking at all times
Arguments against:
Loss of freedom of movement
Could be hacked to track innocent people
Tracking data could be sold off to make money
Surveillance
Arguments for:
Allows for greater security
Could be used as effective evidence in court cases
Allows fewer people to have monitor others
Arguments against:
Loss of privacy
Could be hacked and used for unintended purposes
Could be used to spy on people (drones)
Centralised system
Distributed system
Advantages
Advantages of centrally controlled system:
Easier to administrate
More control
Advantages of distributed systems:
Quicker access
Shared load
Response more specific to environment
Disadvantages
Disadvantages of centrally controlled system:
If the main sensor/controller fails, the whole system fails
disadvantages of distributed systems:
Much more expensive to have multiple controllers/sensors
Much more complex than a centralised system
Topic 7.1.8: Outline the role of autonomous agents acting within a
larger system
Definition: Autonomous agent
Intelligent agents are software entities that carry out some set of operations on behalf of a
user or another program with some degree of independence or autonomy, and in so doing,
employ some knowledge or representation of the user's goals or desires (IBM definition)
B. Reactive behaviour
Agent senses the environment in which it is and decides what to do, reacting on its
perceptions
C. Concurrency/sociality
Agents can interact with other agents through communication, in different modes:
coordination, cooperation and competition.
D. Persistence
The code describing an agent runs continuously like a process, and it not executed
on demand.
Video link: https://youtu.be/JIz2L4tn5kM
(video playlist that explains autonomous agents in great detail)
Option D: OOP
Topic D.1.1: Outline the general nature of an object
Object
It has two components:
data (also called states) which can be variables or data structures likes
arrays/lists
actions (also called behaviours) which can be functions/procedures (methods in
Java)
Object vs Class
Object – refers to a particular instance of a class, where the object can be a
combination of variables or data structures (called states) and functions, procedures
or methods (called behaviours)
Class – an extensible program-code-template for creating objects, providing initial
values for states (variables) and implementations of behaviours
(functions/procedures/methods)
Driver vs Providers
Topic D.1.2: Distinguish between an object (definition, template or
class) and instantiation
Array of Objects
When adding objects to an array, you either instantiate the object and THEN add it to the
array (at a specific slot); OR you can instantiate the object directly into a particular slot of
the array.
Object Variable
The more RAM being used by a program, the more processor time is needed to
read/write/process the data. The more processor cycles being used, the more ‘sluggish’ the
computer would be to the user.
Example:
Associations (shown with lines/arrows)
As projects contain multiple classes (driver & providers), it is important to show the
relationship between two objects.
This is a basic example where class A1 (driver) has a main method in which an object
of class B1 (provider) is instantiated.
Topic D.1.4: Interpret UML diagrams
UML Class diagram = Java code
Topic D.1.6: Describe the relationship between objects for a given
problem
Four types of relationships
Dependency – “uses”
Aggregation – “has a”
Inheritance – “is a”
Association – “uses
Comparison
Generally speaking, Association is the most generic relationship. The other three are more
specific and are used in particular situations.
Example:
In the figure below, an object of Player class is dependent (or “uses”) an object of
Bat class.
Example:
Association vs Dependency
Association and dependency are often confused in their usage.
There are a large number of dependencies in a system.
We only represent the ones which are essential to convey for understanding the
system.
We need to understand that every association implies a dependency itself.
However, we prefer not to draw it separately
Topic D.1.9: Explain the need for different data types to represent
data items
Four key data types
integer (Java: int), e.g. 3, -4, 999, 23
real (Java: double), e.g. -3.1415, 9.999
String (Java: String) e.g. “strange”
Boolean (Java: Boolean) e.g. true / false
Topic D.1.10: Describe how data items can be passed to and from
actions as parameters
Parameters
Parameters allow us to pass information or instructions into functions and
procedures.
Parameters are the names of the information that we want to use in a function or
procedure.
The values passed in are called arguments.
Example:
We can create a procedure that draws a square - but for it to be useful we need to
also be able to specify how large it should be.
The following example creates a procedure called 'square'.
In the line where we define the name for this procedure, we have included a
variable called 'distance' inside the brackets.
Distance is a parameter - it allows us to pass a value into the procedure for it to use.
Parameter vs Argument
Distance is a parameter - it allows us to pass a value into the procedure for it to use.
Running the following code would create a square of size 50 for each side:
Overloading
Overloading allows different methods to have same name, but different signatures
where signature can differ by number of input parameters or type of input
parameters or both.
Overriding
Overriding allows a sub class to provide a specific implementation of a method that
is already provided by one of its super classes.
When a method in a subclass has the same name, same parameters or signature
and same return type as a method in its super-class, then the method in the subclass
is said to override the method in the super-class.
Overloading vs Overriding
Overloading is about same function have different signatures (usually in the same
class).
Overriding is about same function, same signature but different classes connected
through inheritance
Overloading Example: Java
Overriding Example: Java
WARNING: This part of D relates closely to the JETS booklet (link below). You need to
know all the conventions in this booklet although you will not get a copy in the exam
http://ib.compscihub.net/wp-content/uploads/2015/04/JETS-Java-rules.pdf
Definition: identifier
An identifier is a named pointer that explicitly identifies an object, class, method, or
variable.
It allows a programmer to refer to the item from other places in the program.
To make the most out of the identifiers you choose make them meaningful and follow the
standard Java naming conventions.
Example:
Definition: primitive
Primitive types are the most basic data types available within the Java language.
There are 8: boolean, byte, char, short, int, long, float and double.
These types serve as the building blocks of data manipulation in Java.
Such types serve only one purpose: to contain pure, simple values of a particular
kind.
Definition: variable
A variable provides us with named storage location for a value that a program can
manipulate.
They must be declared before they can be used and can only contain data of a
particular type (in Java).
Example:
Example:
Definition: local variable
A variable defined within a block or method or constructor is called local variable.
These variable are created when the block is entered, or the function is called and
destroyed after exiting from the block or when the call returns from the function.
The scope of these variables exists only within the block in which the variable is
declared; we can access these variables only within that block.
Example:
Topic D.3.2:
Define the terms: method, accessor, mutator, constructor,
signature, return value
Definition: method
A method is a set of code which is referred to by name and can be called (invoked) at any
point in a program simply by utilizing the method's name.
A method can be described as a subprogram that acts on data and often returns a value.
Each method has its own name (identifier).
Example:
Definition: accessor
An accessor is a type of method used in Java OO programming that which returns the value
of a private instance (class) variable.
It is also known as a getter method.
Example:
Definition: mutator
A mutator method is a method used to control changes to an encapsulated instance (class)
variable/state.
They are also widely known as setter methods.
Example:
Definition: constructor
A constructor method is an instance method (defined inside a class) that is invoked when an object
of that class is created (by using the new keyword)
Object creation rule in Java: When an object is created, one of the constructor method in the class
must be invoked (to initialize the instance variables in the object)
Example:
Example:
Definition: public
A class, method, field or constructor that is declared public can be accessed from
any other class.
Therefore, fields, methods, blocks declared inside a public class can be accessed
from any class belonging to the Java Universe.
Because of class inheritance, all public methods and variables of a class are inherited
by its subclasses.
Example:
Definition: private
Methods, variables, and constructors that are declared private can only be accessed
within the declared class itself.
private is the most restrictive access level.
Classes cannot be private, but methods and variables can.
Variables that are declared private can be accessed outside the class, if public getter
methods are present in the class.
Using the private modifier is the main way that an object encapsulates itself and
hides data from the outside world.
Definition: protected
Variables, methods, and constructors, which are declared protected in a superclass
can be accessed only by the subclasses in any class within the package of the
protected members' class.
protected cannot be applied to classes.
protected access gives the subclass a chance to use the helper method or variable,
while preventing a nonrelated class from trying to use it.
Example:
Definition: extends
extends is the keyword used in a sub class to inherit the properties of a super class
Definition: static
static is a non-access modifier in Java which is applicable for the following:
blocks
variables
methods
nested classes
To create a static member (variable, method, etc.), precede its declaration with the keyword
static.
static variables are used for any property that is common to all objects of that type
Example:
More on static
Declares a static member of a class that will be the same for all members.
The static keyword in Java means that the variable or function is shared between all
instances of that class as it belongs to the type, not the actual objects themselves.
So, if you have a variable: private static int i = 0; and you increment it ( i++ ) in one
instance, the change will be reflected in all instances.
The first data column indicates whether the class itself has access to the member
defined by the access level - a class always has access to its own members.
The second column indicates whether classes in the same package as the class have
access to the member.
The third column indicates whether subclasses of the class declared outside this
package have access to the member.
The fourth column indicates whether all classes have access to the member.
Arrays
Practice reading from an array, moving data to/from the array, printing out selections from
it… etc.
Factorial (n!)
Possible answer
Recursive versions of many routines may execute a bit more slowly than the
iterative equivalent because of the added overhead of the additional function calls.
Many recursive calls to a method could cause a stack overrun. Because storage for
parameters and local variables, it is possible that the stack could be exhausted. If this
occurs, the java run-time system will cause an exception. However, you probably will
not have to worry about this unless a recursive routine runs wild.
The main advantage to recursive methods is that they can be used to create clearer
and simpler versions of several algorithms than can their iterative relatives. For
example, the Quicksort sorting algorithm is quite difficult to implement in an
iterative way.
p is the object reference. You cannot call the method without it.
A reference to the object in memory, in Java it is shown by the use of the dot notation to
access fields and methods e.g. Person p = new Person(); p.setName(“Fred”); p is the object
reference. You cannot call the method without it.
A list is a generic ADT and usually comes with the following basic methods:
add, size, get, isEmpty and remove
Add adds an element to the list, size returns the number of elements in the list, get returns
an element from the list but the element remains in the list, remove removes the element
from the list for ever. IsEmpty returns true if there are no elements in the list and false if the
list contains elements.
Lists can be indexed to allow the program to add and remove elements from specified
positions in the list.
D.4.14: Outline the features of ADTS stack, queue and binary tree
Refer to topic 5: Abstract data structures
The main point is that code is read more often than it is written. If everyone codes in the
same way it becomes more easily read. This cuts down time on maintenance and reduces
the chance of error through misinterpretation. This in turn saves time, money and effort.
This point is even more important when working remotely i.e. away from your colleagues.
You might be working across the country or across the world. If everyone follows the
conventions, code is easy to read and update.