compeExam1_F06 - - ' _. ' Marine - Fall 2006 ' _. 'y 1 ....

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: - ' _. ' Marine - Fall 2006 ' _. 'y 1 . CompE16t) Intl'oductfonto Progrme _ I I Closed book, closednotes, 'no.cal_cu'l___:_1tersl I #7" V12” ID 3/ 1. Informafioh répresefztatibh- I. I 1 1?} a_. What unsigned integer value islrepljesented by: thewqrd -_1 1x0100012-(Base 2 code)? Z 0 C? l O ‘1 b. What signed integer value is represented by the word 1500110011 (2C code)? "' / 0 2 . . I ' _ _' . - " - 1922.? -M'*..__ m E c. Write the 8-bit word-that representg the'siglled mtcgcr 593 (2C code)? - ’55 ’l 5 (3‘0 I I f' ’35 "d. What is the range 'ofthe 8-bit de's Complement code; in‘ decimal? at 23g: x <= +127 .4»? 2a Thefollofin'g pragrdnt is difficult to feafl'becettse ofthe poor Itse- of fihitespace (13.9., / spaces,_ (abs and newlines); - Rewrite" the” program gsihg readable ewe. main (i) ‘ {intf X; 7 -' “5 z while-(y >- 0); f" ' -' _- _ i __ -- -. i .1 y/= ; ' ' . . .... ._.II__1_¢_L$.%I%/K'5 4—5;) .. .. , _ .- _ butane, (€34,749) }-printf(_fi'.’ ‘ ' ' ‘ "X = %.d’-Iy :vlgdxnu". X! Y); =10); 5.1 . _x=x”-+__3;. I. In” }-' Co'mpE160 Int'rc-Jduction't-o Framing-5”? -' I I I .-Marmo." _ - {2’ / 3. Show exacib: what will bé: 43151;;ng when 'tkefdilowingprogrém exefiutes. . . .q ... - . .5-1g” _r~_zI-;' - -;?2- main“ m: printf( ,I- m 2'37 /_k_+ 37_% k; -_ _ printf("m =-%d\n"}'M)i3 ng' f "'y =‘y +-i'f-j./'5r "' printf("%—8,1f%8;2f\n"; y; x);'- m a-u<>'i-*j) ?j + 3=ii . . .F~2: E printf{"m é %d\nf,,m){ ' ..,_ .. at“... ._ . . .r / _ main() . : . _. , . _" - -“ _. _ o int_i =-l; k.= 0;,= r _ ':w 1 -_ u- _ “a swhile (i <-10) - - ' - -i “ I ' { N . v] 4. Show'exdémz whq'xt will Be displfiyédpragrani éxeéutés. -if (i %_3'=='0y .- -s'- -ik += 3; - ;- a: : x=- -g else if ti =96 : ..2. _:==' v -_ __ '_ - 4r - ' __ k —=-2; else '- fl'-f_ _ ,' * Lk‘+=.lO;+ ..i+¥;_ I I }' - _ '- .fl- _u3 printf("k 5 %d\n",-k);‘ :- ; l - L.:u"#r-i---'-L'wi }-~ in a»: ---' - f»: { {fl /_.. CompEifiO Ifitrp'duction tOIP-rOgi'eI'nmihg.-' - '. -. are priced as'fallo ws: .',}-‘|—-‘.P_—‘I-‘l—‘_l-"l—‘I_—ll'—‘l—". r—‘mmmm'mmme' _pmmmmmmm'_m‘n—J' .l—rwmmmbj_._cfi'r\;uMI—fl -I—I-m N) 0": 0'1 -l\) |—‘ I“ "Emma-(41' '._' .. 1 --Marino _ ‘ _ l. 2 .2 2 2 2' 1 I—-.|—ir—*I—|H1'—|5+—H—Iri—-.I—l _' '|—'i__.I\) M (II ' Hfmm mm, Fall 2006 5. Supposed (heater' has sect: arranged be. (ows' ofIfl Seats each. I Suppose the seats Write a pregfam the! prapgpmal‘h-e met: (Qeflrerflge raw end mum of a seat, and-then _ prints the price ofth‘e.sear.- “(Thejji‘aifii‘fdnfi Edlmitfisfare each numbered 1 through 10.) For example, ifth'e' user enter's mm = 3 and column ' 2_dollars prides _ Use as few C stgtementgflqussible,‘ s -. x; K [II . .kl w-pai'r-i- C )- ' w s Eribt'i- firm-w (9% v f”? . . " II I é] . If. I‘. .Ffitfi 67% _ ' Fer-phi / eke/{ff 'Waw.1=-';~=._v ."-.II:'-¢r?i?_.."f3?‘"b _ _ . _ 4-,... :: "ea/e; ,2»- vs " )5 jc H J I: 51' - 3} 2 e: ~ -' =" 8, thepfogmm will print 8.&— CMQK 2) : f7 -- Hair, \V\ )1 ...
View Full Document

This note was uploaded on 05/12/2008 for the course COMPE 160 taught by Professor Marino during the Fall '08 term at San Diego State.

Page1 / 3

compeExam1_F06 - - ' _. ' Marine - Fall 2006 ' _. 'y 1 ....

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