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