SlideShare a Scribd company logo
6) This exercise uses sub-algorithms. Trace it for when input value is 6 and complete the trace
tables. Also note that there are two variables name num, one in the main algorithm and another in
the sub-algorithm. They are not related. Assume input is a positive integer. Write pre-post-
conditions for each of these algorithms (the main one and the sub-algorithm). Note that the prime
sub-algorithm is similar to the algorithm in Ex 1) but instead of reading input and producing
outputs, it has a parameter num, and it returns the result. Also note that the =true is in gray color,
which means it can be ignored. Note that since the sub-program is called several times, it's better
that you use separate trace tables, one for each call, as shown below.

More Related Content

More from Acro1988

7 Aadakilerden hangisi mikroekonomik bir konudur A ind.pdf
7 Aadakilerden hangisi mikroekonomik bir konudur  A ind.pdf7 Aadakilerden hangisi mikroekonomik bir konudur  A ind.pdf
7 Aadakilerden hangisi mikroekonomik bir konudur A ind.pdfAcro1988
 
7 A recent study by Mkare et al 2017 on population stru.pdf
7 A recent study by Mkare et al 2017 on population stru.pdf7 A recent study by Mkare et al 2017 on population stru.pdf
7 A recent study by Mkare et al 2017 on population stru.pdfAcro1988
 
6b Besides Crater Lake give another example on Earth of thi.pdf
6b Besides Crater Lake give another example on Earth of thi.pdf6b Besides Crater Lake give another example on Earth of thi.pdf
6b Besides Crater Lake give another example on Earth of thi.pdfAcro1988
 
6 Write a Python functoion that takes in a dictionary and p.pdf
6 Write a Python functoion that takes in a dictionary and p.pdf6 Write a Python functoion that takes in a dictionary and p.pdf
6 Write a Python functoion that takes in a dictionary and p.pdfAcro1988
 
6710 Let X1X2Xn be a random sample from a distribution.pdf
6710 Let X1X2Xn be a random sample from a distribution.pdf6710 Let X1X2Xn be a random sample from a distribution.pdf
6710 Let X1X2Xn be a random sample from a distribution.pdfAcro1988
 
60 A difference between a ListBox and a dropdown style Com.pdf
60 A difference between a ListBox and a dropdown style Com.pdf60 A difference between a ListBox and a dropdown style Com.pdf
60 A difference between a ListBox and a dropdown style Com.pdfAcro1988
 
62 of 71 delegates in a political convention favored changi.pdf
62 of 71 delegates in a political convention favored changi.pdf62 of 71 delegates in a political convention favored changi.pdf
62 of 71 delegates in a political convention favored changi.pdfAcro1988
 
64 of owned dogs in the United States are spayed or neutere.pdf
64 of owned dogs in the United States are spayed or neutere.pdf64 of owned dogs in the United States are spayed or neutere.pdf
64 of owned dogs in the United States are spayed or neutere.pdfAcro1988
 
6 Farly scientists tried to determine the age of Zarth usin.pdf
6 Farly scientists tried to determine the age of Zarth usin.pdf6 Farly scientists tried to determine the age of Zarth usin.pdf
6 Farly scientists tried to determine the age of Zarth usin.pdfAcro1988
 
6 Using your own words explain the pathophysiology of DIC .pdf
6 Using your own words explain the pathophysiology of DIC .pdf6 Using your own words explain the pathophysiology of DIC .pdf
6 Using your own words explain the pathophysiology of DIC .pdfAcro1988
 
62 A 10yearold boy is admitted with pallor His CBC shows.pdf
62 A 10yearold boy is admitted with pallor His CBC shows.pdf62 A 10yearold boy is admitted with pallor His CBC shows.pdf
62 A 10yearold boy is admitted with pallor His CBC shows.pdfAcro1988
 
63 Consider the loop in the program of Figure 28 Assume i.pdf
63 Consider the loop in the program of Figure 28 Assume i.pdf63 Consider the loop in the program of Figure 28 Assume i.pdf
63 Consider the loop in the program of Figure 28 Assume i.pdfAcro1988
 
6 Write a shell script lsmorebash that displays the file.pdf
6 Write a shell script lsmorebash that displays the file.pdf6 Write a shell script lsmorebash that displays the file.pdf
6 Write a shell script lsmorebash that displays the file.pdfAcro1988
 
6 X1X2X35 are normal random variables with mean and va.pdf
6 X1X2X35 are normal random variables with mean  and va.pdf6 X1X2X35 are normal random variables with mean  and va.pdf
6 X1X2X35 are normal random variables with mean and va.pdfAcro1988
 
6 Name and describe three ways in which cells can drive act.pdf
6 Name and describe three ways in which cells can drive act.pdf6 Name and describe three ways in which cells can drive act.pdf
6 Name and describe three ways in which cells can drive act.pdfAcro1988
 
6 Who developed Data Encryption Standard DES Your answ.pdf
6 Who developed Data Encryption Standard  DES Your answ.pdf6 Who developed Data Encryption Standard  DES Your answ.pdf
6 Who developed Data Encryption Standard DES Your answ.pdfAcro1988
 
6 Describe the features of the function in the graph and cr.pdf
6 Describe the features of the function in the graph and cr.pdf6 Describe the features of the function in the graph and cr.pdf
6 Describe the features of the function in the graph and cr.pdfAcro1988
 
6 Psychologists believe that teenagers use of Facebook incr.pdf
6 Psychologists believe that teenagers use of Facebook incr.pdf6 Psychologists believe that teenagers use of Facebook incr.pdf
6 Psychologists believe that teenagers use of Facebook incr.pdfAcro1988
 
6 KDEL dizisinin sinyal dizisinin ve nkleer lokalizasyon .pdf
6 KDEL dizisinin sinyal dizisinin ve nkleer lokalizasyon .pdf6 KDEL dizisinin sinyal dizisinin ve nkleer lokalizasyon .pdf
6 KDEL dizisinin sinyal dizisinin ve nkleer lokalizasyon .pdfAcro1988
 
6 Give the probability of two individuals heterozygous for .pdf
6 Give the probability of two individuals heterozygous for .pdf6 Give the probability of two individuals heterozygous for .pdf
6 Give the probability of two individuals heterozygous for .pdfAcro1988
 

More from Acro1988 (20)

7 Aadakilerden hangisi mikroekonomik bir konudur A ind.pdf
7 Aadakilerden hangisi mikroekonomik bir konudur  A ind.pdf7 Aadakilerden hangisi mikroekonomik bir konudur  A ind.pdf
7 Aadakilerden hangisi mikroekonomik bir konudur A ind.pdf
 
7 A recent study by Mkare et al 2017 on population stru.pdf
7 A recent study by Mkare et al 2017 on population stru.pdf7 A recent study by Mkare et al 2017 on population stru.pdf
7 A recent study by Mkare et al 2017 on population stru.pdf
 
6b Besides Crater Lake give another example on Earth of thi.pdf
6b Besides Crater Lake give another example on Earth of thi.pdf6b Besides Crater Lake give another example on Earth of thi.pdf
6b Besides Crater Lake give another example on Earth of thi.pdf
 
6 Write a Python functoion that takes in a dictionary and p.pdf
6 Write a Python functoion that takes in a dictionary and p.pdf6 Write a Python functoion that takes in a dictionary and p.pdf
6 Write a Python functoion that takes in a dictionary and p.pdf
 
6710 Let X1X2Xn be a random sample from a distribution.pdf
6710 Let X1X2Xn be a random sample from a distribution.pdf6710 Let X1X2Xn be a random sample from a distribution.pdf
6710 Let X1X2Xn be a random sample from a distribution.pdf
 
60 A difference between a ListBox and a dropdown style Com.pdf
60 A difference between a ListBox and a dropdown style Com.pdf60 A difference between a ListBox and a dropdown style Com.pdf
60 A difference between a ListBox and a dropdown style Com.pdf
 
62 of 71 delegates in a political convention favored changi.pdf
62 of 71 delegates in a political convention favored changi.pdf62 of 71 delegates in a political convention favored changi.pdf
62 of 71 delegates in a political convention favored changi.pdf
 
64 of owned dogs in the United States are spayed or neutere.pdf
64 of owned dogs in the United States are spayed or neutere.pdf64 of owned dogs in the United States are spayed or neutere.pdf
64 of owned dogs in the United States are spayed or neutere.pdf
 
6 Farly scientists tried to determine the age of Zarth usin.pdf
6 Farly scientists tried to determine the age of Zarth usin.pdf6 Farly scientists tried to determine the age of Zarth usin.pdf
6 Farly scientists tried to determine the age of Zarth usin.pdf
 
6 Using your own words explain the pathophysiology of DIC .pdf
6 Using your own words explain the pathophysiology of DIC .pdf6 Using your own words explain the pathophysiology of DIC .pdf
6 Using your own words explain the pathophysiology of DIC .pdf
 
62 A 10yearold boy is admitted with pallor His CBC shows.pdf
62 A 10yearold boy is admitted with pallor His CBC shows.pdf62 A 10yearold boy is admitted with pallor His CBC shows.pdf
62 A 10yearold boy is admitted with pallor His CBC shows.pdf
 
63 Consider the loop in the program of Figure 28 Assume i.pdf
63 Consider the loop in the program of Figure 28 Assume i.pdf63 Consider the loop in the program of Figure 28 Assume i.pdf
63 Consider the loop in the program of Figure 28 Assume i.pdf
 
6 Write a shell script lsmorebash that displays the file.pdf
6 Write a shell script lsmorebash that displays the file.pdf6 Write a shell script lsmorebash that displays the file.pdf
6 Write a shell script lsmorebash that displays the file.pdf
 
6 X1X2X35 are normal random variables with mean and va.pdf
6 X1X2X35 are normal random variables with mean  and va.pdf6 X1X2X35 are normal random variables with mean  and va.pdf
6 X1X2X35 are normal random variables with mean and va.pdf
 
6 Name and describe three ways in which cells can drive act.pdf
6 Name and describe three ways in which cells can drive act.pdf6 Name and describe three ways in which cells can drive act.pdf
6 Name and describe three ways in which cells can drive act.pdf
 
6 Who developed Data Encryption Standard DES Your answ.pdf
6 Who developed Data Encryption Standard  DES Your answ.pdf6 Who developed Data Encryption Standard  DES Your answ.pdf
6 Who developed Data Encryption Standard DES Your answ.pdf
 
6 Describe the features of the function in the graph and cr.pdf
6 Describe the features of the function in the graph and cr.pdf6 Describe the features of the function in the graph and cr.pdf
6 Describe the features of the function in the graph and cr.pdf
 
6 Psychologists believe that teenagers use of Facebook incr.pdf
6 Psychologists believe that teenagers use of Facebook incr.pdf6 Psychologists believe that teenagers use of Facebook incr.pdf
6 Psychologists believe that teenagers use of Facebook incr.pdf
 
6 KDEL dizisinin sinyal dizisinin ve nkleer lokalizasyon .pdf
6 KDEL dizisinin sinyal dizisinin ve nkleer lokalizasyon .pdf6 KDEL dizisinin sinyal dizisinin ve nkleer lokalizasyon .pdf
6 KDEL dizisinin sinyal dizisinin ve nkleer lokalizasyon .pdf
 
6 Give the probability of two individuals heterozygous for .pdf
6 Give the probability of two individuals heterozygous for .pdf6 Give the probability of two individuals heterozygous for .pdf
6 Give the probability of two individuals heterozygous for .pdf
 

Recently uploaded

The impact of social media on mental health and well-being has been a topic o...
The impact of social media on mental health and well-being has been a topic o...The impact of social media on mental health and well-being has been a topic o...
The impact of social media on mental health and well-being has been a topic o...sanghavirahi2
 
The basics of sentences session 4pptx.pptx
The basics of sentences session 4pptx.pptxThe basics of sentences session 4pptx.pptx
The basics of sentences session 4pptx.pptxheathfieldcps1
 
Morse OER Some Benefits and Challenges.pptx
Morse OER Some Benefits and Challenges.pptxMorse OER Some Benefits and Challenges.pptx
Morse OER Some Benefits and Challenges.pptxjmorse8
 
Incoming and Outgoing Shipments in 2 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 2 STEPS Using Odoo 17Incoming and Outgoing Shipments in 2 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 2 STEPS Using Odoo 17Celine George
 
The Benefits and Challenges of Open Educational Resources
The Benefits and Challenges of Open Educational ResourcesThe Benefits and Challenges of Open Educational Resources
The Benefits and Challenges of Open Educational Resourcesaileywriter
 
Championnat de France de Tennis de table/
Championnat de France de Tennis de table/Championnat de France de Tennis de table/
Championnat de France de Tennis de table/siemaillard
 
Pragya Champions Chalice 2024 Prelims & Finals Q/A set, General Quiz
Pragya Champions Chalice 2024 Prelims & Finals Q/A set, General QuizPragya Champions Chalice 2024 Prelims & Finals Q/A set, General Quiz
Pragya Champions Chalice 2024 Prelims & Finals Q/A set, General QuizPragya - UEM Kolkata Quiz Club
 
slides CapTechTalks Webinar May 2024 Alexander Perry.pptx
slides CapTechTalks Webinar May 2024 Alexander Perry.pptxslides CapTechTalks Webinar May 2024 Alexander Perry.pptx
slides CapTechTalks Webinar May 2024 Alexander Perry.pptxCapitolTechU
 
UNIT – IV_PCI Complaints: Complaints and evaluation of complaints, Handling o...
UNIT – IV_PCI Complaints: Complaints and evaluation of complaints, Handling o...UNIT – IV_PCI Complaints: Complaints and evaluation of complaints, Handling o...
UNIT – IV_PCI Complaints: Complaints and evaluation of complaints, Handling o...Sayali Powar
 
....................Muslim-Law notes.pdf
....................Muslim-Law notes.pdf....................Muslim-Law notes.pdf
....................Muslim-Law notes.pdfVikramadityaRaj
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaasiemaillard
 
Neurulation and the formation of the neural tube
Neurulation and the formation of the neural tubeNeurulation and the formation of the neural tube
Neurulation and the formation of the neural tubeSaadHumayun7
 
Basic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumersBasic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumersPedroFerreira53928
 
Application of Matrices in real life. Presentation on application of matrices
Application of Matrices in real life. Presentation on application of matricesApplication of Matrices in real life. Presentation on application of matrices
Application of Matrices in real life. Presentation on application of matricesRased Khan
 
Telling Your Story_ Simple Steps to Build Your Nonprofit's Brand Webinar.pdf
Telling Your Story_ Simple Steps to Build Your Nonprofit's Brand Webinar.pdfTelling Your Story_ Simple Steps to Build Your Nonprofit's Brand Webinar.pdf
Telling Your Story_ Simple Steps to Build Your Nonprofit's Brand Webinar.pdfTechSoup
 
The Last Leaf, a short story by O. Henry
The Last Leaf, a short story by O. HenryThe Last Leaf, a short story by O. Henry
The Last Leaf, a short story by O. HenryEugene Lysak
 
Benefits and Challenges of Using Open Educational Resources
Benefits and Challenges of Using Open Educational ResourcesBenefits and Challenges of Using Open Educational Resources
Benefits and Challenges of Using Open Educational Resourcesdimpy50
 

Recently uploaded (20)

The impact of social media on mental health and well-being has been a topic o...
The impact of social media on mental health and well-being has been a topic o...The impact of social media on mental health and well-being has been a topic o...
The impact of social media on mental health and well-being has been a topic o...
 
The basics of sentences session 4pptx.pptx
The basics of sentences session 4pptx.pptxThe basics of sentences session 4pptx.pptx
The basics of sentences session 4pptx.pptx
 
Morse OER Some Benefits and Challenges.pptx
Morse OER Some Benefits and Challenges.pptxMorse OER Some Benefits and Challenges.pptx
Morse OER Some Benefits and Challenges.pptx
 
Incoming and Outgoing Shipments in 2 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 2 STEPS Using Odoo 17Incoming and Outgoing Shipments in 2 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 2 STEPS Using Odoo 17
 
The Benefits and Challenges of Open Educational Resources
The Benefits and Challenges of Open Educational ResourcesThe Benefits and Challenges of Open Educational Resources
The Benefits and Challenges of Open Educational Resources
 
Championnat de France de Tennis de table/
Championnat de France de Tennis de table/Championnat de France de Tennis de table/
Championnat de France de Tennis de table/
 
Pragya Champions Chalice 2024 Prelims & Finals Q/A set, General Quiz
Pragya Champions Chalice 2024 Prelims & Finals Q/A set, General QuizPragya Champions Chalice 2024 Prelims & Finals Q/A set, General Quiz
Pragya Champions Chalice 2024 Prelims & Finals Q/A set, General Quiz
 
slides CapTechTalks Webinar May 2024 Alexander Perry.pptx
slides CapTechTalks Webinar May 2024 Alexander Perry.pptxslides CapTechTalks Webinar May 2024 Alexander Perry.pptx
slides CapTechTalks Webinar May 2024 Alexander Perry.pptx
 
UNIT – IV_PCI Complaints: Complaints and evaluation of complaints, Handling o...
UNIT – IV_PCI Complaints: Complaints and evaluation of complaints, Handling o...UNIT – IV_PCI Complaints: Complaints and evaluation of complaints, Handling o...
UNIT – IV_PCI Complaints: Complaints and evaluation of complaints, Handling o...
 
NCERT Solutions Power Sharing Class 10 Notes pdf
NCERT Solutions Power Sharing Class 10 Notes pdfNCERT Solutions Power Sharing Class 10 Notes pdf
NCERT Solutions Power Sharing Class 10 Notes pdf
 
....................Muslim-Law notes.pdf
....................Muslim-Law notes.pdf....................Muslim-Law notes.pdf
....................Muslim-Law notes.pdf
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
Neurulation and the formation of the neural tube
Neurulation and the formation of the neural tubeNeurulation and the formation of the neural tube
Neurulation and the formation of the neural tube
 
Basic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumersBasic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumers
 
Application of Matrices in real life. Presentation on application of matrices
Application of Matrices in real life. Presentation on application of matricesApplication of Matrices in real life. Presentation on application of matrices
Application of Matrices in real life. Presentation on application of matrices
 
Telling Your Story_ Simple Steps to Build Your Nonprofit's Brand Webinar.pdf
Telling Your Story_ Simple Steps to Build Your Nonprofit's Brand Webinar.pdfTelling Your Story_ Simple Steps to Build Your Nonprofit's Brand Webinar.pdf
Telling Your Story_ Simple Steps to Build Your Nonprofit's Brand Webinar.pdf
 
The Last Leaf, a short story by O. Henry
The Last Leaf, a short story by O. HenryThe Last Leaf, a short story by O. Henry
The Last Leaf, a short story by O. Henry
 
B.ed spl. HI pdusu exam paper-2023-24.pdf
B.ed spl. HI pdusu exam paper-2023-24.pdfB.ed spl. HI pdusu exam paper-2023-24.pdf
B.ed spl. HI pdusu exam paper-2023-24.pdf
 
“O BEIJO” EM ARTE .
“O BEIJO” EM ARTE                       .“O BEIJO” EM ARTE                       .
“O BEIJO” EM ARTE .
 
Benefits and Challenges of Using Open Educational Resources
Benefits and Challenges of Using Open Educational ResourcesBenefits and Challenges of Using Open Educational Resources
Benefits and Challenges of Using Open Educational Resources
 

6 This exercise uses subalgorithms Trace it for when inpu.pdf

  • 1. 6) This exercise uses sub-algorithms. Trace it for when input value is 6 and complete the trace tables. Also note that there are two variables name num, one in the main algorithm and another in the sub-algorithm. They are not related. Assume input is a positive integer. Write pre-post- conditions for each of these algorithms (the main one and the sub-algorithm). Note that the prime sub-algorithm is similar to the algorithm in Ex 1) but instead of reading input and producing outputs, it has a parameter num, and it returns the result. Also note that the =true is in gray color, which means it can be ignored. Note that since the sub-program is called several times, it's better that you use separate trace tables, one for each call, as shown below.