Design, Testing and Translators Flashcards

1
Q

What is structured programming?

A

Structured programming decomposes the program that you want to write into manageable modules. Each of these 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

Give some advantages of using structured programming.

A

1) coding is easier because you’re only writing subroutines that carry out very simple tasks
2) lots of programmers can work on one program as each module can be written independently
3) it’s easier to test structured programs as each module can be tested individually
4) individual subroutines and modules can be fixed and updated without affecting the rest of the program
5) 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
3
Q

Give some features of maintainable source code.

A

1) comments are useful for explaining what the key features of a program do
2) indentation can be used to separate different statements in a program
3) variables, subroutines and parameters should be named so that they refer to what they actually are
4) only use global variables when necessary as they could affect the rest of your code

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

What is authentication?

A

Authentication can confirm the 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
5
Q

Why is authentication used?

A

Authentication is used to improve security

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

What can be done to make a password-based authentication system more secure?

A

1) force users to use strong passwords and get them to change their passwords regularly
2) limit the number of failed authentication techniques before access to an account is lost
3) ask for a 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
7
Q

Define the term ‘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
8
Q

Give some input validation checks.

A

1) range check
2) presence check
3) format check
4) look-up table
5) length check

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

Define the term ‘syntax error’.

A

When the compiler or interpreter doesn’t understand something you’ve 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
10
Q

Define the term ‘logic error’.

A

When the compiler or interpreter is able to run the program but the program does something unexected

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

Why are logic errors more difficult to diagnose than syntax errors?

A

Compilers and interpreters won’t pick them up

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

What are the three different types of test data?

A

1) normal (typical) data
2) boundary (extreme) data
3) erroneous data

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

What are trace tables used for?

A

Dry running a subroutine or algorithm to make sure there are no logic errors

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

What is time efficiency?

A

The amount of time it takes an algorithm to complete a task

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

Define ‘machine code’.

A

Low-level code that represents how computer hardware and CPUs understand instructions. It is represented by binary numbers

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

Define ‘assembly language’.

A

Low-level programming language closely related to machine code

17
Q

Give an example of machine code.

A

000000 00010 00011 00100 00000 100000

18
Q

Give an example of assembly language.

A

ADD r4, r3, r3

19
Q

Give some characteristics of high-level languages.

A

1) one instruction represents many instructions of machine code
2) the same code will work for many different machines and processors
3) the programmer can easily store data in lots of different structures without knowing about the memory structure
4) code is easy to read, understand and modify
5) must be translated into machine code before a computer is able to understand it
6) you don’t have much control over what the CPU actually does so programs will be less memory efficient and slower

20
Q

Give some characteristics of low-level languages.

A

1) one instruction of assembly code usually only represents one instruction of machine code
2) usually written for one type of machine or processor and won’t work on any others
3) the programmer needs to know about the internal structure of the CPU and how it manages the memory
4) code is very difficult to read, understand and modify
5) commands in machine code can be executed directly without the need for a translator
6) you control exactly what the CPU does and how it uses memory so programs will be more memory efficient and faster

21
Q

What are the three types of translators?

A

1) assemblers
2) compilers
3) interpreters

22
Q

What are assemblers used for?

A

To turn assembly language into machine code

23
Q

What are compilers and interpreters used for?

A

To turn high-level code into machine code

24
Q

Give some characteristics 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

25
Q

Give some characteristics of interpreters.

A

1) translates and runs 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