Unit 8 Flashcards
(19 cards)
AND gate
2 inputs, half an oval and one output
OR gate
2 inputs, looks like a crescent moon, one output
NOT gate
1 input, blank triangle and blank dot, one output
Function of a truth table
shows the output from all possible combinations from a boolean function
What is data validaton and the different types with features
data validation routines ensure data is entered in the right type (ie: integer)
Range check
a number or date is in a sensible range
Type check
data type is correct
Length check
Data entered isn’t too long or short
Presence check
Data is actually entered in (can’t leave it blank)
Formal check
checks the format (ie: postcode/email) is correct
What is verifications
A double check to make sure the data is typed in correctly
ie: double entry validation (asks user to enter password twice)
What are authenticaton routines used for
make sure a person is who they claim to be
How does a device anticipate misuse
if a password has been entered too many times and it has constantly been wrong it might be a hacker or someone else trying to gain access to the personal info as the normal person would only need around 3 tries
Why do programs need to be maintainable and what are the 4 methods of doing so
Improve code, fix bugs, or add new features
May be carried out by original or different programmers, and maintainable programs help other programmers understand your code more easily
WAYS TO MAKE PROGRAMS MAINTAINABLE:
Use of sub programs (functions/procedures)
creates reusable code where bugs can easily be fixed
Appropriate naming for variables
Good use of names makes the program easier to read/understand by collaborators
Indentation
Makes the program easier to read as its neater
Comments
Helps people understand what a program is and how does it
Whats an IDE and what can it do
When you code in a high level language, you use an Integrated Development Environment. It may give you:
Tips on the syntax you’re typing
keywords and text statements in a different colour
automatic indentation
What does an IDE provide you with
Editor
Allows you to write/correct your program and helps with correcting syntax
Compiler/interpreter
Converts program into machine code
Error diagnostics
Print out syntax errors
Debug facilities:
step through a program line by line to spot logic errors
runtime environment
To create a space to run your program in
Difference between logic syntax and runtime errors
Logic:
the code runs fine but mistakes in the algorithm you have devised to perform a required task
Syntax:
A syntax error occurs when code written does not follow the rules of the programming language
Runtime error:
Errors that only happen while the code is running
What is the purpose of testing and the 3 types of tests you should do
A successful test is one which uncovers an error
You will need to test all the different paths in your program so you will make a test with:
Valid data
Invalid data
Boundary data - on the boundary of the valid range
Whats a good way of finding logic errors and whats it also useful for
TRACE TABLE:
determining purpose of an algorithm
finding output of an algorithm
finding errors in an algorithm
What is iterative and final testing used for
Iterative:
Carried out using test plan and trace tables until all bugs are removed and program produces expected answers
Final:
carried out when program is completely finished and all parts have been separately tested
High level language
Majority of code is written in this (ie: python)
One instruction represents many instructions of machine code
same code works on different machines/processors
Code is easy to read/write
Dont need to know about processor/memory structure
Must be translated/interpreted before it can be executed
Slower/less memory efficient
Low level language
Low Level Language:
Machine Code: 0011 0100…
Assembly language: ADD r4 r3..
One instruction of assembly code cna represent one of machine code
Code usually works for one machine/processor
Code is hard to read/write
Need to know internal structure of CPU and how to manage memory
Machine code can be executed directly without being translated
Faster and more memory efficient
Compuler vs interpreter
Compiler
Translate all source code into machine code, creating an executable file
Needed once for initial translation
Returns a list of errors for the whole program where compiling is complete
Compiling can take a long time , but the program runs quickly once compiled
Interpreter
Translates and runs each line/instruction at a time using its own machine code subroutines
Used every time code is run
Stops and returns first error found
Programs run more slowly
What is an assembler and one thing about assembly code making it easier to translate
A program which translates assembly code into machine code (assembly code is assembled)
there is generally a one to one correspondence between each assembly code statement and their machine code correspondent