design, testing and IDE's Flashcards

1
Q

how to promote maintainability

A

Comments
Indentation
Procedures/ Functions
Descriptive variable names
Constants declared at top of code

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

reasons for testing

A

To ensure:
-no bugs in code
-acceptable performance and usability
-unauthorized access prevented
-program meet requirements

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

describe iterative testing:
e/ new mod…
pro branches….
checking new mods don’t…
handles situations….

A

-each new module tested as it’s written
-checking new modules don’t introduce new errors into existing code
-ensures program handles erroneous data and exceptional situations

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

when is final testing performed

A

when development of program is considered finished

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

describe final testing

A

-testing all modules work together
-ensures valid results produced
-beta test may find more errors

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

State how many parameters are passed into the giveChange() subroutine.

giveChange(money – price)

A

1
Two variables are inside the brackets. Candidates did not recognise this as a calculation.This calculation would be completed before the function call. Only the result is passed into the function as the parameter. So it’s 1.

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

A car dealership uses a computer system to record details of the cars that it has for sale.

Each car has a make,model, age and number of miles driven.The car dealership only sells cars that have fewer than 10 000 miles and are 5 years old or less.

*ask the user to enter the number of miles and the age of a car
*validate the input to check that only sensible values that are in the given range are entered
*output True if valid data has been entered or False if invalid data has been entered.

A

miles = input (“enter miles driven”)
age = input (“enter age of car”)
valid = True
if miles > 10000 or miles < 0 then
___valid = False
elseif age > 5 or age < 0 then
___valid = False
endif
print(valid)

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

Robust Programming features:

A

-writing code that anticipates range of possible inputs
can be valid or erroneous
-‘bad’ inputs don’t crash program
-prompts to user: descriptive & helpful
-only correct data type entered
-checking and handling missing or blank data

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

difference betw/ erroneous and invalid data type

A

invalid: correct data type outside of accepted range
erroneous: incorrect data type, includes no input given

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

input validation techniques

A

-data type check
-range check
-presence check
-format check
-length check

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

Two methods of translating high-level language: Compiler

A

Compilers:
-whole program needs to be translated before it can be run
-produces executable file

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

assembly code is translated by an ….

A

assembles

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

advantages of Compilers:
disadvantages:

A

-speed of execution is faster
-code usually optimised
-original source code kept secret

dis:
-program won’t run with syntax errors, more difficult to write code
-code needs to be recompiled when changed

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

Method of translating: Interpreter:

A

-program translated line by line as program is running
-needs to be translated every time its run
-needs to be recompiled

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

dis/advantages of interpreters

A

-easy to write source code bcs program will always run, stopping when syntax error found
-no need for recompiling when code changed
-easy for beginners

dis:
-translation software needed at run-time
-speed of execution: slower
-source code needed
-code not optimised

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

tools in an IDE

A

Editor
…to enable program code to be entered/edited

Error diagnostics / debugging
…to display information about errors (syntax / run-time) / location of errors
… suggest solutions

Run-time environment…
to enable to the program to be run
… check for run time errors / test the program

Translator / compiler / interpreter
…to convert the high level code into machine code / low level code / binary
…to enable to code to be executed /run

Breakpoints
…to stop/pause program execution at a specific point

Watch window
…to check contents of variables

Stepping
…to execute program line by line

Syntax completion..
….suggests/corrects code

Keyword highlighting / colour coding keywords / pretty printing..
….colours command words / variables

17
Q

Difference between compiler and interpreter

A

Compiler
…translates code in one go / all at once
…produces an executable file // does not need to be compiled again

Interpreter
…translates code line by line
….will be interpreted / translated every time it is run.

18
Q

Features of IDE

A

Error diagnostics
Run-time environment
Editor (any feature such as auto-correct, auto-indent)
Translator
Version control
Break point
Stepping