COM SCI 33 Fall - 1998 Exam 2

COM SCI 33 Fall - 1998 Exam 2 - (10(10(10(10 1 2 3 4 CS 33...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
Background image of page 1

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

View Full DocumentRight Arrow Icon
Background image of page 2
Background image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: (10) (10) (10) (10) 1. 2. 3. 4. CS 33: SYSTEMS PROGRAMMING Computer Science Department University of California, Los Angeles Dr. John A. Rohr February 29, 1996 EXAMINATION 2 Which is simpler to program: a function for matrices which have a lower bound of zero or a function for matrices which have a nonzero lower bound. Justify your answer. [OM/L/ 649'“ A94 C“: Mara, AIM 1‘; mm"? y-taa+' """* ' (“SF‘J'Q'E’ arm/«‘- ‘i: “(0/ 5w _._¢ (ML ¢%‘2 0 IR “(1%: C: ¢MJ(-zgw (I, Wtzx % lI—b macA fl'. "I'M z'rl’fi-T EWCM' A“ Lag/£54139“ 51 u 5! +3 (can)th ‘« “A?” 3 1; n wuro but/5°“ «=4 3. addrm] -r admiral, +(c — bark} KM Mac. I- "‘Jrc ‘- <-»'-,Ea.6'1= “37’” For the main program in Figure 8.21 on page 161 and the subroutine in Figure 6.22 on page 162, show the contents when the program halts of all memory words which were used as part of the stack during execution. Show the exact numerical value of each stack word where it can be determined; for all other stack words, give the content symbolically (e.g. "Original SP"). ms: Mnmfi XL__ sum. _:i_‘«_‘_e___:;£_.l‘i€_8_1__- $DF9: _ye_!.:c__‘r_m__fi£‘::r;‘:iii snrn: _€€i;i“_5.a_f_:__f§_tj_‘_____ $DFA. _;’:_‘::_oi__f:___.__ $an: _____I_L2_.___i_..________ _____ $DFF: Mzfiméfli ____ __ $DFB: fiPfiQflLL: 3“ ’ “’1‘ ’~ each: 55 In the program in Figure 7.10 on page 180, the character from the left side of the string which is pointed to by IDX_1 is stored in TEMP and then compared with the character from the right side of the string which is pointed to by IDX_2. Why can't the left-side character he held in the accumulator (ACC) and compared directlywith the right-side character without storing it in a temporary variable such as TEMP? TLL LID-’4 (enema-HI I'ow‘b ox claw—nah!" €95"th +9671“! «#3 “+73 R-(Cumulqj‘br; 1n orAa/ ‘ID cornan (Ea-fig, (Lg.I-t-..+cu;‘ and? anus} 5:11, irna‘cA "tn—{"5 “4—- ACL UTA?! tapas S‘rncc (II-ate. I; 1 Add, arc ck-«f- Mu-S’f 'bc 9th 3" "‘ *‘W‘P‘ “9';a5‘c VLF-it, chDd omeOI-mr I5 WAZJ-TL‘J fl'er‘rAJt (/Lmr. pun—5+ Lt ram—ales, Idi‘: 1’1; 4((3 +5 link“; In the program in Figure 8.43 and 8.44 on pages 230 and 231, the f fcfHa/ oft... variable RUNNING is used to maintain the status of the printer (whether (7.3- Wum or not it is printing). In the program in Figures 8.34 on page 222, no gap-4 A r» similar variable is used or maintained. Why is the status variable . 7 . needed in one of the programs bait not the an“ A A fit} $5.4 “(4 My“. , A 8 M )L‘ Lat “(A I [-C‘Icv P {3 J v 7 _ WM.” 6}” a ' '{arr J my *0; out“ "v shred m" r" "at “Hex Mam», Q! mglw * it i ' diff WWW], , r 4,,» 9hrng +. FL M " LA - 6“ ‘ a "I . I u: ’ I r W b ‘9; s q A :l I} 7 ‘ («yogi/L?“ n‘.n_;\“ :7 n(l_‘ahd F32: Nd T {C r60 C‘ ( Ska. >6 O .4 filial rib Tu— enrt , um -«k3‘.orFerc MAI-L Th CU’Hr‘Jr IDR. CS 33: S stems Pro r ‘ : Winter 1996: Dr. ohn Rohr: Examination 2 Pa e 2 (30) 5. Program 1 on the following pages has 10 errors. Each error is correctable by changing only one line. Find each error, explain what 1. is wrong, state the line number of the line which must be corrected, and v ' give the corrected statement. You will receive three points for each error correctly identified and corrected and you will have one point deducted for any correct line which you specify to be changed. (6)“, ,K Error 1: w to“? Line #: M__ Correct Statement: ml [ET/U 4 4 ErrorZ: kin—v] Maker o'F ((arflmd't/S Miriam 91"? 91“‘L\ Line #: Correct Statement: A ‘7 5 t“; 2' 4’3 Error 3: 'wanc] 6‘; Line #: lg l Correct Statement: » 910R 9 E69 ' é‘l/ Error 4: _ Correct Statement: Error 5: Correct Statement: Error 6: Line #: Error 7: Line #: Correct Stat Error 8: Line #: Correct Statement: Error 9: Line #: _._ Correct Statement: Error 10: Line #: ____.____ Correct Statement: (30) 6. Program 2 on the following pages has 10 errors. Each error is correctable by changing only one line. Find each error, explain what is wrong, state the line number of the line which must be corrected, and g 9% give the corrected statement. You will receive three points for each —/ error correctly identified and corrected and you will have one point deducted for any correct line which you specify to be changed. Error 1: bdrm/.7 (9mmme car/(er _ c A V Line #2 fl. Correct Statement: ate-'4' Error 2: WM“? Pung 61.4.,— 7k Line #: i3." Correct Statement: ’rmat‘m 5M weer was‘lzr “crib ‘3‘“. 925 "(‘kast Error 3. WWW Paganifir oral; — '/ m w J math «)6 Loot—7mm; 7K Line #1 CorrectStaternene‘ WWW-“E WORD fi‘x’rrra1) Error 4: \Nmrrga—‘g fiM/mggj New! ‘1. 'l- P'} «K g? WORD 5125/ “RD Line #: l‘ Correct Statement: PS FM “ Error 5: W (5;??(754 #09495: 46/ Line #: %L/ Correct Statement: ML— Error 6: Line #1 __.__ Correct Statement: Error 7: Line #: _ Correct Statement: Error 8: Line #: __ Correct Statement: Error 9: Line #: __ Correct Statement: Error 10: Line #: ________ Correct Statement: ...
View Full Document

This test prep was uploaded on 02/21/2008 for the course COM SCI 33 taught by Professor Rohr during the Fall '98 term at UCLA.

Page1 / 3

COM SCI 33 Fall - 1998 Exam 2 - (10(10(10(10 1 2 3 4 CS 33...

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

View Full Document Right Arrow Icon
Ask a homework question - tutors are online