D- Written QuestionsExam 2

# D- Written QuestionsExam 2 - (in this example n=10 “No...

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

14:440:127, Fall 2008 Exam 2 Version D 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: Given any integer n, representing the number of lines, use a “for loop” to output following pattern
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: (in this example, n=10): * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * “No Computer” Question 2: Imagine that we had a new data type called uint6 , storing 6 bit unsigned integers. What’s the largest integer that uint6 could store correctly? “No Computer” Question 3: Write, save and use a function called myrandom that keeps generating new random numbers (decimals) until it generates a random number is within a specific range. The function should accept the minimum and maximum of the range as input arguments. It should return 2 outputs: 1) the number that fell in the range, and 2) the number of random numbers generated in order to find one in the range. “No Computer” Question 4: Write an anonymous function called log4 that calculates the log, base 4, of a number. Recall the change of base formula: log X Y = log(Y) / log(X)...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online