Answer all four questions, and hand the sheets in at the end of the test. Your name in CAPITALS_________________________________________ 1. Circle any of the following which are NOT valid variable names in Fortran 77 (12 marks) IHATECOMPUTINGTESTS? 4DOWN HORB.F FiNaL 77SUN 2. Are the following Fortran 77 statements valid? (circle YES or NO. If no, why? (18 marks) (a) DIMENSION IMK (-100),SIN(-10) YES NO (b) IF ((A EQ B) .AND. (C GE D)) THEN YES NO (c) C = A//(1.76) YES NO (d) C = 1.76*E(J) YES NO (e) DIMENSION A(N),B(N),IMK(N) YES NO (d) COMMON /A,B,IMK(N), N YES NO 3. Write down below the value of i and j at the two points indicated with Comment lines (C) (20 marks) program test93 data a,b /-5.0, 4.0/ i = (a**2)/(sqrt(b)) if ((i.lt. 0) .or. (i.gt. 10)) then j = sqrt(b)*a elseif (i.eq.3 .or. i.eq.8) then j = a*b else j = -1*j endif C Value of i and j at this point : i = bloggs (j) write (*,*) i,j,a,b C Value of i and j actually printed above : stop end function bloggs (j) bloggs = j*3 return end 3. You will get full marks for finding ten errors in the following program. For each that you spot, mark it with a C if you think it will result in a compilation error or L if you think it is an error in logic producing erroneous execution or output or misleading information on the screen. Cosmetic imperfections which result in neither of the above must NOT be flagged (50 marks). C234567890123456789012345678901234567890123456789012345678901234567890<> program howmany C Program to match up a single character entered from a keyboard C with a pre-defined string and print any matches to a file C and to the screen. C character/5 names(3) character temp**1, string*80 data names ('Bob ', 'JohnS', 'Linda', 'Salty'/ open (unit=7, file='namelost',status='unknown') 5 read (*,10,END=30,err=20) temp 10 format (a) if (temp(10:10) .eq. 'B') then C The following will catch the first character ty$ed from keyboard string = temp(1:1) // ' Matches the name ' / names (1) elseif (temp(1:1) .gt. 'J ') then string = temp(1:1) // ' Matches the name ' // names(2) else string = temp(1:1) // ' Matches the name ' // names(3) print *, string write (7,10) string goto 5 20 print *, ' Ctrl+W entered from keyboard.Data on file namelist' call exit 30 print *, ' Error in data. Try again' goto 5 end