{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

ENG1D04_Midterm_VersionA_Solution

ENG1D04_Midterm_VersionA_Solution - ENGINEER 1D04 Midterm...

Info icon This preview shows pages 1–5. Sign up to view the full content.

View Full Document Right Arrow Icon
ENGINEER 1D04 Midterm Examination SOLUTIONS Day Class 01, 02, Version A Dr. S. Smith and Dr. W. Farmer DURATION : 2 hours McMaster University Midterm Examination (CAS) October 27, 2009 Please CLEARLY print: NAME: Student ID: This examination paper includes 17 pages and 30 questions. You are responsible for ensuring that your copy of the paper is complete. Bring any discrepancy to the attention of your invigilator. Special Instructions : 1. It is your responsibility to ensure that the answer sheet is properly completed: Your examination result depends upon proper attention to these instructions: A heavy mark must be made, completely filling the circular bubble, with an HB pencil. Print your name, student number, course name, course number and the date in the space provided on the top of Side 1 and fill in the corresponding bubbles underneath. Fill in the bubble corresponding to your version number. Mark only ONE choice from the alternatives (1, 2, 3, 4, 5 or A, B, C, D, E) provided for each question. If there is a True/False question, mark 1 (or A) for True, and 2 (or B) for False. The question number is to the left of the bubbles. Make sure that the number of the question on the scan sheet is the same as the number on the examination paper. Pay particular attention to the “Marking Directions” given on the scan sheet. Begin answering the questions using the first set of bubbles, marked “1.” Answer all questions. 2. The use of notes and text books is permitted. 3. No calculators or pocket computers are to be utilized. 4. Read the questions carefully. 5. Try to allocate your time sensibly and divide it appropriately between the questions. 6. Select the best alternative in all cases. continued on page 2
Image of page 1

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

View Full Document Right Arrow Icon
SFWR ENG 2AA4 SOLUTIONS2/17 Question 1 [1 mark] An algorithmic solution of a problem is the solution that can be reached A Heuristically on the basis of the developer’s experience B Through a direct set of steps C By analyzing field data D Using advanced computational methods E All of the above ANSWER: B Question 2 [1 mark] Consider the following method for swapping (switching) the values of two variables: 1 void swap(double x, double y) 2 { 3 double z; 4 z = x; 5 x = y; 6 y = z; 7 } Which line of the program contains an error? A 1 B 3 C 4 D 5 E There is no error ANSWER: A continued on page 3
Image of page 2
SFWR ENG 2AA4 SOLUTIONS3/17 Question 3 [1 mark] Which of the following code fragments produces a loop that will repeat statement S as long as a b c ? 1. while ((a<=b)&&(b<=c)) { S } 2. if (a <= b <= c) { do { S } while (a <= b <= c); } 3. while (a <= b) { while (b <= c) { S } } A Fragment 1 B Fragment 2 C Fragment 3 D Fragment 1 and 2 E All of the fragments ANSWER: A continued on page 4
Image of page 3

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

View Full Document Right Arrow Icon
SFWR ENG 2AA4 SOLUTIONS4/17 Question 4 [1 mark] A matrix (two dimensional array) that is important in many applications, such as in signal processing, is the Toeplitz matrix. A Toeplitz matrix is one where all elements on a diagonal are equal. If we have the values r o , ..., r N - 1 , ..., r 2 N - 2 , then we can construct an N × N Toeplitz matrix. For instance, if N = 4, then the matrix would be: T = r 3 r 4 r 5 r 6
Image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern