t2vM - end B. C. ret1 = [ ] B. ret2 = [200] A. ret3 = [400...

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

CS1371 – Test 2 Version M Solutions October 24th, 2007 CS 1371 Computing for Engineers Test 2 Version M Solutions – Fall Semester 2007 Problem 1 – Structure Arrays [50 Points] 1. varA = C. {‘name’; ’instrument’; ’age’} 2. varB = B. 1 3. varC = A. 0 4. varD = B.’ BobJohnLucy’. 5. varE = B. ‘GATNFL’ 6. varF = A.[19 21 23] 7. varG = D. Error Problem 2 – File I/O [50 Points] 1. varA = C. ‘Dave’ 2. varB = B. 13 3. varC = A. 2 4. varD = A. 0 5. varE = B. 1 6. varF = A. 0 Problem 3 – Recursion [50 Points] A. function ret = recursive_Space(vec) if length(vec)==0 ret = ''; else temp = vec(1); if (temp==' ') ret = recursive_Space(vec(2:end)); else ret = [temp recursive_Space(vec(2:end))]; end

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: end B. C. ret1 = [ ] B. ret2 = [200] A. ret3 = [400 -300 200] C. -Needs to have a terminating condition -Needs to move towards termination -Need to have a call to a clone of the function CS1371 Test 2 Version M Solutions October 24th, 2007 Problem 4 Plotting [50 Points] 1 - subplot(2, 2, 1) 2 - C 3 - E 4 - F 5 - G OR H 6 - H OR G if 5 is H 7 - subplot(2, 2, 2) 8 - B 9 - E 10 - F 11 - G OR H 12 - H OR G if 5 is H 13 - subplot(2, 2, 3) 14 - A 15 - E 16 - F 17 - G OR H 18 - H OR G if 5 is H 19 - subplot(2, 2, 3) 20 - D 21 - E 22 - F 23 - G OR H 24 - H OR G if 5 is H B. 1. C. linspace( 0, 2*pi) 2. D. uu 3. A. rr.*cos(tth) note: part 3 and 4 answers can be switched 4. C. rr.*sin(tth) 5. B. vv...
View Full Document

t2vM - end B. C. ret1 = [ ] B. ret2 = [200] A. ret3 = [400...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online