Docsity

Solved Exam on Computing for Engineers | CS 1371, Exams of Computer Science

Partial preview of the text

Download Solved Exam on Computing for Engineers | CS 1371 and more Exams Computer Science in PDF only on Docsity!

CS1371 - Computing for Engineers Test 2 Version G March 16th, 2005 (20 points) Problem 1 - Multiple Choice 1. G points) You are given the waveform file soundtest . wav, and the following | / Matlab commands are executed: [x £s] = wavread('‘soundtest.wav’); L = length (x) ; The time duration in seconds of soundtest . wav is (circle only one): a, L*fs b.) L/fs 4 c £s8/L d, fs*L/ (L+1) e. fs*L/(£s+1) 2. (5 points) You are given an image file american_flag. jpg in which only the “pure colors” red, white, and blue appear, and the following Matlab code segment is executed: af = imread('american_flag.jpg') ; [zl,cl] = find(af(:,:,1) == 255 ... ted && af(:,:,2) == 0... Blue && af(:,:,3) == 0); Woke [r2,c2] = find(af(:,:,1) == 0... && af(:,:,2) == 0... && af(:,:,3) == 255); ’ [x3,¢3] = find(af(: == 255... && af(:,:,2) == 255... && af(:,:,3) 255); af(r1,c1,1) = 0; See Ho af(x2,c2,1) = 255; Red u af(x1,c1,3) = af (r2,02,3) = 0; af(r3,¢c3,:) = image (af) How does the resulting image af differ from the original image (circle only one)? a. Red pixels become white, blue pixels become red, and white pixels become blue /S 2. White pixels become red, red pixels become blue, and blue pixels become white . \Blue pixels become red, red pixels beconje blue, and white pixels become black - Blue pixels become white, red pixels become black, and white pixels become red. e. None of the above Page 3 of 8