Example Mid-terms - CE311K Exam No. lA . Name: 4 Mareh 1004...

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

View Full Document Right Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: CE311K Exam No. lA . Name: 4 Mareh 1004 4. (25%) Identify all errors in the following FORTRAN77 program e ~IZfOGRAM ~SS~ ..",0 Upl~ 'i~'PLICIT NONE REAL TAX TAX = 25. . REAL" aOURS, RATE, GROSS, NET ),t4XRAT* " .--~ HOURS = O. RATE =[§lj. OPfJl/{VN/7"::.C, ..-- GROSS = O. ') I NET = O. ld1jcONTINUE I f READ *, ~OUR::X. b/4Nf( IF(HOURS.LT.O.)THEN I~ " fa'" - \ STOP 1LSE J J ; PRINT *, 'Read hourly rate' READ *, RATE GROSS = HOURS·t RATE TAXRATX = TAX / NET ~~n:E( '.>'" ) " -- , PRINT <:0/ t\ ~E *, 'Gross pay is 111 GROSS ~ROSS ~Im = -NET +-rli K PlltV"( I ~E *, 'Net pay is $, NET \ Go TO 10 ENDIF CE 311K MIDTERM NaDle: _________ OPEN TO STRUCTURED FORTRAN 77 FOR ENGINEERS AND SCIENTISTS by D. M. Etter, CALCULATOR, PENIPENCIL I. (30%) Detennine the value ofthe final arithmetic statement for each set ofFORTRAN 77 code. b.) Xl = _-58.257_ c.) Y =_-3.79S798e-22_ d.) ~ SURFA == _S.026S44e-09_ ,,1ft e.) H =.2Se-7 j PH =-1.*LOG(H) RANGE = PH -4. INCREM = RANGE/20 ., ftlutvCff~1' INCREM=_O_ ~ ,#ffy1 1. (30%) Respond to the questions after executing the following code. PROGRAM LOOPS ::r INTEGER ACOUNT, BCOUNT ACOUNT ... (Ii) L Z. BCOUNT(%j LSTART=2 -I _ ~"O LSTOP=-S LINCR =-3 _lJ.. -Zf" NUM1= 1 NUM2= NUMl ~ RATIO= O. "cC'::, @ DO 10J= 10/(y '2../ ./ ') DO~OL='LSy,(RT, ~ ,L~R RATIO = 10 • J'I I [ ACOUNT = ACOUNT + RATIOJ 20 CONTINUE BCOUNT'"' BCOUNT .J. 10 CONTINUE PRINT·, 'BCOUNT =', BCOUNT STOP END a.) How many times are the statements inside the inner DO loop executed? r"i ~ ~ 12- b.) How many times is the outer DO loop executed? r c.) What is the final value ofACOUNT? 12 -YO -t..S--<l0 -~S--2('"-3~ -yO -itt d.) What is the final value ofBCOUNT? ~ ~ l{) \( r, P(' tll )( \1 e.) What is the fmal value of RATIO? -'l"l- of ::r tS rl1C r(l"'i}L v~U E I( __12 __ ___4 ___-422 __79040. __ __-47 __ 22... -f 3. (30010) wrio.~ignment statements for the following arithmetic e ilt·in functions, where appropriate, ~ate FORTRAN77 variable names. 00NOT . mixed mode e ssions. Substitute an appropriate variable name where necessary to avoid mixed·mode expres .--.:'---_ 3 2 a.) P -22q 1 ai = (P**3 .22.*g**2}1 (am**4 + 2.*anJ+ (Vam**(3.15.)) (i = -----+--- . '" 1 it 4 ?AI n",,31S > C{m + -,.n '("" b.) 2 ·b-....; b +4ac Xl = ( ·b - sqrt(b**2 + 4.*a*c) } I (2. ·a) Xl = 2a 2 c.) dB = 10 log«PIO.0002) ) DB = 10.· LOGI0«P/0.0002}·*2} ,ftA"1 -==- ,fl...f.M" PI !Jf(f!) I d.) RATEP = (AllAN) * (SIN(ALAM)**2 2 sin (~) e.) 6t.hpt = cos( I bO....
View Full Document

This note was uploaded on 03/24/2010 for the course CE 311k taught by Professor Liljestrand during the Spring '10 term at University of Texas-Tyler.

Page1 / 12

Example Mid-terms - CE311K Exam No. lA . Name: 4 Mareh 1004...

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

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