midterm1_W2009_key

Midterm1_W2009_key - 3 4 1 8 38 9 5 6 5 6 10 Hello World Hello World 7 Hello World Hello World 7 PROBLEM 3 1 PROGRAM prob1 INTEGER j REAL pi

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

View Full Document Right Arrow Icon
Midterm 1 W09 Key: SHORT ANSWERS - Decimal number 3499 = Hexadecimal number DAB - Binary number 10001 = Octal number 21 - Java and C - g77 and gfortran - UNIX and Windows PROBLEM 1 1.) Print statement is missing *, 2.) Semi-colon should be replaced with comma 3.) OK 4.) Missing END DO 5.) Argument of SQRT function must be REAL (J is an integer) 6.) OK 7.) OK 8.) DATA command must follow variable type definition commands (REAL and INTEGER) PARAMETER statement should use parenthesis, not slashes, to enclose nmax=20 9.) Data type disagreement in J = 1 (J is a logical variable) 10.)Single-line IF statement does not need THEN PROBLEM 2 1.) 0.5 0 2.) 0.5 0 3.) 1. 2 1.5 3. 4.) 3. 5.5 5.5 5.5 5.) 0 1 180 100 6.) T T T F 7.)
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
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 3. 4. 1. 8.) 38. 9.) 5 6 5 6 10.) Hello World Hello World 7 Hello World Hello World 7 PROBLEM 3 1.) PROGRAM prob1 INTEGER j REAL pi PARAMETER (pi = 3.1415) DO 10 j = 1, 99, 2 PRINT*, j, sin(FLOAT(j)*pi/100.) 10 CONTINUE END 2.) PROGRAM prob2 REAL HRS, RATE, SAL PRINT*, 'Enter number of hours worked and rate' READ*, HRS, RATE IF (HRS .LE. 40.0) THEN SAL = HRS*RATE ELSE IF (HRS .LE. 50) THEN SAL = 40.0*RATE+(HRS-40.0)*(RATE*1.5) ELSE SAL = 40.0*RATE+10.0*(RATE*1.5)+(HRS-50.0)*(RATE*2.0) ENDIF PRINT*, 'Your total salary = ', SAL END 3.) PROGRAM prob3 INTEGER j LOGICAL test DO 10 j = 1, 50 test = (2*j+1)**2+(2*j*(j+1))**2 .EQ. (2*j*(j+1)+1)**2 PRINT*, j, test 10 CONTINUE END...
View Full Document

This note was uploaded on 03/10/2009 for the course MAE 10 taught by Professor Dabdub during the Spring '09 term at UC Irvine.

Page1 / 2

Midterm1_W2009_key - 3 4 1 8 38 9 5 6 5 6 10 Hello World Hello World 7 Hello World Hello World 7 PROBLEM 3 1 PROGRAM prob1 INTEGER j REAL pi

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

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