Unit 8 - Logic and languages Flashcards

You may prefer our related Brainscape-certified 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
Q

What are the 5 types of testing?

A
  • Final
  • Iterative
  • Normal
  • Boundary
  • Erroneous
26
Q

What is final testing?

A

Completed at the end of development to test the program as a whole.

27
Q

What is iterative testing?

A

.Completed during development after each module is completed. Tests module seperately.

28
Q

What is normal testing?

A

Test using data that should be accepted

29
Q

What is boundary testing?

A

Test using data that is on the edge of being acceptable / unacceptable. Test highest / lowest value

30
Q

What is erroneous testing?

A

Test using data that should be rejected

31
Q

What is the difference between final and iterative testing?

A

Iterative is during development and Final is when the development is complete.

32
Q

How do you identify logical errors?

A

Trace table

33
Q

What is a trace table?

A

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
Q

What are trace tables useful for?

A
  • Determining the purpose of an algorithm
  • Finding the output of an algorithm
  • Finding errors in an algorithm
35
Q

What are the 2 types of programming languages?

A
  • High-level
  • Low-level
36
Q

What is assembly language?

A
  • 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
Q

What are high level languages?

A

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
Q

What are advantages of high level languages?

A

Easier for humans to write. Easier/quicker to
remember. Easier to maintain / debug because code uses English words.

39
Q

What is advantage of low level language?

A
  • It allows the user to directly manipulate memory
  • A program can run very quickly
  • The code will usually require less RAM
40
Q

Why does high level language need to be translated?

A

The computer can only understand machine code.

41
Q

What are the 2 ways to translate high level language?

A

Compiler
Interpreter

42
Q

How does a compiler work?

A

Compiler translates code in one go and produces an executable file

43
Q

How does an interpreter work?

A

Interpreter translates code line by line which will be translated every time it is run.

44
Q

Features of compiler

A
  • 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
Q

Features of interpreter

A
  • translates one line at a time
  • longer to execute
  • interpreter must be installed to run program
  • ## source code can be adapted
46
Q

What are IDEs?

A

Provide tools and features that help programmers when programming

47
Q

What are the IDE tools provided?

9 features

A
  • Translator
  • Runtime environment
  • Error diagnostics
  • Breakpoints
  • Code editor
  • Keyword highlighting
  • Variable watch
  • Syntax suggestion
  • Stepping
48
Q

What does translator do?

A

converts the high level code into machine code to enable to code to be run

49
Q

What does runtime environment do?

A

allows program/code to be run + shows output of the program/code

50
Q

What does error diagnostics do?

A

identify location/detail of errors

51
Q

What does break points do?

A

will allow the program to stop at a
chosen / set position

52
Q

What does code editor do?

A

allows program code to be written/changed + allows errors to be fixed

53
Q

What does keyword highlighting do?

A

allows keywords/variables to be
coloured and identified

54
Q

What does variable watch do?

A

see the contents/data held in variables

55
Q

What does syntax suggestion do?

A

suggests/corrects code

56
Q

What does stepping do?

A

execute/run the program line by line