CS1080202b - Computer Science Foundation Exam August 2,...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
Computer Science Foundation Exam August 2, 2002 COMPUTER SCIENCE I Section I B No Calculators! Name: SSN: Score: In this section of the exam, there are four (4) problems You must do all of them. The weight of each problem in this section is indicated with the problem. The algorithms in this exam are written in C. Any algorithms that you are asked to produce should use a syntax that is clear and unambiguous. Partial credit cannot be given unless all work is shown. As always, be complete, yet concise, and above all be neat . Credit cannot be KEY / 50
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
1 given when your results are unreadable.
Background image of page 2
2 1. (10 points – 8pts(a), 2pts(b)) Answer questions (a) and (b) for the recursive function shown below. (a) Provide a trace of the execution of this function when it is initially called with the statement: x = f(3,15) . (b) What is the final value that is assigned to x by this function? Solution: x = f(3,15) = f(4,15) + f(3,12) = f(5,15) + f(4,12) + f(3,12) = f(6,15) + f(5,12) + f(4,12) + f(3,12) = f(7,15) + f(6,12) + f(5,12) + f(4,12) + f(3,12) = 8 + f(7, 12) + f(6, 9) + f(5,12) + f(4,12) + f(3,12) = 8 + 5 + 3 + f(6,12) + f(5,9) + f(4,12) + f(3,12) = 8 + 5 + 3 + f(7,12) + f(6, 9) + f(5,9) + f(4,12) +f(3,12) = 8 + 5 + 3 + 5 + 3 + 4
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

This document was uploaded on 09/21/2011.

Page1 / 7

CS1080202b - Computer Science Foundation Exam August 2,...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online