



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




Exercise 1: (Directions for passing an exam--problem was the order of the steps) 1.Read the material 2.Listen attentively in class 3.Outline the material 4.Get lots of sleep the night before the exam 5.Take the exam Exercise 2: Nonalgorithm because it may not solve the problem. There are two errors. First, an additional step needs to be added to provide for “looping” back if the word sought is still before the current page. Secondly, if the search begins on an even page, only even pages will be scanned; if search begins on an odd page then only odd pages will be scanned. Thus an algorithm would be: 1.Turn to any page. 2.If word at top left of the page occurs alphabetically after the desired word, go to step 4. 3.Turn ahead 10 pages and go to step 2. 4.Go back 1 page. 5.If word at the top right is before the desired word, go to step 3. 6.If word at the top left is after the desired word, go to step 4. 7.Scan page for desired word. 8.If it is found, write the definition. 9.If it is not found, write “not in the dictionary”. Exercise 3: (Find sum of positive integers between M and N) 1.Input values for M and N. 2.Set sum1 = N(N+1)/2 (Sum of integers from 1 to N) 3.Set sum2 = M(M-1)/2 (Sum of integers from 1 to M-1) 4.Answer is sum1-sum Exercise 4:(Flowchart for Exercise 3--be sure you are in PageLayout View on Word)
sum1N(N+1)/ sum2M(M-1)/ sumsum1-sum Start Read M,N Write “The sum is”,sum Stop
c 1 start Read m cc+1 cm?^ no yes Read n t 1 while tt < n tt+ yes no tt=n? yes no Write n, "does not pass the test" Write n, "passes the test" stop