{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

ENG1D04_Midterm_VersionA_Solution

# ENG1D04_Midterm_VersionA_Solution - ENGINEER 1D04 Midterm...

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

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

View Full Document
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
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

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

View Full Document
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
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### What students are saying

• 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.

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

• 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.

Dana University of Pennsylvania ‘17, Course Hero Intern

• 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.

Jill Tulane University ‘16, Course Hero Intern