midterm1_W2009_key

# midterm1_W2009_key - Midterm 1 W09 Key SHORT ANSWERS...

• Notes
• 2

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

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.)

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

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

• Spring '09
• Dabdub

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern