Exam-SYSC2003-2010March - C arletonU niversity E a o...

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

View Full Document Right Arrow Icon
Carleton University Department of Systems and Computer Engineering SYSC-2003 Midterm 2, Winter 2010 Name: Mark z 145 Student Number : Interpretation of the exam text is a nart of the evaluation. Do not ask questions unleis vou believe there is an error. Anything you need: make an assumption and write it clearly. Tip: in all programming exercises, you can earn part marks by writing the skeleton of the program even if you can't write all the logic. Tip 2: the points given to each exercise should be used as a hint on how much time to spend on theml do not spend long time for exercises with few marks (your answers there are supposed to be brief). Question I [14 marks] Arrays, Subroutines, C progtamming, Recoup exercise for Midterm 1 Consider the following C program, which reads two vectors (v1 and v2) of a given SIZE, and computes the dot product of the two of them, storing the results in the result vector (reminder: Dot Product definition: if a = lal, a2,. .. , an] and b : [b1, b2, '.', bn], then a.b al.b 1 +a2.b2+ .+an.bn). #define SIZE 10 void main (void) { char vl-tSIzEl , v2lSIZE); // elements are 8-bit long int i=0, OK, resul-E; / / FIII in v1 and v2 with dat,a using the read-data O function for (i=0; i<SIZE-l-; i++) { vltil r€ad dataO;// reads an integer value
Background image of page 1

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

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

Page1 / 8

Exam-SYSC2003-2010March - C arletonU niversity E a o...

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

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