Section 3-Design, Testing and Transalators Flashcards

1
Q

What is structured programming?

A

Structured programming involves decomposing the program that you want to write into manageable modules. Each of those modules is then decomposed even further into smaller modules and eventually into modules that perform individual tasks.

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

How do you list a module?

A

You need to list the module’s name, any inputs, processes and the output return value if any.

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

Advantages of structured programming

A

Coding is easier because you’re only writing subroutines that can carry out simple tasks.

Lots of programmers can work on one program as each module can be written independently.

It’s easier to test structured programs as each can be tested individually.

Individual subroutines and modules can be fixed and updated without affecting the rest of the program.

You will be able to reuse the subroutines and modules in programs you write in the future.

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

What should a well maintained program enable you or others to do?

A

They should be able to change parts in your code without risking of causing problems elsewhere I the code.

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

What are the features that can improve the maintainability of the source code?

A

Comments are useful for explaining what the key features of a program do.

Indentation can be used to separate different statements in a program.

Variables, subroutines and parameters should be named so that they refer to what they are.

Only use global variables when necessary as they could affect the rest of the code.

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

What does authentication mean?

A

Authentication can confirm the identity of a user before they’re allowed to access certain pieces of data or feature of the program.

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

What does validation do?

A

Prevents users from accidentally or intentionally misusing a program.

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 into the program.

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

What are the different types of validation checks?

A

Range check- checks the data is within a specific range

Presence check- checks the data has actually been entered

Format check- checks the data has the correct format.

Look-up table- checks the data against a table of acceptable values.

Length check- checks the data is the correct length

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

What is a syntax error?

A

When the compiler or interpreter doesn’t understand something you have typed because it doesn’t follow the rules or grammar of the programming language.

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

What is a logic error?

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
12
Q

How can a syntax error be diagnosed?

A

It can be diagnosed by compilers and interpreters-they’ll be unable to turn the source code into machine code and a syntax error will be returned.

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

How can a logic error be diagnosed?

A

It more difficult to diagnose and track down- compilers and interpreters won’t pick them up. Logic errors are found through the 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
14
Q

What is a test plan?

A

A test plan will outline what you are going to test and how you’re going to test it. A good test plan will anticipate potential issues with the program and select appropriate test data to test for these issues.

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

What are the data types for the test data testing thing?

A

Normal data- things that a user is likely to input into the program.

Boundary data- values at the limit of what the program should be able to handle.

Erroneous data- inputs that the program should not accept.

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

What are trace tables?

A

Trace tables give a simple way of testing that a piece of code is working correctly. They keep track of the values that certain variables take as you go through the code.

17
Q

What is the main use of a trace table?

A

Their main use is to dry run a subroutine or algorithm to make sure there are no logic errors-they can also be used to figure out what a piece of code is actually doing.

18
Q

What do the columns and rows represent in a trace table?

A

The columns of a trace table usually represent variables. Each row of a trace table represent the values that the variables take a particular point in the algorithm.

19
Q

Which algorithms have a better time efficiency?

A

Algorithms that take less time to complete a task are said to have a better time efficiency.

When programmers talks about the amount of time an algorithm takes, they usually don’t measure the real-life time. They measure things like the number of times memory was accessed, the number of CPU cycles taken to execute commands or the number of times a loop was executed.

20
Q

What is high level language?

A

It’s when the source code is easy for humans to write, but computers need to translate it into machine code before they can read and write it.

21
Q

What is low level language?

A

Low level languages are tricky for humans to read and write but are easier for computers to run it.

22
Q

Uses of high level languages

A

One instruction of high level code represents many instructions of machine code.

The same code will work for many different machines and processors.

The programmer can easily store data in lots of different structures without knowing about the memory structure.

Code is easy to read, understand and modify.

Must be translated into machine code before a computer is able to understand it.

You don’t have much control over what the CPU actually does so programs will be less memory efficient and slower.

23
Q

Uses of low level languages

A

One instruction of assembly code usually only represents one instruction of machine code.

Usually written for one type of machine or processor and won’t work on any others.

The programmer needs to know about the internal structure of the CPU and how it manages memory.

Code is very difficult to read, understand and modify.

Command in machine code can be executed directly without the need for a translator.

You control exactly what the CPU does and how it uses memory efficient and faster.

24
Q

What are the three types of translators?

A

Assemblers, Compilers and interpreter

25
Q

What are assemblers used for?

A

Assemblers are used to turn assembly language into machine code.

26
Q

What are compilers and interpreters used for?

A

Both used to turn high-level code into machine code.

27
Q

Things on compilers

A

Translates all of the source code at the same time and creates one executable file.

Only needed once to create the executable file.

Returns a list of errors for the entire program once compiling is complete.

Once compiled the program runs quickly but compiling takes a long time.

28
Q

Facts on interpreters

A

Translates and runs the source code one instruction at a time, but doesn’t create an executable file.

Needed every time you want to run the program.

The interpreter will return the first error it finds and then stop- this is useful for debugging.

Programs will run more slowly because the code is being translated as the program is running.

29
Q

When are interpreters and compilers often used?

A

Interpreters are often used when you’re developing a software and compiler when you want to distribute software.