Unit 8 - Logic and Languages Flashcards

(41 cards)

1
Q

What does 1 in binary represent?

A

TRUE

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

What does 0 in binary represent?

A

FALSE

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

What are Boolean Functions?

A

A function that always produces a true or false (1 or 0) value, regardless of the input values.

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

What are the 3 examples of Boolean Functions?

A

AND
OR
NOT

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

What is a truth table?

A

Shows the output from all possible combinations of inputs from a Boolean function
IF there are 2 inputs (A and B), there are 4 possible combinations of TRUE and FALSE.

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

How does an AND gate function?

A

IF both inputs are TRUE, then the output is TRUE
ELSE, the output is FALSE

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

How does an OR gate function?

A

IF either input is TRUE, then the output is TRUE
ELSE, IF both are not TRUE, then the output is FALSE

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

How does a NOT gate function?

A

IF the input is TRUE, then the output is FALSE
IF the input is FALSE, then the output is TRUE

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

What does Input/Data Validation do?

A

Ensures that data is of the right type and meets certain rules (should be reasonable)

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

What are the types of validation checks?

A

Range check: A number or date is within a sensible range
Type check: Data is of the right type (e.g. integer, letter or text)
Length check: Text entered is not too long or too short
Presence check: Checks that data has been entered
Format check: Checks if the format is correct

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

What is Input/Data Verification?

A

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

What are authentication routines used for?

A

Used to make sure a person is who they claim to be

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

What is anticipating misuse?

A

Preventing too many entries of a password to make it harder for hackers to guess

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

Why do programs need to be maintained?

A

To improve the code
Fix bugs
Add new features to the program

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

How should programs be written to be easily maintainable?

A

. The use of subprograms
. Using appropriate naming conventions
. Indentation
. Commenting

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

What is a subprogram?

A

Subprograms are small programs written within a larger main program. They perform a specific task, which may need to be done more than once at various points in the main program.

There are two types of subprograms:
Procedures
Functions

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

What are naming conventions?

A

Using good variables and sub program names to make the program easier to read

18
Q

What is indentation?

A

Makes programs easier to read by making it possible to see easily which lines of code are part of different structures

19
Q

What is commenting?

A

Helps programmers understand what a program does and how it does it. Normally it is in front of a function or procedure and explains what it does.

20
Q

What is an IDE?

A

An integrated development environment is a suite of tools that helps a programmer write error-free, maintainable code.
-It may give tips on the syntax of the statement you are typing
-Keywords and text in each of the statements are in different colours
-Automatic indentation

21
Q

What does an IDE typically provide you with?

A

. An editor (allows writing and correcting a program & helps in writing correct syntax
. A compiler/interpreter (to translate the program into machine code)
. Error Diagnostics (To point out syntax errors)
. Debug facilities ( going through the program line at a time to find logic errors)
. A runtime environment (to run the program)

22
Q

What are logic errors?

A

A logic error is an error in the way a program works. The program simply does not do what it is expected to do.
We can use a trace table to find the purpose, outputs and errors in the algorithm (for logic errors)

23
Q

What are syntax errors?

A

A syntax error occurs when code is written that does not follow the rules of the programming language.
Examples include:
.Misspelling a statement, e.g. writing pint instead of print
.Using a variable before it has been declared
.Missing brackets, e.g. opening a bracket but not closing it

24
Q

What is test data?

A

Test data is data that is used to test whether or not a program is functioning correctly.

25
What are the 3 types of test data?
Valid data: Sensible, possible data that a program should accept and be able to process. Boundary/extreme data: Valid data that falls at the boundary of any possible ranges. Invalid/Erroneous data: Data that a program cannot process and should not accept.
26
What are the 2 types of testing?
Iterative testing final/terminal testing
27
What is iterative testing?
Carried out using the test plan and trace tables until all the bugs are removed and the program produces the expected answers for every test
28
What is final testing?
Carried out when the program is completely finished and all parts of it have been separately tested
29
What is a low-level language?
A programming language that directly translates to machine code understood by the processor. Low-level languages allow direct control over hardware components such as memory and registers These languages are written for specific processors
30
What are two examples of low level languages?
Machine code Assembly language
31
What is machine code?
Represents how computer hardware and CPUS understand instructions. It is represented by either binary or hexadecimal numbers.
32
What is assembly language?
A low-level programming language closely related to machine code. Assembly language uses mnemonics (short abbreviations like STA - Store). Each mnemonic directly corresponds with a machine code instruction.
33
What are some advantages of low level languages?
. Complete control over the system components . Occupies less memory and executes faster . Direct manipulation of hardware
34
What are some disadvantages of low level languages?
. Difficult to write and understand . Machine dependent . More prone to errors . Knowledge of computer architecture is key to programming effectively
35
What is a high level language?
A high-level programming language uses English-like statements to allow users to program with easy-to-use code High-level languages allow for clear debugging, and once programs are created, they are easier to maintain One instruction translates into many machine code instructions Needs to be translated into machine code for the computer to be able to execute it e.g. Java, Python, C++, C#, JavaScript
36
What are some advantages of high level languages?
. Easier to read and write . Easier to debug . Portable so can be used on any computer . One line of code can perform multiple commands
37
What are some disadvantages of high-level languages?
. The user is not able to manipulate the hardware . Needs to be translated into machine code before running . The program may be less efficient
38
What is a compiler?
A type of program that translates high-level language into machine code. The source code (code written by the programmer) goes through the compiler to produce the object code ( the machine code produced by the compiler)
39
What is an interpreter?
A type of program that translates high-level language into machine code, but unlike a compiler, no object code is produced. It translates and executes each line of code immediately. If it reaches a syntax error, it stops and displays the message.
40
What are some differences between a compiler and a interpreter?
Compiler - Translates the whole program to produce object code Interpreter - Translates and executes one line at a time Compiler - Executes faster as it is already in machine code Interpreter - Takes more time as each instruction is translated before executed Compiler - Customer can not see the code Interpreter - Customer can see the source code, so they could copy it Compiler - does not need to be present when object code is running Interpreter - needs to installed to run the program
41
What is an assembler?
A program that translates assembly languages into machine code.