



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
Material Type: Exam; Class: Computer Program for Science; Subject: Computer Science; University: Canisius College; Term: Fall 2006;
Typology: Exams
1 / 6
This page cannot be seen from the preview
Don't miss anything!
Total Points: 100 points
(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$
[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:
5 ∗ G ∗ time^2
(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.