mocks dont know Flashcards
why use meaningful identifier names
variables make sense
names of subroutine tells the reader what it it
makes code easier to understand
makes code easier to debug and maintain
why use subroutines
- each subroutine can be tested separately - making it easier to debug
- many programs can work on a large program once - cutting down development time (splitting it up)
- subroutines can be reused - reducing development time
- code broken down into meaningful subroutines - easier to maintain
position
POSITION(word, ‘r’)
word.index(‘r’)
word.find(‘r’)
finds position of a letter
substring
slices a string
- SUBSTRING(start, end, str)
e.g. word = algorithm
SUBSTRING (3,6,word) = “orit” - print(word[3:7]) (stops
subroutine definition
it is a named out of line block of code that may be executed by writing its name in a program statement
comparing linear and binary searches
binary
- in order
- start at middle
- halve set, compare middle item then discard one side, repeat
- suitable for a large no. items
- new items added in the correct place not end
computer virus
installed on users computer without their knowledge or permission, to do harm
can copy itself automatically
trojan
pretends to be of a helpful use to the user but is really malicious
may spread malware, crash computer, corrupt data, access sensitive info
spyware
software that gathers info about a person or an organisation without their knowledge
can collect personal info such as logins
firewall
monitors incoming/ outgoing network traffic
decides what to block/allow based on rules
can block certain IP addresses or ports
MAC address filtering
determines which devices are allowed to access a network
by whitelisting certain permitted devices (identified by their MAC address)
application layer
where network applications operate
data is encoded
- HTTP, HTTPS, FTP, IMAP, SMTP
transport layer
sets up communication between two hosts
and establishes settings eg language and packet size
splits data into packets
- TCP and UDP
link layer
where network hardware is located eg NIC and OS device drivers
attaches MAC addresses of the sender/ receiver
internet layer
addresses packages for transmission
routes packages across the network
attached IP address of sender and destination
- IP
layers order
A
T
I
L
ethernet protocol
family of related protocols
communicate by sending each other individual data frames
the MAC address specifies the source and destination of each frame
wifi protocol
allows electronic devices to connect to a WLAN
the Wireless Access Point receives data from a network
the transmitter converts this into radio waves
which are received by a device
TCP
defines how messages are broken into packets and reassembled
detected errors and resends lost packets
UDP
connectionless transmission model
can send messages to other hosts on an IP network
like TCP but has no error checking and maintains an open connection - gaming/ streaming
IP
identifies the location of the device on a network (the internet) and routes the packets from source to destinations via routers
FTP
used to transfer files between a client and server. based on a client server model and uses separate control and data connections between the client and server
SMTP
for sending emails between servers over the internet
IMAP
receiving email
stores email on server but
allows user to view it on many devices
POP
receiving email
downloads new message to local device (no longer on server)
character set
a list of the characters and the binary codes used to represent each one
eg ASCII or UNICODE
importance of local variables
- keeps subroutine self contained
- subroutines can be used as part of a larger program without variables interfering
- save memory
- program easier to maintain/ debug
how are packets used to send data across internet
- website data broken down into packets
- each packet is numbered
- given recipient and sender IP address
- sent separately
- takes most efficient route
- reassembled at destination
- checked for errors
- lost packets resent
benefits of layers
each layer is self contained
can be changed individually
layers can have different software/ hardware
network areas can be split between developers