Ex 4) Trace the following flowchart for when input values are 12, 2, -3, 6, -11, -3, 1, -1 and complete the trace table. Also, write pre- post-conditions for this flowchart. start cnt10 cnt2 0 i-1 num num<0 cnt1cnt1 1≤4 F 1+1 14-1+1 F i≤4 num "yes" F num>0 H F cnt1=cnt2 "no" cnt2cnt2 + 1 end

CMPTR
3rd Edition
ISBN:9781337681872
Author:PINARD
Publisher:PINARD
Chapter14: Working With Formulas And Functions
Section: Chapter Questions
Problem 15QY
icon
Related questions
Question
Ex 4) Trace the following flowchart for when input values are 12, 2, -3, 6, -11, -3, 1, -1 and
complete the trace table. Also, write pre- post-conditions for this flowchart.
start
ent1 ( 0
cnt2+0
i-1
i-i+1
num
i≤4
num<0
T
cnt1 a cnt1 + 1
T
i 1
F
i≤4
i+i+1
F
T
cnt1=cnt2
num
T
"no"
"yes"
num>0
T
cnt2 cnt2+1
end
Transcribed Image Text:Ex 4) Trace the following flowchart for when input values are 12, 2, -3, 6, -11, -3, 1, -1 and complete the trace table. Also, write pre- post-conditions for this flowchart. start ent1 ( 0 cnt2+0 i-1 i-i+1 num i≤4 num<0 T cnt1 a cnt1 + 1 T i 1 F i≤4 i+i+1 F T cnt1=cnt2 num T "no" "yes" num>0 T cnt2 cnt2+1 end
Ex 3) Trace the following flowchart for when input values are -10, -1, 3, 2, 11, 13, 1, 0 and
complete the trace table. Note that the system may end before all of the inputs have
been received; if this occurs you ignore the final inputs. Also, write pre- post-conditions
for this flowchart.
start
P
n
num output
n<0
num
num>0
T
num<0
pp+1
T
n< n+1
num 0 and
p≤ 2*n
end
F
Transcribed Image Text:Ex 3) Trace the following flowchart for when input values are -10, -1, 3, 2, 11, 13, 1, 0 and complete the trace table. Note that the system may end before all of the inputs have been received; if this occurs you ignore the final inputs. Also, write pre- post-conditions for this flowchart. start P n num output n<0 num num>0 T num<0 pp+1 T n< n+1 num 0 and p≤ 2*n end F
Expert Solution
steps

Step by step

Solved in 4 steps

Blurred answer
Knowledge Booster
Concept of Flowchart
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Recommended textbooks for you
CMPTR
CMPTR
Computer Science
ISBN:
9781337681872
Author:
PINARD
Publisher:
Cengage