



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
The final exam for cs 2073 computer programming with engineering applications held in fall 2008. The exam consists of six questions, and students have 120 minutes to complete it. The questions cover topics such as c programming, file i/o, arrays, pointers, and functions.
Typology: Exams
1 / 7
This page cannot be seen from the preview
Don't miss anything!




Fall 2008 – Final — May 9, 2008 1:30pm - 4:00 pm
Name:……………………… Score: ……./ Sequence number:…………. This exam has six questions. You have 120 minutes. Good luck…
#include <stdio.h> #define PI 3. int main(void) { /* Declare variables. If needed, you can declare more*/ int a,b,c, degree;
/* Enter the start degree, end degree, and increment */ printf("Enter a b c : "); scanf("%d %d %d", &a, &b, &c);
system("pause");
/* Exit program. */ return 0; }
Name:…………..
1 30 30 10 30 30 30 30 30 30 2 40 40 30 40 40 40 40 40 40 3 50 50 40 50 50 50 50 50 50
Write a program that can read the above file and output the student ID, and the average grade based on the best eight hw after dropping the lowest one.
(Hint: in a loop find the total of nine while finding the minimum of nine for each student, then you can take (total-min)/8 as the average).
For the above file, your program should generate the following output on the screen:
Student Id Average
1 30 2 40 3 50
Complete the code in the next page.
x[0] 5
x[1]
x[2] 3
y[0] 0
y[1] 0
y[2] 0
j a b n i j a i j
sum
Name:……………………
For example, if a = {2, 5, 7, 8, 13} and b = {1, 5, 7, 9, 12} , then your function will return 3 as the number of elements in c , and we will have c = {2, 8, 13} as a-b.
int set_difference(int a[N], int b[M], int c[N]) {
return …………….
}
Name:……………………
name Address Content/Value
x 11
y 12
z 13
p1 14
p2 15
16
a 59
b 60
c 61
d 61
x 63
y 64
65
Name:……………………
main() {
**int x, y, z, p1, p2;
p1 = &x; p2 = p1; x=4; y=5;
*z = f1(x, p1, p2, &y);
**printf(“x=%d y=%d z=%d “ “ and *p1=%d *p2=%d “, x, y, z, p1, p2);
}
**int f1(int a, int b, int c, int d)
{
int x, y;
**x = *c + a; y = *d – b; c = x; d = y; return x-y;
}