{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

compeExam1_F06

# compeExam1_F06 - Marine Fall 2006'y 1 CompE16t...

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

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: - ' _. ' 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. Informaﬁoh 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 Thefolloﬁn'g pragrdnt is difﬁcult to feaﬂ'becettse ofthe poor Itse- of ﬁhitespace (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(_ﬁ'.’ ‘ ' ' ‘ "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 exeﬁutes. . . .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 displﬁyédpragrani éxeéutés. -if (i %_3'=='0y .- -s'- -ik += 3; - ;- a: : x=- -g else if ti =96 : ..2. _:==' v -_ __ '_ - 4r - ' __ k —=-2; else '- ﬂ'-f_ _ ,' * Lk‘+=.lO;+ ..i+¥;_ I I }' - _ '- .fl- _u3 printf("k 5 %d\n",-k);‘ :- ; l - L.:u"#r-i---'-L'wi }-~ in a»: ---' - f»: { {ﬂ /_.. CompEiﬁO Iﬁtrp'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_._cﬁ'r\;uMI—ﬂ -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' ofIﬂ Seats each. I Suppose the seats Write a pregfam the! prapgpmal‘h-e met: (Qeﬂrerﬂge raw end mum of a seat, and-then _ prints the price ofth‘e.sear.- “(Thejji‘aiﬁi‘fdnﬁ Edlmitﬁsfare each numbered 1 through 10.) For example, ifth'e' user enter's mm = 3 and column ' 2_dollars prides _ Use as few C stgtementgﬂqussible,‘ s -. x; K [II . .kl w-pai'r-i- C )- ' w s Eribt'i- ﬁrm-w (9% v f”? . . " II I é] . If. I‘. .Fﬁtﬁ 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

• Fall '08
• Marino
• integer value, unsigned integer value, 8-bit word-that representg, gsihg readable ewe, CompEiﬁO Iﬁtrp'duction tOIP-rOgi'eI'nmihg., raw end mum

{[ snackBarMessage ]}

### Page1 / 3

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

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

View Full Document
Ask a homework question - tutors are online