Pascal Program #2 - Anagram program
Points off |
Problem # |
Description |
-10 |
|
reading or writing character by character - not taking
advantage of packed array capabilities - one of the
benefits of Pascal's packed arrays is the ability to read a string as a whole
instead of character by character. |
-5 |
|
testing Boolean incorrectly [e.g. if (boolVar = true) instead of if (boolVar)] |
see below |
|
logic error in testing for anagrams - the algorithm you used to check whether two items were
anagrams does not work in all cases |
-1 each |
|
spelling error or wrong word error or grammar error |
-5 |
|
missing purpose description of program's purpose is required in every program this semester |
-5 |
|
missing input description description of program's input is required in every program this semester |
-5 |
|
missing output description description of program's output is required in every program this semester |
-5 |
|
missing intro to user - any
program that expects keyboard input from the user should describe fully what
the expected input should be and what will be done with it (i.e. what the
program's function is) |
|
|
very nice comments about language +5 bonus |
-5 |
|
labels are 1 to 4 digits not letters - standard Pascal
labels are not strings |
-3 |
|
non-standard comment delimiter used standard Pascal's
comment delimiters are curly braces { }
or starred parentheses
(* *) |
|
|
I'm not sure length is a
built-in standard function - it is not |
-5 |
|
repeated code should be a procedure or function - that makes your
code easier to read and understand |
-5 |
|
should be a procedure not a function. Functions return a value; procedures return 0, 1 or many
values through parameter list - this is a basic
conceptual difference between functions and procedures. Functions are like mathematical functions
which return a single values.
Procedures exist in programming languages because it was recognized
that sometimes it is desirable to return multiple values or none. |
|
|
|
-3 |
|
your program could use a few words explaining your
algorithm - it never hurts to have comments
explaining your algorithm |
-1 each |
|
missing an item from the heading |
-2 |
|
incomplete description of purpose |
-2 |
|
incomplete input description |
-2 |
|
incomplete output description |
-2 |
|
incomplete into |
-5 |
|
no comments about language - all programs
this semester are expected to include comments about the programming language
they are written in |
-5 |
|
failing to echo input
visible at runtime |
-1 each |
|
"why did you" comments from me - something you did in your algorithm or in a single coded
statement is not clear to me and should include a descriptive comment |
-3 |
|
not enough comments about language |
-5 |
|
using global variables - although
some programming languages allow implicit access to non-local variables, it
is a cause of many programming errors and is to be avoided. In general using the parameter lists of
your procedures and functions is the way to avoid this. Sometimes, the list of items becomes so
long that passing them through the parameter list is cumbersome. That's why FORTRAN has a common block and
other languages provide other explicit mechanisms. It is also a good idea to only pass things into procedures and
functions that they need. |
-5 |
|
you added a requirement which is not part of the
specification - this is a problem in this course when
doing so allows you to omit using the linguistic feature that was
intended such as Pascal's eof to detect end of input data. |
-10 |
|
you didn't use the required packed array type |
-5 |
|
you have an erroneous statement - about the programming language |
-10 |
|
(hourshouse) - NOT ANAGRAMS |
-10 |
|
(1234554321) - ARE ANAGRAMS |
-10 |
|
(meatsmeets) - NOT ANAGRAMS |
-10 |
|
(1235712456) - NOT ANAGRAMS |
|
|
(abc cba) - ARE ANAGRAMS |
-10 |
|
(abc cba ) - ARE ANAGRAMS |