For the following program P written in pseudo-code, 1) Draw the data flow graph
ID: 3818550 • Letter: F
Question
For the following program P written in pseudo-code,
1) Draw the data flow graph for P.
2) Build the dcu/dpu table for P. See Mathur’s Example 7.31 (slide 34 in the lecture on data Program P
Compute the dcu and dpu sets for the C-use DFG. def dcu (x, 1) c-use 2 p use-xl c-use of x at nodes 5, 6 (x>0) def-clear paths for x (1,2,5), (1,2,5,6) def 0 3) C-us p-useely dcu (x, 1) (5, 6) c-use-tx dpu (x, 1) C-use tly, Zl Count! 0 p-use of x at node 2 with outgoing Count- 0 edges (2,3) and (2,5) def-clear paths to both edges dpu (x, 1) (2,3), (2,5)) 33Explanation / Answer
//Find here for pseudo code for program p
Declare variable x,y and z of integer type
call input method to initialize x and y
Start if
check if x less than 0 or x greater than 8 or y less than 1 or y greater than 3 then
Display message "Boundary condition failure on inputs"
end if
else start
intialize z to 0
start if
check for x less than 5 then
re-initialize z to x+y
start if
check for y equals 1 then
re-initialize z to x^2
end if
end if
else start
re-initialize z to z-x
start if
check if y equals 0 then
re-initialize z to z*x
end if
else start
re-initialize z to z+x
end else
end else
call method output(x,y,z)
end else
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.