CS1080103a - Computer Science Foundation Exam August 1,...

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

View Full Document Right Arrow Icon
Computer Science A Page 1 of 4 Exam Computer Science Foundation Exam August 1, 2003 COMPUTER SCIENCE I Section I A SOLUTION KEY Name: SSN: Score: 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 C programming language notation. Partial credit cannot be given unless all work is shown. As always, be complete, yet concise, and above all be neat . Credit cannot be given when your results are unreadable. / 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. (20 points) What is the exact output from the following program? Output : 16 3 6 8 4 6 3 8 7 8 19 5 4 8 4 6 3 7 7 8 #include<stdio.h> int f1(int a[], int *b, int c, int d) { a[*b] = c; a[d] = 3; c = *b; *b = *b/2 + d; d = d + 1; return *b + c + d; } int main() { int a[]= {8,4,6,2,8,7,9}; int b, c, z, i; c = 6 ; b = 3; z = f1(a, &c, a[4], b); printf("%d : %d : %d \n", z, b, c); for (i = 0; i < 7; i++)
Background image of page 2
Image of page 3
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 / 4

CS1080103a - Computer Science Foundation Exam August 1,...

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

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