凹凸雅思
首页闪卡复习GCSECOMPUTER-SCIENCE9 producing robust programs

defensive design and testing

使用闪卡高效复习COMPUTER-SCIENCE科目知识点

共计闪卡

58

9 producing robust programs

闪卡自测

进度: 1 / 58已掌握: 0 | 需要复习: 0
问题

What is defensive design?

点击查看答案
请先阅读问题,然后点击卡片查看答案

所有闪卡

闪卡 1

问题

What is defensive design?

查看答案

答案

Defensive design is an approach to software development where every possible input from a user is considered to anticipate all of the ways a user could misuse a program.

闪卡 2

问题

Define robust (programming)

查看答案

答案

Robust is ensuring that the final program is reliable for all users.

闪卡 3

问题

True or False? All errors in software can be foreseen by the developer when writing the software.

查看答案

答案

False. Some errors can occur in software that cannot be foreseen by the developer when writing the software.

闪卡 4

问题

Define peripheral errors

查看答案

答案

Peripheral errors are caused when peripherals don't perform as intended. For example, printers running out of paper, ink or having a paper jam.

闪卡 5

问题

Define disk errors

查看答案

答案

Disk errors are errors that can occur on disk drives like running out of disk space, files/folders not being found, or corrupted files.

闪卡 6

问题

Define communication errors

查看答案

答案

Communication errors are errors that can occur when a program's connection to a host server is lost.

闪卡 7

问题

What is authentication?

查看答案

答案

Authentication is the process of ensuring that a system is secure by asking the user to complete tasks to prove they are an authorised user of the system.

闪卡 8

问题

State the meaning of CAPTCHA

查看答案

答案

A CAPTCHA is a method of authentication where a user must complete a task to prove they are not a bot submitting data.

闪卡 9

问题

True or False? Allowing users to recover passwords via email/SMS codes is a method of authentication.

查看答案

答案

True. Allowing users to recover passwords via email/SMS is a method programmers can use to authenticate users.

闪卡 10

问题

True or False? Authentication is not needed because bots cannot submit data in online forms.

查看答案

答案

False. Authentication is done because bots can submit data in online forms.

闪卡 11

问题

What is input validation?

查看答案

答案

Input validation is code which is used to check that an input from a user is acceptable and that it matches the requirements of the program.

闪卡 12

问题

Length check

查看答案

答案

A length check is a type of input validation that checks the length of a string input. E.g. ensuring a password is more than 8 characters

闪卡 13

问题

Type check

查看答案

答案

A type check is a type of input validation that checks the data type of a field input. E.g. ensuring a user's age has been entered as an integer

闪卡 14

问题

Range check

查看答案

答案

A range check is a type of input validation that ensures a numeric input falls within a particular range. E.g. a user's age falls between the digits 0-110

闪卡 15

问题

Presence check

查看答案

答案

A presence check is a type of input validation that checks if any data has been entered in a field. E.g. a user's name field has not been left blank

闪卡 16

问题

Format check

查看答案

答案

A format check is a type of input validation that ensures the data has been entered in the correct format. E.g. a date has been entered as DD/MM/YYYY

闪卡 17

问题

True or False? There can be occasions where only one type of input validation is used on a field.

查看答案

答案

False. There can be occasions where more than one type of validation will be used on a field.

闪卡 18

问题

What are the 5 main categories of input validation?

查看答案

答案

The 5 main categories of input validation are:

闪卡 19

问题

password = "letmein" State the Python code to check the length of the string password

查看答案

答案

password_length = len(password)

闪卡 20

问题

State the meaning of isdigit()

查看答案

答案

The isdigit() method checks if a string contains only digits. It returns True if all characters are digits, False otherwise.

闪卡 21

问题

What is program maintainability?

查看答案

答案

Program maintainability is used to ensure programmers can easily understand what a program is doing months or years after having first written it.

闪卡 22

问题

Commenting of code (maintainability)

查看答案

答案

Commenting of code is used for program maintainability to explain the purpose of the code in a particular section.

闪卡 23

问题

White space (maintainability)

查看答案

答案

White space is used for program maintainability to make each section clear and easy to see.

闪卡 24

问题

Indentation (maintainability)

查看答案

答案

Indentation is used for program maintainability to show each instance of selection and iteration and make it clear which code belongs to which clause.

闪卡 25

问题

Sensible variable names (maintainability)

查看答案

答案

Sensible variable names are used for program maintainability so the name explains what the variable or data structure does to prevent confusion.

闪卡 26

问题

Use of sub-programs (maintainability)

查看答案

答案

Using sub-programs like functions or procedures is for program maintainability to split code into reusable sections and increase overall structure.

闪卡 27

问题

True or False? Program maintainability is not important when programming alone.

查看答案

答案

False. Program maintainability is important to ensure the programmer can understand the code months or years later.

闪卡 28

问题

What are the benefits of using maintainability features like comments and whitespace?

查看答案

答案

Using maintainability features makes the code easier to:

闪卡 29

问题

Define debugging

查看答案

答案

Debugging is the process of finding and resolving errors or defects within a program.

闪卡 30

问题

What features promote maintainability?

查看答案

答案

The features that promote maintainability are:

闪卡 31

问题

What are the four main purposes of testing?

查看答案

答案

The purpose of testing programs is:

闪卡 32

问题

Iterative testing

查看答案

答案

Iterative testing is a type of testing where each part of the program is tested during the development of the program.

闪卡 33

问题

Final testing

查看答案

答案

Final testing is a type of testing done at the end of development.

闪卡 34

问题

True or False? Iterative testing involves running the code each time while developing to test it.

查看答案

答案

True. Iterative testing means repeatedly testing the program while continuing to make changes and improvements during development.

闪卡 35

问题

What are the two main types of testing?

查看答案

答案

The two main types of testing are iterative testing and final testing.

闪卡 36

问题

Normal data

查看答案

答案

Normal data is data that falls within the expected range for testing a program against real data during final testing.

闪卡 37

问题

Boundary data

查看答案

答案

Boundary data is data at the minimum or maximum values of the expected range for testing during final testing.

闪卡 38

问题

Erroneous data

查看答案

答案

Erroneous data is invalid or incorrect data used for testing to check how the program handles errors during final testing.

闪卡 39

问题

True or False? Alpha and beta testing are types of iterative testing.

查看答案

答案

False. Alpha and beta testing are types of final testing.

闪卡 40

问题

Performing a test on a name field. What type of test data is "99"?

查看答案

答案

Erroneous

闪卡 41

问题

Define syntax error

查看答案

答案

A syntax error is an error that breaks the grammatical rules of a programming language and stops it from running.

闪卡 42

问题

Define logic error

查看答案

答案

A logic error is incorrect code that allows the program to run, but produces an incorrect or undesired output.

闪卡 43

问题

True or False? Syntax errors are easily identifiable because the IDE provides information about the error.

查看答案

答案

True. Syntax errors are easily identifiable as the IDE will provide information about what the error is to help fix it.

闪卡 44

问题

What should you look at when the IDE error message points to a line after the actual error line?

查看答案

答案

Look at the line of code above the one given in the error message, as that may contain the actual syntax error.

闪卡 45

问题

name = input("Enter your name"Print("Nice to meet you, name) Identify three syntax errors

查看答案

答案

name = input("Enter your name")print("Nice to meet you", name) Line 1: missing bracketLine 2: uppercase P on print functionLine 2: missing "

闪卡 46

问题

True or False? Logical and Boolean operators are common causes of logic errors.

查看答案

答案

True. Areas to check for logic errors are logical operators (<, >, ==, !=), Boolean operators (AND, OR, NOT) and division by 0.

闪卡 47

问题

age = input(int(input("Enter your age: "))if age > 11 or age < 18: print("You are now in secondary school!")else: print("You are not in secondary school!") A user enters 21 as their age. Identify the logic error.

查看答案

答案

age = input(int(input("Enter your age: "))if age > 11 or age < 18: print("You are now in secondary school!")else: print("You are not in secondary school!") Entering 21 outputs "You are now in secondary school!" exposing that the incorrect Boolean operator OR was used instead of AND.

闪卡 48

问题

True or False? A logic error is easier to find than a syntax error.

查看答案

答案

False. Logic errors are harder to find than syntax errors as the program still runs, making it more difficult to find them

闪卡 49

问题

Define normal test.

查看答案

答案

A normal test is when the user enters data that should be accepted in the program.

闪卡 50

问题

Define boundary test.

查看答案

答案

A boundary test is when the user enters data that is on the edge of what is acceptable.

闪卡 51

问题

Define erroneous test.

查看答案

答案

An erroneous test is when the user enters data of the wrong data type.

闪卡 52

问题

Define invalid test.

查看答案

答案

An invalid test is when the user enters data of the right data type but outside of what is accepted.

闪卡 53

问题

What are the 4 main categories of tests?

查看答案

答案

The 4 main categories of tests are:

闪卡 54

问题

name = input("What is your name? ")age = int(input("How old are you? "))if age >=12 and age <=18: print("Welcome, " + name + "! Your age is accepted.")else: print("Sorry, " + name + "! Your age is not accepted.") Give an example of a normal test.

查看答案

答案

Example normal test:

闪卡 55

问题

name = input("What is your name? ")age = int(input("How old are you? "))if age >=12 and age <=18: print("Welcome, " + name + "! Your age is accepted.")else: print("Sorry, " + name + "! Your age is not accepted.") Give an example of a boundary test.

查看答案

答案

Example boundary test:

闪卡 56

问题

name = input("What is your name? ")age = int(input("How old are you? "))if age >=12 and age <=18: print("Welcome, " + name + "! Your age is accepted.")else: print("Sorry, " + name + "! Your age is not accepted.") Give an example of a erroneous test.

查看答案

答案

Example erroneous test:

闪卡 57

问题

name = input("What is your name? ")age = int(input("How old are you? "))if age >=12 and age <=18: print("Welcome, " + name + "! Your age is accepted.")else: print("Sorry, " + name + "! Your age is not accepted.") Give an example of a invalid test.

查看答案

答案

Example invalid test:

闪卡 58

问题

True or False? Invalid tests are important to check the robustness of a program.

查看答案

答案

True. Invalid tests are carried out to test the robustness of the program.