# FOR2 - CGS-2421 FORTRAN EXAM II TEST FORM CODE"A SPECIAL...

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

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

View Full Document
1. Below is a FORTRAN program. CHARACTER (15) :: STR WRITE (UNIT=STR,FMT='(A2,F7.2,F4.1)') 'ABCD', 245.228, 12. WRITE(*,*) STR END PROGRAM Which of the following is the resulting output? A. AB 245.2312.0 B. AB245.22812.0 C. ABC 245.23 12 D. ABCD 245.2212.0 E. ABCD245.228 12 2. What is the value of CH2 after evaluating the following expression? Assume CH1 = 'F' AND S = 'gators' . CH2 = CHAR(ICHAR(CH1) + ICHAR('1') - ICHAR(S(2:2)) + 13) A. '3' B. 'w' C. '#' D. 'G' E. ' ' 3. Consider the following FORTRAN program. INTEGER :: I, Y I = 1 CALL X(I) WRITE(*,*) Y(I) END PROGRAM SUBROUTINE X(J) INTEGER :: J, Y J = Y(2) + Y(J+1) CALL Z(J) END SUBROUTINE INTEGER FUNCTION Y(K) INTEGER :: K Y = K - 2 END FUNCTION SUBROUTINE Z(I) INTEGER :: I I = I + MOD(I,3) END SUBROUTINE Which of the following is the correct displayed output? A. -3 B. -2 C. 0 D. 1 E. 2
4. Consider the following program. INTEGER :: I=1, J=2, K=3, B(2) = (/1,0/) INTEGER :: A(2,4) = RESHAPE((/8,7,6,5,4,1,2,2/),(/2,4/)) WRITE(*,'(1X, 6I3)') A(I+1,J), A(B(K-2),J-1), B(B(K-1)+2)-2 END PROGRAM Which of the following is the correct displayed output? A. 6 4 0 B. 6 8 -1 C. 5 6 -2 D. 5 8 -2 E. 5 9 -1 5. Consider the following program. CHARACTER :: A*7, B(6)*1 INTEGER :: I A = 'Fortran' DO I = 1, 6 B(I) = CHAR(5 - I + ICHAR(A(I+1:I+1))) ENDDO WRITE(*,*) (B(I), I = 2, 4) END PROGRAM Which of the following is the correct displayed output? A. uvs B. ort C. Gat D. wxy E. z!@ 6. What is the output of the following FORTRAN program? REAL X, Y

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.

## This note was uploaded on 11/30/2009 for the course CGS 2421 taught by Professor Onal during the Fall '09 term at University of Florida.

### Page1 / 16

FOR2 - CGS-2421 FORTRAN EXAM II TEST FORM CODE"A SPECIAL...

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

View Full Document
Ask a homework question - tutors are online