Perform a desk check of the following code by walking thru the program and executing it like a computer would. A complete desk check must include: 1. An evaluation of all decision logic indicating the line number of the decision replacing variable names with their values at the time of the evaluation and then indicating if it was true of false. 2. A PseudoMonitor™ that shows the output 3. A memory map/table that tracks all variable values. Be sure to have three separate areas (three sheets of paper if needed) to document the above. State whether the algorithm represented by the code produces valid results given the obvious objective of the program. If not, explain why not. Even if it works with the given data set, does it contain potential hazards? Explain. Can you optimize the code in any way? You may not execute every line of code depending on the logic of the code and program inputs. Use the following incoming data for your program desk check. INCOMING DATA 3 6 9 5 ) { printf("\n The average is a touch on the large side."); } if($average == 5) { printf("\n That's about right."); } fscanf(STDIN, "%s", $buster); ?>
Perform a desk check of the following code by walking thru the
A complete desk check must include:
1. An evaluation of all decision logic indicating the line number of the decision replacing variable names with their values at the time of the evaluation and then indicating if it was true of false.
2. A PseudoMonitor™ that shows the output
3. A memory map/table that tracks all variable values.
Be sure to have three separate areas (three sheets of paper if needed) to document the above.
State whether the
Even if it works with the given data set, does it contain potential hazards? Explain. Can you optimize the code in any way?
You may not execute every line of code depending on the logic of the code and program inputs.
Use the following incoming data for your program desk check.
INCOMING DATA
3 6 9
<?php
$nbr1 = 0;
$nbr2 = 0;
$nbr3 = 0;
$total = 0;
$average = 0;
printf("\n Enter an integer between 1-10: ");
fscanf(STDIN, "%d", $nbr1);
printf("\n Enter an integer between 1-10: ");
fscanf(STDIN, "%d", $nbr2);
printf("\n Enter an integer between 1-10: ");
fscanf(STDIN, "%d", $nbr3);
$total = $nbr1 + $nbr2 + $nbr3;
$average = $total / 3;
printf("\n The total of your numbers is %d", $total);
printf("\n The average of your numbers is %d", $average);
if($average < 5 )
{
printf("\n The average is a touch on the small side.");
}
if($average > 5 )
{
printf("\n The average is a touch on the large side.");
}
if($average == 5)
{
printf("\n That's about right.");
}
fscanf(STDIN, "%s", $buster);
?>
Step by step
Solved in 2 steps