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); ?>

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

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

<?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);
?>

Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY