Unit 8 - Logic and languages Flashcards

1
Q

What is the purpose of a truth table?

A

To show all possible inputs and the corresponding outputs

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

What are the 5 types of defensive design?

A
  • Input sanitation
  • Validation
  • Verification
  • Authentication
  • Maintainabe code
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is input sanitation?

A

Input sanitisation cleaning up input data / removing
unwanted data e.g. removing special characters / preventing SQL injection

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

What is validation?

A

Checking whether input data should be allowed / is sensible / follows criteria

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

What are the 6 types of input validation checks?

A
  • Range
  • Type
  • Presence
  • Length
  • Format
  • Table
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What does a range check do?

A

checks boundaries

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

What does a type check do?

A

making sure the data inputted is of the
correct data type

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

What does a presence check do?

A

making sure a value is inputted / not
blank

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

What does a length check do?

A

limit number of characters // check
maximum / minimum string length

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

What does a format check do?

A

making sure the data inputted follows a
set pattern

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

What does a table check do?

A

making sure the data inputted is one from an allowed set of values

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

What is verification?

A

checks whether data has been entered correctly

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

What is authentication?

A

Authentication ensures only authorised users can gain access e.g using password

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

How does password routine work?

A

Commonly, you are asked to enter a User ID
and a password. Once you have entered the User ID, the website looks up your password in a database. If the user ID cannot be found, an error message is displayed

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

What is program maintainablility?

A

It is important that programs are written in a way to make them easily maintainable to allow other programmers to understand the code.

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

What are the 4 ways to maintain a program?

A
  • Comments
  • Meaningful variables
  • Modularise
  • Indentation
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

How does commenting improve maintainability?

A

Enables programmers to understand the purpose of each line / section

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

How does naming variales sensibly improve maintainability?

A

to enable programmers to understand the purpose of each variable

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

How does modularisation improve maintainability?

A

allows reuse / makes easier to test / reduces errors e.g. create as a function

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

How does indentation improve maintainability?

A

Indentation makes it possible to easily see which lines of code are part of different structures

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

What are the 2 types of errors?

A
  • Syntax error
  • Logical error
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

What is a logical error?

A
  • An error that results in incorrect output / unexpected result
  • Contains an error but still runs
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

What is a syntax error?

A
  • An error that breaks the rules of the programming language
  • Contains an error but will not run / execute
24
Q

Why is testing important?

A
  • Check the program works as intended and meets user requirements.
  • gives the correct output / result
  • detect errors
25
What are the 5 types of testing?
- Final - Iterative - Normal - Boundary - Erroneous
26
What is final testing?
Completed at the end of development to test the program as a whole.
27
What is iterative testing?
.Completed during development after each module is completed. Tests module seperately.
28
What is normal testing?
Test using data that should be accepted
29
What is boundary testing?
Test using data that is on the edge of being acceptable / unacceptable. Test highest / lowest value
30
What is erroneous testing?
Test using data that should be rejected
31
What is the difference between final and iterative testing?
Iterative is during development and Final is when the development is complete.
32
How do you identify logical errors?
Trace table
33
What is a trace table?
A trace table is useful for tracing through a program in order to find a logic error. The value of each variable is recorded as it changes.
34
What are trace tables useful for?
- Determining the purpose of an algorithm - Finding the output of an algorithm - Finding errors in an algorithm
35
What are the 2 types of programming languages?
- High-level - Low-level
36
What is assembly language?
- Assembly language is processor-specific - It has to be translated into machine code before it can be executed - As each instruction corresponds directly to a machine code instruction, it is known as a low-level language
37
What are high level languages?
Uses English-like keywords such as print and while Must be translated before the processor can execute code. Code written is portable between different processors.
38
What are advantages of high level languages?
Easier for humans to write. Easier/quicker to remember. Easier to maintain / debug because code uses English words.
39
What is advantage of low level language?
- It allows the user to directly manipulate memory - A program can run very quickly - The code will usually require less RAM
40
Why does high level language need to be translated?
The computer can only understand machine code.
41
What are the 2 ways to translate high level language?
Compiler Interpreter
42
How does a compiler work?
Compiler translates code in one go and produces an executable file
43
How does an interpreter work?
Interpreter translates code line by line which will be translated every time it is run.
44
Features of compiler
- Translate whole program = object code - Executes faster, already in machine code - Compiler doesn't need to be present to run object code - Code cannot be adapted
45
Features of interpreter
- translates one line at a time - longer to execute - interpreter must be installed to run program - source code can be adapted -
46
What are IDEs?
Provide tools and features that help programmers when programming
47
What are the IDE tools provided? | 9 features
- Translator - Runtime environment - Error diagnostics - Breakpoints - Code editor - Keyword highlighting - Variable watch - Syntax suggestion - Stepping
48
What does translator do?
converts the high level code into machine code to enable to code to be run
49
What does runtime environment do?
allows program/code to be run + shows output of the program/code
50
What does error diagnostics do?
identify location/detail of errors
51
What does break points do?
will allow the program to stop at a chosen / set position
52
What does code editor do?
allows program code to be written/changed + allows errors to be fixed
53
What does keyword highlighting do?
allows keywords/variables to be coloured and identified
54
What does variable watch do?
see the contents/data held in variables
55
What does syntax suggestion do?
suggests/corrects code
56
What does stepping do?
execute/run the program line by line