Logic and Languages 2 Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

What is defensive design?

A

An approach to software development that aims to produce robust and reliable programs.

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

What is the purpose of authentication?

A

To ensure a person is who they claim to be

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

What are some examples of anticipating misuse?

A
  • Malicious inputs
  • Attempts to remotely connect
  • Attempts to alter access rights
  • Brute Force Attacks
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What are brute-force-attacks?

A

Software programs which will try out every combination of letters, numbers and special character

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

What is data validation?

A

Checks data meets a set of criteria before you process it and can ensure that data entered is of the right type.

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

What are the types of validation checks?

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

What is the difference between validation and verification?

A

Validation can only check that the data entered is reasonable
Verification is used to double-check that the data has been typed in correctly

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

What is double-entry verification?

A

Entering data twice

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

Range check

A

A number or date is within a sensible/allowed range

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

Type check

A

Data is of the right type, such as integer, letter or text

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

Length check

A

Text entered is not too long or too short – for example, a password is between 8 and 15 characters

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

Presence check

A

Checks that data has been entered, i.e. the field has not been left blank

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

Format check

A

Checks that the format of, for example, a postcode or email address is correct

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

How can programs be written in a way that makes them easily maintainable?

A

Indentation
Commenting
Use of sub programs
Appropriate naming conventions

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

Why are sub programs used?

A

To create code that can be reused multiple times in the program or by other programs, and allows bugs to easily be fixed

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

What are appropriate naming conventions?

A

It involves good use of variable and sub program names to make the program easier to read and understand

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

Why is indentation used?

A

Indentation makes it easier to see which lines of code are part of different structures (show nesting) - easier to read

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

Why is commenting used?

A

Commenting helps programmers understand what a program does and how it does it

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

What are the types of errors?

A

syntax error

logic error

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

What is a syntax error?

A

A syntax error is one where the programming code written doesn’t conform to the rules of the language

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

Why does a syntax error appear?

A

The compiler doesn’t know how to translate the program into machine code so will give the programmer a syntax error. The program cannot be run until all syntax errors are fixed

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

What is a logic error?

A

Logic errors appear when the program’s execution appears to run as normal, but not as the programmer intended

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

What are the types of testing?

A

iterative testing

final/terminal testing

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

What is iterative testing?

A

Iterative testing tests modules and parts of a program as the program is developed

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

What is final testing?

A

Final testing tests the whole program at the end of production

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

What does a test plan test for?

A

Normal data
Boundary data
Invalid/Erroneous data

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

What is normal data?

A

Normal data is test data that is typical (expected) and should be accepted by the system. A number between 0-100, e.g. 5

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

What is boundary data?

A

Boundary data is test data at the upper or lower limits of expectations that should be accepted by the system. A number between 0-100, e.g. 0 and 100.

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

What is erroneous data?

A

Erroneous data is test data that falls outside of what is acceptable and should be rejected by the system. A number between 0-100, e.g. “ade”

30
Q

What is a trace table?

A

This is where the programmer goes through the code, line by line, updating the values of variables and outputs

31
Q

What is a trace table useful for?

A

Determining the purpose of an algorithm
Finding the output of an algorithm
Finding errors in an algorithm

32
Q

How is a trace table used to help find errors in a program?

A

Variable names and outputs are put in columns. The programmer traces through the program line by line updating the values of variables and outputs. A row is used for each iteration.

33
Q

How are logic errors found?

A

using a trace table

using the print statement

34
Q

What is the purpose of testing?

A

To find errors and determine (then patch) vulnerabilities so the program functions as intended

35
Q

What is a truth table?

A

A truth table is a method of representing every possible output based on the inputs to a Boolean expression.

36
Q

What is NOT also known as?

A

negation

37
Q

What is OR also know as?

A

disjunction

38
Q

What does an AND operator do?

A

Only returns true if both conditions are true, else it returns false.

39
Q

What does the OR operator do?

A

The operator returns true if either of the conditions are true. It only returns false if both conditions are false

40
Q

What does the NOT operator do?

A

Takes one input and reverses it

41
Q

What do Boolean operators do?

A

Take Boolean inputs and evaluate to a Boolean value

42
Q

How do you find out the number of rows on your truth table?

A
Do 2 (base) to the power of n (the number of inputs)
E.g. 2^3 = 8 rows
43
Q

What is machine code?

A

Is written in binary and is the language all code is translated to as it is in a format the CPU can process

44
Q

What are some examples of low level language?

A

Machine code

Assembly language

45
Q

What is assembly language made up off?

A

simple mnemonics (or text)

46
Q

Why is assembly language a low level language?

A

As each instruction corresponds directly to a machine code instruction (have an almost one-to-one relationship with machine code)

47
Q

What are the disadvantages of assembly language?

A

It is processor-specific
It has to be translated into machine code before it can be executed
It requires more lines of code

48
Q

What are the advantages of low level languages?

A

It can be executed faster
Code requires less RAM
Statements in LLL can be used to control and manipulate hardware

49
Q

What are the advantages of high level languages?

A

Easier to learn
Programs can be written faster in a high-level language
It is easier to understand and debug a high-level language
Uses fewer lines of code
Not hardware-specific (portable) - therefore can be executed on many computers with the correct translator

50
Q

What are high level languages?

A

They are programming languages that are similar to the human language

51
Q

What is a compiler?

A

Scans through the whole code and translates the instructions in a HLL into machine code. It produces object code that cannot be edited or adapted.

52
Q

What is the code produced by a programmer called?

A

Source Code

53
Q

Where can object code be saved in?

A

A storage drive (in either a library file, executable file or object file) and run whenever required

54
Q

What is an interpreter?

A

It translates instructions in a HLL into machine code. It works line-by-line, it translates a line and then immediately executes it.

55
Q

What are the advantages of an interpreter?

A

If it reaches a line with a syntax error, it stops and displays an error message
It translates each line of code and executes it immediately

56
Q

What are the disadvantages of an interpreter?

A

Takes more time to execute as each instruction is translated before it is executed
The interpreter must be installed to run the program
Source code can be edited or adapted

57
Q

What are the advantages of a compiler?

A

A compiled program executes faster as it is already in machine code
Once compiled, the compiler and source code is no longer required
Once compiled, source code cannot be edited or adapted

58
Q

What are the disadvantages of a compiler?

A

It scans through the whole code and then displays a list of errors

59
Q

What are examples of a High-level language?

A
Ruby 
C# 
C++
Java 
Python
60
Q

What are the types of translators?

A

Assembler
Compiler
Interpreter

61
Q

What is bytecode?

A

Bytecode is source code that has been compiled into low-level code and can be interpreted on many different types of processors using an interpreter. It is an intermediate stage between high-level and low-level language.

62
Q

What is an IDE?

A

It is an Integrated Development Environment. An application that provides a selection of tools for programmers, allowing them to code using additional tools all in one place

63
Q

What are some examples of IDEs?

A

Visual Studio (C#)
Eclipse (Java)
IDLE (Python)

64
Q

What are some features of an IDE?

A
Line Numbers
Syntax Highlighting
Error Diagnostics
Runtime Environments
Code Folding
Debugging Tools
Translator
65
Q

What do line numbers do?

A

Line numbers allow a programmer to clearly see each new line of code
When errors are found, the line number that they occur on will also be stated

66
Q

What does syntax highlighting do?

A

Syntax highlighting is where the colour of the text changes to show different parts of the program.
Errors are also highlighted/underlined within the code.

67
Q

What do error diagnostics do?

A

Error diagnostics help a programmer to find where they have made a mistake

68
Q

What does debugging code involve?

A

The use of breakpoints - which are set by the programmer so that the IDE stops the program mid-way through running
They allow the programmer to step through code line by line and watch variables as they change

69
Q

What does a run-time environment do?

A

The run-time environment allows a programmer to test their program while it is running. It goes useful information to the programmer if the program was to crash.

70
Q

Why are editors used?

A

They are used to write and edit programming code

71
Q

What is a translator?

A

A program that converts code from one language into equivalent code written in another - as all code needs to be translated to machine code in order to run

72
Q

What is a test plan?

A

A test plan is a list of requirements designed to ensure that the code functions as intended.