Stamford University Assignment
Stamford University Assignment
Question 1: Assume that you are invited to test a project written in modern Java programming
language (e.g., Java SE 17 (LTS)). Prepare a language-dependent checklist similar to our discussion in
Week 1 that covers the following categories. You can create new categories if you deem necessary.
• Computation Errors
• Comparison Errors
• Control-Flow Errors
• Interface Errors
• Input/Output Errors
• Other Checks
Answer –
Are array and string subscripts integer values, and do they always fall within the dimensions
of the array or string?
Is there a reference to an uninitialized variable? It is just as important to look for omissions
as it is to look for errors.
When a memory area has alias names with different attributes, does the data value in this
area have the correct attributes when accessed through one of these names? If the program
stores a floating-point value in A and then defines an integer reference variable B, an error
will most likely occur because the machine will interpret the floating-point bit representation
in the memory area as an integer.
Are there any "off by one" errors in indexing operations or array subscript references?
Is a data structure defined the same way if it is referenced in multiple functions or
subroutines?
Do descriptive variable and constant names follow naming conventions? i.e. Is the correct
length, type, and storage class assigned to all variables? Should a variable, for example, be
declared as just a string rather than an array of characters?
Are there variables with names that are confusingly similar? i.e. Are there any variables with
names that are similar? This isn't necessarily a bug, but it could indicate that the names were
mixed up with those from elsewhere in the program.
Has each variable been properly initialized? i.e. Is a variable properly initialized and
consistent with its type if it is declared and initialized at the same time?
Are there any variables declared that are never or only once referenced?
Is it possible to make any non-local variables local?
Should there be literal constants named constants?
Should there be any macros that should be constants?
Are there any variables that should be treated as constants?
Is each variable explicitly declared within its own module? If not, is it understood that the
variable is shared with the module above it?
Are comparison operations used, correct? Is there no confusion whether to use less than or
equal to?
Are there any Boolean expression not stated correctly? Is the Boolean calculation working as
expected? Is there little doubt in the order of evaluation?
Are Boolean operator operands properly declared as Boolean? I.e., are integer variables
containing integer values used in Boolean calculations?
Is there an inappropriate and unnoticed side effect of the comparison?
Are the most appropriate looping constructs used for each loop?
When there are multiple outputs from a loop, is each output needed and handled correctly?
Is it possible to exit the loop early?
Will each loop end properly? Will the program, module, subroutine, or loop eventually
terminate? If it won`t, is that acceptable?
Are zero-body control structures correct and marked with curly braces or comments?
Are there any switch statement without a default case?
Are there any missing switch case break statement not correct and that neither marked with
comments?
Will every function be terminated? Are go-to statements also avoided?
Do the number, order, type, and value of the parameters in each function call match in the
declaration of the called function?
Do the values match in units? (e.g., Yards versus Inches)
Input/Output Error Checklist
Before use of any file, have all the files been opened?
Have all files been properly closed after the use of it?
Are all error conditions checked thoroughly?
In the text printed and displayed, are there any spelling error or grammatical one? Are all
error messages checked for accuracy, suitability, grammar, and spelling?
In the open statement, are the attributes consistent with the use of the file?
Do the software handle situations where an external device is disconnected, unavailable, or
full during a read or write operation?
Other Checks
Does the software work in languages other than English? Do you want to handle extended
ASCII characters? Should I use Unicode instead of ASCII?
Is this taken into account if the software needs to be portable to other compilers and CPUs?
Portability can be a major issue if it is not planned and tested, if desired.
Is compatibility considered so that the software works with different amounts of available
memory, different internal hardware such as graphics and sound cards, and different
peripherals such as printers and modems?
Does compiling a program generate a "warning" or "information" message? They usually
indicate that something suspicious is happening. Purists will argue that no warning is
acceptable.