









Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!










0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 7 8 8 8 8 8 8 8 8 8 9 9 9 9 9 9 9 9 9 A A A A A A A A A B B B B B B B B B C C C C C C C C C D D D D D D D D D E E E E E E E E E F F F F F F F F F G G G G G G G G G H H H H H H H H H I I I I I I I I I J J J J J J J J J K K K K K K K K K L L L L L L L L L M M M M M M M M M N N N N N N N N N O O O O O O O O O P P P P P P P P P Q Q Q Q Q Q Q Q Q R R R R R R R R R S S S S S S S S S T T T T T T T T T U U U U U U U U U V V V V V V V V V W W W W W W W W W X X X X X X X X X Y Y Y Y Y Y Y Y Y Z Z Z Z Z Z Z Z Z ↑ Print your Prism username in the spaces provided, and shade the boxes of the corresponding numbers and/or letters. I hereby signify that this examination paper contains my own work exclusively, and I have neither given nor received inappropriate help during the taking of this examination, in compliance with the letter and spirit of the Academic Honor Code of Georgia Tech. Name (print): GT ID# 9 0 ___ ___ ___ ___ ___ ___ ___ Signature: TA / Section: ____________________________ Prob. Poss. Pts Earned Pts Lost Pts by (cover) - - 1 35 2 20 3 25 4 20 TOTAL 100 Please Note: Failure to complete this front sheet correctly will cost you 5% of your grade. Please turn off (or silence) and put away any cell phones, beepers/pagers, personal radios or music players that you have in your possession Good Luck!
Academic misconduct (including - but not limited to - examples on the list below) could result in a zero score on this examination, an “F” final grade in the course, and/or other disciplinary action:
B. Multiple Choice ( Circle all that apply )
You are given an image img.jpg. The following is a piece of MATLAB code which modifies the image. img.jpg looks like… pic=imread('img.jpg'); [r,c,l]=size(pic); rmid=r/2; cmid=c/2; temp1=pic(1:rmid,1:cmid,:); pic(1:rmid,1:cmid,:)=pic(rmid+1:end,cmid+1:end,:); pic(rmid+1:end,cmid+1:end,:) = temp1; temp2=pic(1:rmid,cmid+1:end,:); pic(1:rmid,cmid+1:end,:) = pic(rmid+1:end,1:cmid,:); pic(rmid+1:end,1:cmid,:) = temp2; pic(rmid+1:end,:,:) = pic(rmid+1:end,end:-1:1,:); pic(rmid,:,:) = 0; pic(:,cmid,:) = 0; imwrite(pic,'newimg.jpg') Draw the image newimg.jpg in the following box.
You are to write a function called playSong that will take in a cell array of notes and return a sound vector of the notes with a 1/10 second pause between each note. Assume a sampling frequency of 8000 Hz. You must use recursion. To help, you are given the notemaker function (analogous to the homework question). Below is the help documentation for that function: % NOTEMAKER Produces a sound vector of the note given a string % % Usage: ret = notemaker(str) % str = Input string representing note (i.e. ‘C#’) % ret = Sound vector of note Ex. ret = playSong({‘F’ ‘G’ ‘A’ ‘A#’ ‘C’ ‘D’ ‘E’ ‘F’}) ret will be a sound vector of the F Major scale. function ret = playSong(ca) % Use the function header given above. Your code goes here.
Q18 Write a function grade that calculates a student’s final average for a course based upon the following information:
Q20 Given the function definition: function song = sing(name, event) song = ['Happy ', event, ' to ', name]; return; fprintf ('%s\n', song); And the following code statements: banner = 'Happy Birthday'; sing ('Katie', 'Birthday'); fprintf ('%s\n', banner); What is the output of this code? Q21 function abbr = acronym(s) % missing code end Complete the function acronym so that it returns an acronym, a string formed by taking the capital of the first letter of the words in the input string. Return ‘Error’ if the input string is only one word.
Q23 array1 = [1, 3, 5, 7, 9]; array2 = [0, 2, 4, 6, 8]; j = length(array1); array2(1) = array1(j); array1(j) = array1(3); array1(3) = array2(3) - 1; array1(j - 1) = array2(j - 2); array1(2) = array2(j) / array2(3); array2(3) = array1(3); array2(2) = array1(3) + 9; What are the values of array1 and array2 after the code above is executed? Q countOdd = 1; countEven = 1; for i = 1 : length(numList) if 1 2 ; countOdd = countOdd + 1; else 3 ; countEven = countEven + 1; end end Write code fragments to fill in blanks 1, 2, and 3 to complete the code above such that it separates an array of integers numList into two arrays, odd, containing the odd integers, and even, containing the even integers.
Q25 function ans = power(x, n) if n == 1 ans = x; else ans = x * power(x, n - 1); In your own words, explain what the computer does when it executes the following function call: power (2, 4); Q26 function ans = tryMe(s, c, value) if length(s) == 0 ans = value; elseif s(1) == c value = value * 2; ans = tryMe(s(2:end), c, value); else value = value + 1; ans = tryMe(s(2:end), c, value); end What is the value returned by the function call below? tryMe('mississippi', 'i' , 1);
This page intentionally left blank for any extra work.