Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Practice Midterm Exam 1 - Computer Programming for Science | CSC 107, Exams of Computer Science

Material Type: Exam; Class: Computer Program for Science; Subject: Computer Science; University: Canisius College; Term: Fall 2006;

Typology: Exams

Pre 2010

Uploaded on 08/16/2009

koofers-user-18q
koofers-user-18q 🇺🇸

10 documents

1 / 6

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Name: CSC107 F06 Midterm #1 Page 1
CSC 107: Fall 2006 Midterm #1
Directions:
Clearly write your name at the top of every page.
Skim the entire exam before you start working. Not all questions are of equal difficulty; start
with the easiest ones before moving to the harder ones.
No computers or collaborations allowed.
If you need extra space for a problem, use the back of the previous page and then, if you
need even more space, ask for scratch paper.
Indicate your final answer clearly. Erase, scratch out, or otherwise clearly show anything
that is not part of your answer. I can only grade what I can see.
When a question asks you to write code, you must supply working C code to earn full credit.
Minor syntactic errors will not be penalized, but what the code is supposed to do must be
clear.
Points Breakdown:
1. 10 points
2. 20 points
3. 25 points
4. 25 points
5. 20 points
Total Points: 100 points
pf3
pf4
pf5

Partial preview of the text

Download Practice Midterm Exam 1 - Computer Programming for Science | CSC 107 and more Exams Computer Science in PDF only on Docsity!

CSC 107: Fall 2006 Midterm

Directions:

  • Clearly write your name at the top of every page.
  • Skim the entire exam before you start working. Not all questions are of equal difficulty; start with the easiest ones before moving to the harder ones.
  • No computers or collaborations allowed.
  • If you need extra space for a problem, use the back of the previous page and then, if you need even more space, ask for scratch paper.
  • Indicate your final answer clearly. Erase, scratch out, or otherwise clearly show anything that is not part of your answer. I can only grade what I can see.
  • When a question asks you to write code, you must supply working C code to earn full credit. Minor syntactic errors will not be penalized, but what the code is supposed to do must be clear.

Points Breakdown:

  1. 10 points
  2. 20 points
  3. 25 points
  4. 25 points
  5. 20 points

Total Points: 100 points

Problems:

  1. [10 * 1 points] State whether each of the following names is a:
    • GOOD VARIABLE NAME -or-
    • GOOD SYMBOLIC CONSTANT NAME -or-
    • STYLISTICALLY POOR VARIABLE NAME -or-
    • RESERVED WORD -or-
    • OTHER ILLEGAL VARIABLE NAME

(a) [1 points] counter

(b) [1 points] 3141519

(c) [1 points] sigma2nd

(d) [1 points] voidableCost

(e) [1 points] 2ndInput

(f) [1 points] GRAV CONSTANT

(g) [1 points] powerOf

(h) [1 points] UNION

(i) [1 points] floor

(j) [1 points] costIn$

  1. [25 points] Write a full C program that creates a symbolic constant, G, whose value is 9.8. The program should declare a variable of type double, named time, inputs the value of time from the user, and then prints out the result of the following equation:

  2. 5 ∗ G ∗ time^2

  1. [25 total points] For this problem, write the C statements (not full programs) that perform the actions desired. You should assume that all variables have been declared and are appropriately defined.

(a) [15 points] Uses a loop to compute and print out the first 15 powers-of-two (e.g., 2^0 , 2^1 , 2^2 , · · ·, 2^14 )

(b) [10 points] If the variable counter is greater than 5 and less than 10, assign the variable inRange the value 1. Otherwise, inRange should be set to 0.