Chapter 9
Chapter 9
Answers to Review Questions
1. b
2. a
3. c
4. d
5. c
6. a
7. c
8. b
9. b
10. c
11. b
12. a
13. d
14. c
15. b
16. b
17. a
18. b
19. d
20. b
Answers to Exercises
1. Professor Zak allows students to drop the two lowest scores on the ten 100-point quizzes she gives during the semester. Develop the logic for a program that reads in student records that contain ID number, last name, first name, and 10 quiz scores. The output lists student ID, name, and total points for the eight highest-scoring quizzes.
Pseudocode:
start
perform housekeeping()
while not eof
perform mainLoop()
endwhile
perform finishUp()
stop
housekeeping()
declare variables
open files
perform headings()
read stuRec
return
headings()
print heading1
print heading2
return
mainLoop()
perform sortScores()
sub = 1
total = 0
while sub temp AND pos > 0
sal[pos + 1] = sal[pos]
pos = pos – 1
endwhile
sal[pos + 1] = temp
endif
x = x + 1
endwhile
y = y + 1
endwhile
return
finishUp()
x = 1
print heading1
while x < numberOfEls
print sal[x]
x = x + 1
endwhile
close files
return
Flowchart:
[pic]
[pic]
7. Create the flowchart or pseudocode that reads in a file of 10 employee salaries and prints them out from highest to lowest. Use a selection sort.
Pseudocode:
start
perform housekeeping()
perform selectionSort()
perform finishUp()
stop
housekeeping()
declare variables
open files
x = 1
read empSal
while not eof
sal[x] = empSal
x = x + 1
read empSal
endwhile
numberOfEls = x
return
selectionSort()
position = 1
while position < numberOfEls
x = position
smallest = sal[x]
y = x + 1
while y ................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related searches
- developmental psych chapter 9 quizlet
- chapter 9 cellular respiration test
- chapter 9 psychology test answers
- chapter 9 tom sawyer summary
- chapter 9 1 cellular respiration
- chapter 9 cellular respiration key
- chapter 9 cellular respiration answers
- chapter 9 cellular respiration answer key
- chapter 9 lifespan development quiz
- chapter 9 cellular respiration ppt
- mark chapter 9 verse 23
- mark chapter 9 niv