Computer science 2 Flashcards

(13 cards)

1
Q

3 Programming constructs

A

Sequence, Selection, Iteration

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

Difference between Sequence construct and Algorithmic thinking

A

Algorithmic thinking is used to create a set of step by step logical instructions but sequence executes this instructions in a specific order

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

AND, OR, NOT gates

A

AND A ^ B
OR A v B
NOT ¬ A

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

Defensive design 1 - Input validation

A

Tyra Ran Proudly Leaping Foxes
Type
Range
Presence (Has data been entered)
Length (No. of characters)
Format (dd/mm/yy)

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

Defensive design 2 - Anticipating misuse

A

‘Fail gracefully’

Division by 0
Communication error (option to restart connection)
Hard disk error (checks data in case corrupt or insufficient storage capacity)
Peripheral error (option for reprint in case no ink)

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

Defensive design 3 - Authentication

A

Username and password
Can limit number of login attempts to prevent brute force attacks

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

Defensive design 4 - Input sanitisation

A

Keeps data safe by removing harmful, unexpected data which can be used for SQL injections

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

Defensive design 5 - Maintainability

A

Comments
Relevant variable names
Indentation
Sub programs

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

4 IDE tools

A

Editor
Error diagnostics (break point)
Run time environment (allows program to run on computers and checks for run time errors
Interpreters/Compilers

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

Translation

A

Source code (high level language) converted to machine code (binary) using compiler or interpreter. Compilers require recompilation after editing and can’t pinpoint errors but they optimise code and allow it to run faster

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

SQL

A

SELECT (* or field)
FROM (table)
WHERE (condition)

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

2D arrays

A

2D=[[1,2,3],[3,2,1]]

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

File editing

A

File= open(“file.txt”,”w”)
File.write(“123”)
File.close()

“a” appends
“r” reads
“w” writes new file or overwrites existing one

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