Share PDF

Search documents:
  Report this document  
    Download as PDF   
      Share on Facebook

CS111 Laboratory

Exercise No.1

Introduction to Programming

Exercise Problem Sets

1.Each of the flowchart segments in Figure 1 is unstructured. Redraw each segment so that it does the same thing but is structured.

Figure No.1 Unstructured Flowchart Segments

2.Write pseudocode for each example (a through c) in Problem Set No.1, making sure your pseudocode is structured but accomplishes the same tasks as the flowchart segment.

3.Each of the flowchart segments in Figure 2 is unstructured. Redraw each segment so that it does the same thing but is structured.

Figure No.2 Unstructured Flowchart Segments

4.Write pseudocode for each example (d and e) in Problem Set No.3, making sure your pseudocode is structured but accomplishes the same tasks as the flowchart segment.

5.Draw a structured flowchart or write pseudocode that describes the process of guessing a number between 1 and 100. After each guess, the player is told that the guess is too high or too low. The process continues until the player guesses the correct number. Pick a number and have a fellow student try to guess it following your instructions.

6.Looking up a word in a dictionary can be a complicated process. For example, assume that you want to look up logic. You might open the dictionary to a random page and see juice. You know this word comes alphabetically before logic, so you flip forward and see lamb. That is still not far enough, so you flip forward and see monkey. You have gone too far, so you flip back, and so on. Draw a structured flowchart or write pseudocode that describes the process of looking up a word in a dictionary. Pick a word at random and have a fellow student attempt to carry out your instructions.

7.Draw a structured flowchart or write structured pseudocode describing how to find your classroom from the front entrance of the school building. Include at least two decisions and two loops.

Prepared by: Jose L. Seño Revision 0

June 9, 2013