Please explain. Confused What is the output by each of the pseudocode segments?
ID: 664814 • Letter: P
Question
Please explain. Confused
What is the output by each of the pseudocode segments?
a. a=1
b=2
c=5
while a < c
a=a + 1
b=b + c
endwhile
output a, b, c
b. d=4
e=6
f=7
while d > f
d= d + 1
e = e -1
endwhile
output d, e, f
c g=4
h=6
while g < h
g= g + 1
endwhile
output g, h
d j=2
k=5
n=9
while j < k
m = 6
while m < n
output “Goodbye”
m= m + 1
endwhile
j- j +1
endwhile
e j = 2
k = 5
m = 6
n = 9
while j < k
while m < n
output “Hello”
m = m + 1
endwhile
j = j + 1
endwhile
f p = 2
q = 4
while p < q
output “Adios”
r = 1
while r < q
output “Adios”
r = r + 1
endwhile
p = p + 1
endwhile
Explanation / Answer
output of ist code fragment is (4,25,5) output of second code fragment is (4,6,7) same as input because condition initially becomes false and will not enter into while loop. output of third code fragment (6,6) the output of fourth code fragment is(Goodbye,Goodbye, Goodbye,Goodbye,Goodbye,Goodbye,Goodbye,goodbye,goodbye) output of of fifth code fragment is (Hello,Hello,Hello,Hello,Hello,Hello,Hello,Hello,Hello) output of sixth code fragment is given as(Adios, Adios,Adios,Adios,Adios,Adios,Adios,Adios)