ENG1D04_Midterm_VersionA_Solution

ENG1D04_Midterm_VersionA_Solution - ENGINEER 1D04 Midterm...

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

View Full Document Right Arrow Icon

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

View Full DocumentRight Arrow Icon

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

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

Unformatted text preview: 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 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 developers 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 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 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 haveis the Toeplitz matrix....
View Full Document

Page1 / 17

ENG1D04_Midterm_VersionA_Solution - ENGINEER 1D04 Midterm...

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

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