Docsity

Practice Exam 3 - Introduction to Computing | CS 1301, Exams of Computer Science

Toggle sidebar
bg1
CS 1321, Fall 2005 Exam 3 Friday, Dec 2, 2005
Your Name:
Signature:
TA’s Name:
INTEGRITY: By taking this exam, you pledge that this is your work and you have neither
given nor received inappropriate help during the taking of this exam in compliance with the
Academic Honor Code of Georgia Tech. Do NOT sign nor take this exam if you do not agree
with the honor code.
READ THIS: If your cell phone, pager, or beeper go es off during the exam, you will lose
10 points off this exam. Turn all such devices off and put them away now. You cannot have
them on the desk.
G T
A
A
E
A
B
B
G
B
C
C
H
0
0
0
C
D
D
0
1
1
1
D
E
E
1
2
2
2
E
F
F
2
3
3
3
F
w
G
3
4
4
4
G
H
H
4
5
5
5
H
I
I
5
6
6
6
I
J
J
6
7
7
7
J
K
K
7
8
8
8
K
L
L
8
9
9
9
L
M
M
9
M
N
N
N
O
O
O
P
P
P
Q
Q
Q
R
R
R
S
S
S
T
w
T
U
U
U
V
V
V
W
W
W
X
X
X
Y
Y
Y
Z
Z
Z
Print your GT email in the spaces provided to the left, and fill in
the ovals of the corresponding numbers and letters.
Academic misconduct will not be tolerated. Penalties will be a
zero on this exam, an F grade in the course, and/or other disci-
plinary action.
•Keep your eyes on your own paper.
•Do your best to prevent anyone else from seeing your work.
•Do not communicate with anyone other than a proctor for
ANY reason in ANY language in ANY manner.
•Do not share ANYTHING during the exam. (This includes
no sharing of pencils, paper, erasers).
•Do not use any paper that is not given to you by a proctor.
•Cell phones, beepers, hand-held computers, calcu-
lators, etc. are completely prohibited during the
exam. You cannot have them turned on, nor sitting on
the desk. You cannot use them as a clock.
•Follow directions given by the proctor.
•Stop all writing when told to stop. Failure to do so is
absolutely considered academic misconduct.
•Do not use notes, books, etc during the exam.
Problem Points Possible Points Earned Points Lost Graded by
1 2
2 20
3 20
4 5
5 10
6 5
7 15
8 5
9 8
10 10
Bonus 5
TOTAL 100
pf3
pf4
pf5

Partial preview of the text

Download Practice Exam 3 - Introduction to Computing | CS 1301 and more Exams Computer Science in PDF only on Docsity!

CS 1321, Fall 2005 Exam 3 Friday, Dec 2, 2005

Your Name:

Signature:

TA’s Name:

INTEGRITY: By taking this exam, you pledge that this is your work and you have neither

given nor received inappropriate help during the taking of this exam in compliance with the

Academic Honor Code of Georgia Tech. Do NOT sign nor take this exam if you do not agree

with the honor code.

READ THIS: If your cell phone, pager, or beeper goes off during the exam, you will lose

10 points off this exam. Turn all such devices off and put them away now. You cannot have

them on the desk.

G T

A 

A 

E 

 A

B 

B 

G 

B

C 

C 

H 

 C

D 

D 

 D

E 

E 

 E 

F 

F 

 F 

w

G 

G

H 

H 

 H

I 

I 

 I 

J 

J 

 J 

K 

K 

 K

L 

L 

L 

M 

M 

 M

N 

N 

 N

O 

O 

 O

P 

P 

 P 

Q 

Q 

Q

R 

R 

 R

S 

S 

 S 

T 

w

 T

U 

U 

 U

V 

V 

V

W 

W 

 W

X 

X 

 X

Y 

Y 

 Y

Z 

Z 

Z 

Print your GT email in the spaces provided to the left, and fill in the ovals of the corresponding numbers and letters.

Academic misconduct will not be tolerated. Penalties will be a zero on this exam, an F grade in the course, and/or other disci- plinary action.

  • Keep your eyes on your own paper.
  • Do your best to prevent anyone else from seeing your work.
  • Do not communicate with anyone other than a proctor for ANY reason in ANY language in ANY manner.
  • Do not share ANYTHING during the exam. (This includes no sharing of pencils, paper, erasers).
  • Do not use any paper that is not given to you by a proctor.
  • Cell phones, beepers, hand-held computers, calcu- lators, etc. are completely prohibited during the exam. You cannot have them turned on, nor sitting on the desk. You cannot use them as a clock.
  • Follow directions given by the proctor.
  • Stop all writing when told to stop. Failure to do so is absolutely considered academic misconduct.
  • Do not use notes, books, etc during the exam.

Problem Points Possible Points Earned Points Lost Graded by

Bonus 5

TOTAL 100

  1. 2 points What is your TA’s name (the one that actually grades your homework, for example)? (Circle

one.) Anne, Bobby, Charles, Chris, Dennis, Guy, Matt, Peter.

  1. 20 points File I/O. Write a function called avg that has no parameters. The function will open a

file named ”numbers.txt” and will compute the average of all numbers found in that file. (Don’t worry about the path, just use that name hard-coded.) The function returns the average (be sure to make certain that you are calculating the float average of the numbers.) The file is guaranteed to have one number per line and the numbers might have a decimal point. (So again, be sure to make these act as floats.) You may assume that the file will have at least one number in it.

  1. 10 points OO Inheritance. Now write a subclass called Square that inherits from the Rectangle class

you have written. It will require only one method - a new constructor. The constructor for Square is to take one parameter, namely the length of a side. Inside the constructor though, go ahead and set a length and a width based on this one single length passed in. So in effect, a Square of size 5 is really storing the fact that the length and width are both 5. There is no need to rewrite the str or area methods.

  1. 5 points Function isPassing. Write a function called isPassing that takes a single float number and

returns the Boolean True if the number is equal to or greater than 70. The function returns False if the number is less than 70.

def isPassing(num):

  1. 15 points Functional Programming. Function countPassingGrades.

Write a function called countPassingGrades that takes a list of numbers as a parameter and then finds the number of passing grades from the list. REQUIREMENTS: 1) Within the function use a call to the built-in function filter to get only the numbers that are indeed passing by using the function you just wrote called isPassing. After that filter step, 2) use whatever you like to figure out the count of numbers in the resultant array. Be sure to return the result.

Do not print anything. Use the provided header.

Example: countPassingGrades([100, 90, 29, 63, 0, 85]) should return 3 Example: countPassingGrades([13, 0, 20, 41]) should return 0

def countPassingGrades(array):