Paper 2 - section 6 - design, testing and IDEs Flashcards

1
Q

what are the differences between high-level languages and low-level languages?

A
  1. one instruction of high-level code represents many instructions of machine code, whereas one instruction of assembly code usually only represents one instruction of machine code
  2. high-level code will work for many different machines and processors, whereas low-level code is usually written for one type of machine or processor and won’t work on any others
  3. in a low-level language the programmer needs to know about the internal structure of the CPU and how it manages the memory, whereas in a high-level language you can easily store data in many different structures without fully understanding them
  4. high level code is easy to read, understand and modify, whereas low-level code is very difficult to read, understand and modify
  5. high-level code must be translated into machine code before a computer is able to understand it, whereas commands in machine code can be executed directly without the need for a translator
  6. in high level languages you don’t have much control over what the CPU actually does so programs will be less memory efficient and slower, whereas in low-level languages you control exactly what the CPU does and how it uses memory so programs will be more memory-efficient and faster
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

are high or low level languages easier for the computer to run?

A

low-level languages

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

are high or low level languages easier for humans to write?

A

high-level languages

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

give two examples of low-level languages

A

machine code and assembly languages

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

give three examples of high-level languages

A

python, C++ and Java

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

why are translators needed?

A

computers only understand instructions given to them as machine code, so high level languages and assembly languages need to be translated before a computer is able to execute the instructions

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

what are the three types of translator?

A

assemblers, compilers and interpreters

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

what are assemblers used for?

A

assemblers are used to turn assembly language into machine code. There are many different assembly languages (to support different CPU types) and each one needs its own unique assembler

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

what are compilers and interpreters used for?

A

to turn high-level code into machine code

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

what are the key features of compilers?

A
  1. translates all of the source code at the same time and creates one executable file
  2. only needed once to create the executable file
  3. returns a list of errors for the entire program once compiling is complete
  4. once compiled the program runs quickly, but compiling can take a long time
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

what are the key features of interpreters?

A
  1. translate and run the source code one instruction at a time, but doesn’t create an executable file
  2. needed every time you want to run the program
  3. the interpreter will return the first error it finds and then stop - this is useful for debugging
  4. programs will run more slowly because the code is being translated as the program is running
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

which type of translator produces one executable file?

A

compiler

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

what does the type of translator used depend on?

A

which programming language and IDE you’re using

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

what happens if a program is stored over multiple source code files?

A

a linker is used to join all of the separate compiled codes into one executable program

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

what is an integrated development environment?

A

a piece of software that provides features to help a programmer develop their program

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

what is the code editor?

A

the main part of an IDE, it’s where the code is written.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

what are some common features of a code editor?

A

Most code editors will have line numbering and auto-colour coding for things like strings, functions, variables and comments. Good code editors will also have other automatic features like auto-correct, auto-indentation and auto-complete

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

what are 10 common features of an IDE?

A
  1. the code editor
  2. a run-time environment
  3. an explorer window
  4. an output window
  5. features to keep track of the line number and character number that you’re working on
  6. error diagnostics and debugging tools
  7. breakpoints
  8. a translator
  9. auto-documentation
  10. a graphical user interface (GUI) builder
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

what does a run-time environment do?

A

it allows the code to be run quickly within the IDE - this is done using a start or run button. The run-time environment can also help to identify logic errors in the program as the programmer can see which part of the code is running when errors occur

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

what is the point of an explorer window?

A

it helps you navigate through programs

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

what is the output window for?

A

it’s to show the output from a program when it is run

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

what do error diagnostic and debugging tools do?

A

they help to find and fix errors in a program - they’ll tell you the location of the error and often suggest ways to fix it

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

what are breakpoints?

A

a common debugging tool: they stop the program on certain lines so you can gather information like the value of variables as the program is running

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

what does auto-documentation help with?

A

the maintenance of programs. It can extract certain features of a program, like the names of variables, names of sub-programs and comments. This information is stored in a separate document to give a summary of what the code does

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
Q

what does a GUI builder help the programmer to do?

A

design a user interface by building it up graphically rather than having to design it using source code. It allows you to drag and drop different objects and customise them, so you can make the interface look exactly how you want it to

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
26
Q

what are 2 types of errors?

A

syntax errors and logic errors

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
27
Q

what are syntax errors?

A

when the compiler or interpreter doesn’t understand something you’ve typed because it doesn’t follow the rules of the programming language - an error that prevents the program from running

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
28
Q

what are logic errors?

A

when the compiler or interpreter is able to run the program, but the program does something unexpected

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
29
Q

which type of error is hardest to identify and fix, and why?

A

logic errors are more difficult to identify, as compilers and interpreters won’t pick them up

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
30
Q

how are syntax errors often found?

A

compilers and interpreters are unable to turn the source code into machine code, and so a syntax error (with its location) will be returned

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
31
Q

how are logic errors usually found?

A

through general use of the program and by systematically testing it using a test plan

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
32
Q

what is functionality testing useful for - what is its main aim?

A

functionality testing is an essential part of the development process and a good way to spot logic errors. The main aim of this testing is to see if the program actually meets your initial requirements

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
33
Q

should functionality testing be left to the end of the program? why?

A

functionality testing shouldn’t be left until the end of the process - it’s so much better to spot errors and fix them as early as possible during development of the program

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
34
Q

what do performance tests do?

A

test how quickly certain features run and their impact on computer resources

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
35
Q

what do usability tests do?

A

test how user-friendly the interface and features are

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
36
Q

what do security tests do?

A

test vulnerability to attacks and how securely data is stored

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
37
Q

what do load/stress tests do?

A

test how the program copes under extreme conditions, e.g. lots of users at the same time

38
Q

which errors are usually easy to fix? why?

A

syntax errors are usually easy to fix as the compiler should point you to the exact line that contains the error

39
Q

what are the 5 steps you should follow when developing a piece of software?

A
  1. requirements - what does the customer want the program to do?
  2. design - how will the program meet the requirements?
  3. implementation - writing the program to the specified design
  4. testing - does the program meet the requirements?
  5. maintenance - program output but continued updates needed
40
Q

what happens in final testing?

A

the program only goes through the development cycle once. All the required features of the program are added at the same time. The program is tested against the initial requirements of the customer - if it meets them then the program is signed-off. The customer will get what they asked for but it won’t necessarily be what they really want

41
Q

what happens in iterative testing?

A

the program will go through the development cycle a few times. The idea is to try and get the program to match what the customer really wants. The requirements in the first cycle might only include the main features of the program. At the start of each new cycle the requirements will be adjusted (e.g. by adding new details and features)

42
Q

what should be made before implementation (writing the program)?

A

a test plan

43
Q

what will a test plan cover?

A

it will outline exactly what you’re going to test and how you’re going to test it. It should cover all the possible paths through a program and anticipate potential issues. A good test plan will select appropriate test data to test for these issues

44
Q

what are the three categories of test data that you should use?

A
  1. normal data
  2. extreme (boundary) data
  3. erroneous data
45
Q

what is normal data?

A

things that a user is likely to input into the program

46
Q

what is extreme (boundary) data?

A

values at the limit of what the program should accept

47
Q

what is erroneous data?

A

inputs that the program should not accept

48
Q

what does a binary search look for?

A

items in an ordered list

49
Q

what do you do to find the middle item in a list of n items?

A

(n+1) / 2, and round up if necessary

50
Q

what does in mean if a program is functioning correctly?

A

they should never break and never produce errors

51
Q

is it easy to get a program to function correctly?

A

no - even the biggest software companies need to update and patch their programs regularly

52
Q

what are three things that programmers will try to do when protecting their code through defensive design?

A
  1. anticipate how users might misuse their program, then attempt to prevent it from happening
  2. ensure their code is well-maintained
  3. reduce the number of errors in the code through testing
53
Q

what is the easiest way for a user to misuse a program (accidentally or intentionally)?

A

when entering data

54
Q

what are the two ways to prevent users from entering something you don’t want them to?

A

input sanitisation and input validation

55
Q

what is input sanitisation?

A

removing any unwanted characters before passing data through the program

56
Q

what is input validation?

A

checking if data meets a certain criteria before passing it into the program. E.g. checking that an email address contains an @ symbol and has a suitable ending (.com, .co.uk, etc)

57
Q

what are 6 types of input validation checks you can use?

A
  1. range check
  2. presence check
  3. check digit
  4. format check
  5. look-up table
  6. length check
58
Q

what does a range check do?

A

checks the data is within a specified range

59
Q

what does a presence check do?

A

checks the data has actually been entered

60
Q

what do check digits do?

A

checks numerical data has been entered correctly

61
Q

what do format checks do?

A

check the data has the correct format

62
Q

what do look-up tables do?

A

check the data against a table of acceptable values

63
Q

what does a length check do?

A

checks the data is the correct length

64
Q

what can authentication do?

A

help protect your programs - it can confirm the identity of a user before they’re allowed to access certain pieces of data or features of the program

65
Q

what is a common way of authenticating a user?

A

using passwords

66
Q

what are 3 common ways to increase the security of a password-based authentication system?

A
  1. force users to use strong passwords and get them to change their passwords regularly
  2. limit the number of failed authentication attempts before access to an account is lost
  3. ask for a random selection of characters from the password on each authentication
67
Q

what are 3 common ways to increase the security of a password-based authentication system?

A
  1. force users to use strong passwords and get them to change their passwords regularly
  2. limit the number of failed authentication attempts before access to an account is lost
  3. ask for a random selection of characters from the password on each authentication
68
Q

what is the potential problem of authentication?

A

too much authentication can affect a program’s functionality and put people off using it - it’s important that programmers get the level of authentication correct

69
Q

why should programmers make sure that a program is well-maintained as part of the defensive design?

A

because a well-maintained program makes it easy for other programmers to understand what the code does. They should be able to change parts of the source code without the risk of causing problems elsewhere in the code.

70
Q

describe 4 features than can improve the maintainability of source code

A
  1. comments are useful for explaining what the key features of a program do - well written and clear comments are fundamental for helping other programmers understand your programs
  2. indentation can be used to separate different statements in a program. This allows other programmers to see the flow of the program more clearly and pick out the different features
  3. variables and sub-programs should be named so that they refer to what they actually are. This helps programmers to keep track and recognise what the variables are all the way through your program
  4. only use global variables when necessary as they could affect the rest of your code. Variables with local scope will only affect the sub programs that they’re declared in - other programmers will know that changing these variables won’t affect other parts of the program
71
Q

how are comments usually marked?

A

with // or #

72
Q

what is a risk of using too many comments?

A

too many comments can leave your programs looking cluttered and unreadable

73
Q

what is it very easy to do it a good amount of useful comments are put into the source code?

A

produce a summary of what the program code actually does using auto-documentation

74
Q

what are functions?

A

sets of instructions stored under one name that always return a value. When you want your program to do the whole set of instructions you only need to call the name of the function

75
Q

when are functions useful?

A

when you have sets of instructions that you need to repeat in different places within a program. They give your program more structure and readability whilst cutting down on the amount of code you actually need to write

76
Q

true or false: you need to write all procedures/functions yourself

A

false - high-level programming languages have common procedures and function built into them.

77
Q

what are paramenters?

A

special variables used to pass values into a sub program. For each parameter you can specify a name, a data type and a default value

78
Q

what are arguments?

A

the actual values that the parameters take when the sub program is called

79
Q

do functions always take a parameter? do they ever return a value?

A

functions take at least one parameter and they must return a value

80
Q

what should you do when you call a function?

A

you should assign it to a variable or use it in a statement otherwise the value that it returns will not be stored anywhere and will be lost

81
Q

what is abstraction?

A

picking out the important bits of information from the problem, ignoring all the specific details that don’t matter

82
Q

what can structured query language (SQL) be used for?

A

to search tables (usually in a database) for specific data

83
Q

what are the records of a database?

A

the rows

84
Q

what are the fields of a database?

A

the columns

85
Q

what is the SELECT keyword followed by in SQL?

A

the names of the fields (columns) you want to retrieve and display

86
Q

what is the FROM keyword followed by in SQL?

A

the name of the table/s you want to search

87
Q

what does * mean in SQL?

A

return all fields

88
Q

what is the WHERE statement used for in SQL?

A

it’s used to specify conditions that a record must satisfy before it is returned

89
Q

which boolean operators can be used in SQL? when can they be used?

A

the boolean operators AND and OR can e used with WHERE to make more specific searches

90
Q

what can the LIKE statement be used for in SQL?

A

it can be used with WHERE to search for a pattern. In LIKE statements, the % character is used as a wildcard to represent any combination of letters and numbers

91
Q

write an SQL statement to select the name (hotel_name) and price (price) of all the hotels ending in “hotel” from a table called “hotels”

A

SELECT hotel_name, price FROM hotels WHERE hotel_name LIKE “%hotel”

92
Q

what does defensive design do?

A

programmers try to protect their algorithms through defensive design - it helps to ensure programs function properly