Reference no: EM13670847
Design and implement a solution to the Naur text-processing problem using the language specified by your instructor. Execute it against test data and record the number of faults you find and the cause of each fault (e.g., logic fault, loop counter fault). Do not correct any of the faults you detect. So you goal is to just detect the faults, not to correct them.
An important aspect of correctness proofs is that they should be done in conjunction with design and coding. As Dijkstra put it, "The programmer should let the program proof and program grow hand in hand" [Dijkstra, 1972]. For example, when a loop is incorporated into the design, a loop invariant is put forward; and as the design is refined stepwise, so is the invariant. Developing a product in this way gives the programmer confidence that the product is correct and tends to reduce the number of faults. Quoting Dijkstra again, "The only effective way to raise the confidence level of a program significantly is to give a convincing proof of its correctness" [Dijkstra, 1972]. But even if a product is proven to be correct, it must be thoroughly tested as well. To illustrate the necessity for testing in conjunction with correctness proving, consider the following.
In 1969, Naur reported on a technique for constructing and proving a product correct [Naur, 1969]. The technique was illustrated by what Naur termed a line-editing problem; today this would be considered a text-processing problem. It may be stated as follows: Given a text consisting of words separated by blank characters or by newline (new line) characters, convert it to line-by-line form in accordance with the following rules:
1. Line breaks must be made only where the given text contains a blank or newline;
2. Each line is filled as far as possible, as long as
3. No line will contain more than maxpos characters.
Naur constructed a procedure using his technique and informally proved its correctness. The procedure consisted of approximately 25 lines of code. The paper then was reviewed by Leavenworth in Computing Reviews [Leavenworth, 1970]. The reviewer pointed out that, in the output of Naur's procedure, the first word of the first line is preceded by a blank unless the first word is exactly maxpos characters long.
Although this may seem a trivial fault, it is a fault that surely would have been detected had the procedure been tested, that is, executed with test data rather than only proven correct. But worse was to come. London [1971] detected three additional faults in Naur's procedure. One is that the procedure does not terminate unless a word longer than maxpos characters is encountered. Again, this fault is likely to have been detected if the procedure had been tested. London then presented a corrected version of the procedure and proved formally that the resulting procedure was correct; recall that Naur had used only informal proof techniques.
The next episode in this saga is that Good enough and Gerhart [1975] found three faults that London had not detected, despite his formal "proof." These included the fact that the last word is not output unless it is followed by a blank or newline. Yet again, a reasonable choice of test data would have detected this fault without much difficulty. In fact, of the total of seven faults collectively detected by Leavenworth, London, and Good enough and Gerhart, four could have been detected simply by running the procedure on test data, such as the illustrations given in Naur's original paper. The lesson from this saga is clear. Even if a product has been proven correct, it still must be tested thoroughly.
Determine what total force is exerted on the object
: A small object with mass 5.00 kilogram moves counterclockwise with constant speed 5.50 m/s in a circle of radius 3.00 meter centered at the origin. Determine what total force is exerted on the object
|
Find what the speed of the ball as it strikes the ground
: A 0.17 kilogram baseball is launched from the roof of a building15 meter above the ground. Find the speed of the ball as it strikes the ground
|
Find what is the output voltage of the array
: A modded Prius electric car is powered by sixty lithium-iron-phosphate batteries. At a freeway speed of 108 km/h, the average frictional force on the vehicle is only 200 Newton. find what is the output voltage of the array
|
Draw a venn diagram
: Draw a Venn diagram. If a person is chosen at random from the group, what is the probability that the person does not own a microwave, a computer or a DVD player?
|
Solution to the naur text-processing problem
: Design and implement a solution to the Naur text-processing problem using the language specified by your instructor. Execute it against test data and record the number of faults you find and the cause of each fault
|
Compute what the magnitude of the force
: A force in the +y direction applied at the point x=2.3 meter, y=1.4 meter gives rise to a torque of 66 N•m about the origin. Estimate what the magnitude of the force
|
Obtain the change in speed of the object
: A constant force of magnitude of 8.0 Newton is exerted for 4.0 s on a 16 kilogram object initially at rest. Obtain the change in speed of the object
|
Determine the acceleration of the automobile
: A 9000 Newton automobile is pushed along a level road by four students who apply a total forward force of magnitude 500 Newton. determine the acceleration of the automobile
|
Evaluate what is the new angular speed of the sphere
: A 1.4 kilogram 15 centimeter diameter solid sphere is rotating about its diameter at 70 rev/min. If an additional 5.0 mJ of energy are added to the kinetic energy, evaluate what is the new angular speed of the sphere
|