FIll in the blanks: sleet% cat e6.f90 ! The following program generates a table
ID: 644598 • Letter: F
Question
FIll in the blanks:
sleet% cat e6.f90
! The following program generates a table of
! values for points (x,y) on a line through (x1,y1) and
! (x2,y2).
! The function interp returns the interpolated value y
! for the input value of x and the given points on the line
PROGRAM P6
IMPLICIT NONE
INTEGER :: i=0
REAL :: x1=1.0,y1=1.0,x2=4.0,y2=9.0
REAL :: del=.5, x0=1.0,x,y
x=x0
print "(1X,_____1_____)","x","y"
do i=1,10
y=_____2_____
print "(1X,2f10.2)", x,y
_____3_____
end do
_____4_____
_____5_____ function interp(x,x1,y1,x2,y2)
real, _____6_____:: x, x1,y1,x2,y2
real m
m=(y2-y1)/(x2-x1)
interp=m*_____7_____ +y1
_____8_____ function interp
END PROGRAM P6
sleet% f90 e6.f90
sleet% a.out
x y
1.00 1.00
1.50 2.33
2.00 3.67
2.50 5.00
3.00 6.33
3.50 7.67
4.00 9.00
4.50 10.33
5.00 11.67
5.50 13.00
sleet%
ANSWER SECTION:
SELECTIONS FOR BLANK NUMBER 1
(a) 10A,10A
(b) A10
(c) 2A11
(d) 2A10
(e) 2I10
SELECTIONS FOR BLANK NUMBER 2
(a) y(x,x1,y1,x2,y2)
(b) function(x,x1,y1,x2,y2)
(c) interp(x)
(d) interp(x,y,x1,y1,x2,y2)
(e) interp(x,x1,y1,x2,y2)
SELECTIONS FOR BLANK NUMBER 3
(a) y=y+del
(b) x+=del
(c) i=i+1
(d) x=x+1.0
(e) x=x+del
SELECTIONS FOR BLANK NUMBER 4
(a) SUBPROGRAMS
(b) FUNCTIONS
(c) USES
(d) HOLDS
(e) CONTAINS
SELECTIONS FOR BLANK NUMBER 5
(a) real
(b) return real
(c) real y
(d) real returns y
(e) INTENT(real)
SELECTIONS FOR BLANK NUMBER 6
(a) intent:IN
(b) IN
(c) intent(IN)
(d) PARAMETER
(e) int(IN)
SELECTIONS FOR BLANK NUMBER 7
(a) x
(b) x1
(c) (x-y1)
(d) (y-x1)
(e) (x-x1)
SELECTIONS FOR BLANK NUMBER 8
(a) stop
(b) end do
(c) return
(d) contains
(e) end
Explanation / Answer
1) b
2) e
3) c
4) b
5) a
6) d
7) c
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.