Search Header Logo
J277 2.3, 2.4 and 2.5 recap

J277 2.3, 2.4 and 2.5 recap

Assessment

Presentation

Computers

9th - 10th Grade

Practice Problem

Medium

Created by

Ollie Woods

Used 3+ times

FREE Resource

24 Slides • 42 Questions

1

2.3, 2.4 and 2.5 Revision

2

What's in 2.3?

Producing Robust Programs

  • Defensive design: Validation, verification, authentication

  • Maintainability

  • Testing: types, plans, data

  • Refining algorithms

3

Open Ended

Why do we want to make the programs we code as robust as possible?

4

Reasons for defensive design

  • Anticipating misuse

  • Making the program idiotproof! (probably best not to say that in an exam)

media

5

Validation

  • Making sure data entered into a program is reasonable and follows the rules the program needs it to follow!

  • For instance, say I want a user to enter their phone number...

6

Open Ended

What characteristics of a valid phone number could we validate in our program?

7

Types of validation

  • Range check - number/date is within an allowed range

  • Type check - data type is correct

  • Length check - not too long, not too short

  • Presence check - someone actually wrote something!

  • Format check - e.g. an email address or a postcode

8

Fill in the Blanks

Type answer...

9

Multiple Choice

What type of validation would be used on a field to enter a mobile phone number to ensure it contains 11 digits

1

Spell check

2

Lookup table

3

Presence check

4

Length check

10

Multiple Choice

What type of validation would be used on a field to check that data has been entered?

1

Spell check

2

Lookup table

3

Presence check

4

Length check

11

Multiple Choice

What type of validation is used to check that a value falls within the specified range

1

Spell check

2

Range check

3

Presence check

4

Length check

12

Verification

  • Making sure something has been typed in properly

  • Usually checked by making them type the thing in again!

13

Authentication

  • Making sure a user is who they say they are

  • This stops someone from accessing things they shouldn't be able to see!

14

Multiple Choice

Which one of these is NOT a form of authentication?

1

Password

2

Biometric (Face/Touch ID)

3

2FA

4

Typing your password in twice

15

Multiple Choice

Verification is important because...

1

It stops the program from crashing

2

You might type something wrong the first time and then you're locked out forever

3

It makes sure the correct user is using the program

4

It's important to make our code robust

16

Open Ended

How can we make sure that someone can't just keep trying passwords until they guess it correctly?

17

Writing maintainable programs

  • Programs need to be easy to understand... and also to edit

  • Other programmers may end up working on your code!

18

Methods of maintaining programs

  • Subprograms (functions and procedures)

  • Naming conventions

  • Indentation

  • # Comments

19

Multiple Select

Tick two methods to provide information for future users or programmers that may be required to maintain the code.

1

Complex code

2

Indentation

3

Comments

4

Concise variable name

20

Fill in the Blanks

Type answer...

21

Multiple Choice

Rowan has used the variable "playeronescore" in his program. Which of the following is the correct way of rewriting this in camel case?

1

PlayerOneScore

2

playeroneScore

3

playerOneScore

4

playerOnescore

22

Multiple Choice

Comments affect the code when it is run.

1

True

2

False

23

Open Ended

What's the difference between a function and a procedure in Python?

24

A mistake has been made when writing the program which causes unexpected results or behaviour.
The program will still run.

Logic error

The code written does not match the grammatical rules of the programming language.
The program will not run.

Syntax error

Errors

25

Multiple Choice

What type of error is this:

name = input("Enter your name)

print(name)

1

Syntax error

2

Logic error

3

There is no error

26

Open Ended

There is a logic error with the following code:

average = total * items

What is the logic error?

27

media

Tests...

How do we find errors?

28

Happens at the end of development.
Makes sure the program does what it's meant to and that all bugs are squashed!

Final/terminal testing

Happens throughout the development process.
Testing each new piece of code as it's written.

Iterative testing

Two types of test

29

Types of test data

Normal data: Fits within the expected range

Boundary data: On the edge (in or out!) of the expected range

Invalid data: Outside of the expected range

Erroneous data: Completely wrong data type!

30

Multiple Choice

A game asks a user to pick a number between 1 and 100.

Which one of these answers is normal test data?

1

67

2

345

3

0

4

"One hundred"

31

Multiple Choice

A game asks a user to pick a number between 1 and 100.

Which one of these answers is boundary test data?

1

67

2

345

3

0

4

"One hundred"

32

Multiple Choice

A game asks a user to pick a number between 1 and 100.

Which one of these answers is invalid test data?

1

67

2

345

3

0

4

"One hundred"

33

Multiple Choice

A game asks a user to pick a number between 1 and 100.

Which one of these answers is erroneous test data?

1

67

2

345

3

0

4

"One hundred"

34

Poll

How confident do you feel with 2.3?

Really confident

Confident enough

Not sure

Not confident

I need a lot more help!

35

What's in 2.4?

Boolean Logic

  • Logic gates

  • Truth tables

  • Problems with multiple logic gates

36

Fill in the Blanks

37

Multiple Choice

Question image
What kind of gate is this?
1
AND
2
NAND
3
OR
4
XAND

38

media

Both inputs have to be on/​1/TRUE in order for the output to be on/1/TRUE.

AND gate

39

Multiple Choice

Question image
What kind of gate is this?
1
OR
2
XOR
3
NOR
4
AND

40

media

Either input can be on/​1/TRUE in order for the output to be on/1/TRUE. If both are on/1/TRUE

OR gate

41

Multiple Choice

Question image
What kind of gate is this?
1
AND
2
NOT
3
OR
4
XOR

42

media

The input is inverted:

On becomes Off
Off becomes On

NOT gate

43

Open Ended

What do we use to record all of the possible combinations of inputs and outputs for a logic circuit?

44

Multiple Choice

Question image

Which gate is this the truth table for?

1

AND

2

OR

3

NOT

45

Problems with multiple gates

  1. Identify the inputs.

  2. Identify the output.

  3. Identify the gates!

  4. Write/draw out the circuit.

  5. Create and fill in the truth table - there should be (2 to the power of inputs) rows in the table.

46

Multiple Select

Tick all the inputs in this question:

In order for the lights to come on in the living room, the light switch must be turned on or there must be movement detected by the proximity sensor.

1

Lights

2

Light switch

3

Movement

4

Proximity Sensor

47

Multiple Choice

Which logic gate is required in this circuit?

1

AND

2

OR

3

NOT

48

Multiple Select

Identify the inputs in this logic circuit:

Customers have to be 15 years of age or older to see the film. They also need to either have a ticket or have the money to buy a ticket.

1

Age >= 15

2

See the film

3

Ticket

4

Money

49

Multiple Select

Tick all the gates required for the circuit:

Customers have to be 15 years of age or older to see the film. They also need to either have a ticket or have the money to buy a ticket.

1

AND

2

OR

3

NOT

50

Fill in the Blanks

Type answer...

51

Poll

How confident do you feel with 2.4?

Really confident

Confident enough

Not sure

Not confident

I need a lot more help!

52

What's in 2.5?

Programming Languages and IDE

  • High and low level languages

  • Translators

  • Purpose and features of an IDE

53

Multiple Choice

What type of language is Python?

1

High level

2

Low level

3

Assembly language

4

Machine code

54

Python is a high level language.

  • High level languages are close to English in syntax

  • This makes them easier for humans to read, write, understand and debug

  • High level languages often have multiple processor commands per line of code.

  • They must be translated into machine code to run.

55

Multiple Select

What type of language is this:

LDA 43
(tick multiple!)

1

High level

2

Low level

3

Assembly language

4

Machine code

56

LDA 45 is an example of assembly language.

  • This is a low level language that uses mnemonics.

  • Low level languages are closer to (or are!) the binary code that computers understand.

  • Different processor brands (Intel, AMD, ARM) use different codes.

  • One line of code performs one processor command.

57

Multiple Select

What type of language is this:

0010 1100
(tick multiple!)

1

High level

2

Low level

3

Assembly language

4

Machine code

58

0010 1110 is an example of machine code

  • This low level language is the binary code that the computer understands.

  • It is hard for humans to understand but those who can use it are able to control the processor with great precision!

59

Fill in the Blanks

Type answer...

60

  • Code is translated line by line

  • Errors flag immediately

  • You always need the source code and interpreter to run

Interpreter

  • All the code is translated at once

  • Errors are found at the end

  • Code is converted into an executable file

Compiler

Two types of translator

61

Multiple Choice

What sort of translator does IDLE use?

1

Compiler

2

Interpreter

62

Multiple Choice

All the games you play on your phones, computers and consoles use this type of translator.

1

Compiler

2

Interpreter

3

Assembler

63

Fill in the Blanks

Type answer...

64

Open Ended

What's the point in using an IDE over, say, Notepad?

65

Features of an IDE

  • Syntax highlighting - key words, variables etc in different colours

  • Runtime environment - I can run my code!!!

  • Error diagnostics - tells me what's wrong with my code

  • Translator built in

  • Code editor

  • Stepping, code folding and variable value listing

66

Poll

How confident do you feel with 2.5?

Really confident

Confident enough

Not sure

Not confident

I need a lot more help!

2.3, 2.4 and 2.5 Revision

Show answer

Auto Play

Slide 1 / 66

SLIDE