B- Written QuestionsExam 2

# B- Written QuestionsExam 2 - those results in a vector...

This preview shows page 1. Sign up to view the full content.

14:440:127, Fall 2008 Exam 2 Version B The entire exam is closed book, and there is no collaboration permitted. All of your answers must be written in blue books; you will have separate bluebooks for the “No Computer” and “Computer” sections. Be sure to put your name and RUID on all bluebooks you use. Each “Computer” question is worth twice as much as each “No Computer” questions. All answers must relate to the Matlab programming language. For the first 20 minutes, you will not be permitted to use the computer. After 20 minutes, we will collect your bluebook for the first 4 (written) questions, and you will be permitted no further changes to those answers. For the final 4 questions, you will be permitted to use the computer by logging in to your special “Exam Accounts.” If you log in to your normal engineering account at any point during the exam, you will automatically fail. “No Computer” Question 1: Write a for loop that calculates the first 10,000 values of the Fibonacci sequence, and stores
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: those results in a vector. Recall that the first two terms of the Fibonacci sequence are both 1. All subsequent terms are the sum of the two preceding terms, i.e. 1, 1, 2, 3, 5, 8, 13,…. At the end, display your vector. “No Computer” Question 2: Write the binary number 1100101 in Base 10. (In other words, convert from Base 2 to Base 10) “No Computer” Question 3: Write a function that returns a vector containing two random integers between -20 and 20. “No Computer” Question 4: a) Write Matlab code that generates a 100 x 100 vector of zeros, and sets just the element in Row 3, Column 4 to be 128. Save this matrix as M1. b) Now, save M1 as a sparse matrix in the variable M2. c) In the preceding example, will the matrix M1 or the matrix M2 use less memory? d) Had the matrix M1 consisted entirely of unique, non-zero values, would M1 or M2 have used less memory?...
View Full 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