Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

7. Below is a simple while loop written in pseudocode. (In this pseudocode, the body of the loop is denoted by indentation.) Set J

 

7. Below is a simple while loop written in pseudocode. (In this pseudocode, the body of the loop is denoted by indentation.) Set J to 1 While (J is less than or equal to 10) Print J Add 1 to J Print J a. In the above pseudocode, what does the book call statements like J is less than or equal to 10? Hint: these statements follow while, and must unambiguously evaluate to true or false. b. Run through the algorithm by playing computer. What value is printed by the final "Print J" instruction? c. Make a version of the algorithm with the "Add" instruction line is omitted - what is the term for the kind of loop that has just been created? d. Make another version of the algorithm were you remove the last "Print instruction. Then, change the algorithm so that inside the loop it prints the even integers in the range 2 through 6 inclusively. e. In the modified version 7d above, bring back the final "Print "instruction. Now, run the algorithm and determine what will be printed by the final "Print instruction?

Step by Step Solution

There are 3 Steps involved in it

Step: 1

a The statements like J is less than or equal to 10 in the pseudocode are called loop condition stat... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Statistics

Authors: James T. McClave, Terry T Sincich

12th Edition

9780321831088, 321755936, 032183108X, 978-0321755933

More Books

Students also viewed these Programming questions

Question

=+b) Test an appropriate hypothesis and state your conclusion.

Answered: 1 week ago

Question

Explain the pages in white the expert taxes

Answered: 1 week ago