# CS1030300 - Computer Science Foundation Exam March 3 2000...

This preview shows pages 1–3. Sign up to view the full content.

1 Computer Science Foundation Exam March 3, 2000 Section I A No Calculators! Name: _______________________________ SSN: ________________________________ In this section of the exam, there are three (3) 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 a combination of pseudocode, and programming language notation. Partial credit can not be given unless all work is shown. If you need extra room to do work to be graded then do so on the last page attached to this test. Make sure to clearly label the problem you are working on. As always, be complete, yet concise, and above all be neat , credit can not be given when your results are unreadable.

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

View Full Document
2 (1, 20%) Given the following array of numbers and procedure, answer the questions below. Assume that the global array X[1. .n] is correctly declared and contains the values shown. (So n=6.) Array X 131212 Position 123456 procedure ArrayOperation() i, j, k, s, t: integer; i ± 0; while (i < n) do i ± i+1; s ± 0; j ± 1; while (j <= n) do s ± X[j] + s; j ± j+1; endwhile X[i] ± s; endwhile endprocedure a) (6 pts) Show the array X after the procedure has executed? Array X 10 19 35 69 136 271 Position b) (7 pts) Consider the case where each element of the array X is equal to m, where m is a positive integer. Now consider executing the procedure ArrayOperation(). What will the sum of the elements of the array X be, in terms of m? 6m + 11m + 21m + 41m + 81m + 161m = 321m c) (7 pts) Consider the case where each element of the array X is a positive integer. If X[i] = X[i+1] for some integer i such that 0 < i < 6, what can we say about the relationship between X[i] and X[i+1] AFTER executing the procedure ArrayOperation()?
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 / 10

CS1030300 - Computer Science Foundation Exam March 3 2000...

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

View Full Document
Ask a homework question - tutors are online