S3 - Design, testing and translators (Done) Flashcards

1
Q

What is structured programming ?

A

Involves decomposing the program that you want to write into manageable modules, each of which is then further decomposed into smaller modules and then again until each module performs a single task. Which can be coded using simple subroutines which can be referenced in the overall program.

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

What does documenting the interface of a program ensue ?

A

Listing the modules name, any inputs, processes and the output/return value.

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

What are the advantages of structured programming ?

A

Coding is easier in small chunks, each module can be written independently so many people can work on it, it’s easier to test as each module can be tested, individual modules can be edited without affecting whole program and you can reuse subroutines in future programs.

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

Why should you keep your program well maintained ?

A

Makes it easy for other people to know what’s happening, and they should be able to change parts of the source code without causing problems elsewhere.

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

How can you keep a program well maintained ?

A

Comments - to explain whats happening at key points, indentation - to separate different statements, well named variables, subroutines and parameters - making it easier to keep track of them, and try to use local variables so changing them in subroutines won’t affect other parts of the program.

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

What is authentication ?

A

Used to increase security of programs, can confirm identity of a user before they’re allowed to access certain pieces of data or features of the program.

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

How can you increase the security of a password based authentication system ?

A

Force users to use strong passwords and get them to change regularly, limit number of failed attempts before an account ban, and ask for random selection of characters from the password on each authentication.

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

What is input validation ?

A

Checking if data meets certain criteria before passing it into the program.

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

What are some common types of input validation ?

A

Range check, presence check, format check, look-up table (compares against table of accepted values) and length check.

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

What are the types of programming error ?

A

Syntax errors or logic errors.

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

What is a syntax error ?

A

When the compilers or interpreters don’t understand something you’ve typed because it doesn’t follow rules or grammar of the programming language.

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

What is a logic error ?

A

When 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
13
Q

How can syntax errors be diagnosed ?

A

Using compilers and interpreters which will be unable to turn the incorrect source code into machine code so a syntax error with it’s location will be returned.

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

How can logical errors be diagnosed ?

A

Compilers and interpreters won’t pick them up - so they’re found through general use of the program and by systematically testing it using a testing plan.

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

What is a test plan ?

A

Plan to outline exactly what you’re going to test and how, should cover all possible paths of a program.

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

What should a good test plan contain ?

A

Should anticipate potential issues with the program and select appropriate test data to test for these issues.

17
Q

What three categories should test data fall under ?

A

Normal (typical) data - likely inputs, boundary (extreme) data - values at the limit of programs ability, and erroneous data - inputs that shouldn’t be accepted.

18
Q

What should a test plan table look like ?

A

Columns for ‘type of (test) data’, ‘test data’, ‘reason for testing’, ‘expected outcome’, ‘actual outcome’ and ‘pass or fail’.

19
Q

When do you use trace tables ?

A

When you’ve identified there’s a logic error - helps trace values variables take through the program to pin-point where something’s gone wrong.

20
Q

What are trace tables ?

A

Simple way to see what a piece of code is doing, and if it’s working correctly - each column in the trace table representing a variable, and each row represents the values variables take at points in the program.

21
Q

What deems an algorithms efficiency ?

A

The amount of ‘time’ they take to complete a task - smaller the ‘time’ taken the more efficient. Also its ‘space efficiency’ - how much space in the memory it takes up.

22
Q

What does the idea of ‘time’ mean in terms of an algorithms efficiency ?

A

Not the real-life time, things like the number of times memory was accessed, number of CPU cycles taken to execute commands or number of times a loop was executed.

23
Q

What is a high level programming language ?

A

One which is easier for humans to write, but computers need to translate into machine code before they can read and run it - as it’s written in a language closer to what people speak/write in.

24
Q

What is a low level programming language ?

A

Ones that are difficult for humans to read and write but easier for a computer to run - consisting of machine code and assembly languages.

25
Q

What is machine code ?

A

Series of 1s and 0s difficult for humans to understand - each processor or family of processors have their own specific machine code.

26
Q

What is assembly code ?

A

More readable for humans and more memorable, so programmers less likely to make mistakes. Often used when developing software for embedded systems or when they need more control over specific hardware.

27
Q

What are some advantages of high level languages ?

A

One instructions of high level equivalent to many in machine code, same code works for different processors, easy to store data in different structures without knowing about memory structure and easy to read, understand and modify.

28
Q

What are some disadvantages of high level languages ?

A

Must be translated into machine code before it’s understandable for computers and you have little control over what the CPU does specifically so it’ll be less memory efficient and slower.

29
Q

What are some advantages of low level languages ?

A

One instruction of assembly code equivalent to one in machine code, commands in machine code can be executed directly without a translator and you control what the CPU does and how it uses memory so it’ll be more memory efficient and faster.

30
Q

What are some disadvantages of low level languages ?

A

Usually written for one type of processor so won’t work on others, programmer needs to know about internal structure of the CPU and how it manages memory and difficult to read, understand and modify.

31
Q

What are translators for ?

A

Translating high level languages or assembly code into machine code.

32
Q

What are the translators ?

A

Assemblers, compilers and interpreters.

33
Q

What is an assembler ?

A

Used to turn assembly code into machine code, many different assembly languages to support different CPUs each one needing a unique assembler.

34
Q

What are compilers and interpreters for ?

A

Translating high level languages into low level languages.

35
Q

What does a compiler do ?

A

Translate whole source code at the same time and creates one executable file, returns list of errors for entire program once compiling completed, runs quickly after compiled but takes long time to do so, and only needed once to create executable file.

36
Q

What does an interpreter do ?

A

Translates and runs source code one instruction at a time, doesn’t create an executable file, needed every time you want to run a program, returns first error it finds then stops - useful for debugging, and program runs slowly because it’s translating while running.

37
Q

When are compilers used ?

A

For when you want to distribute software.

38
Q

When are interpreters used ?

A

When you’re developing software.

39
Q

Flashcards

A

Done!