CS 430 – Quiz #1
Name _________________________ Section 2 : __3:30___
Given the following FORTRAN code
REAL1 = 97.145
NUMBER = 67
REAL2 = 5.67432
Write the FORTRAN statement(s) that would output the numbers all on one line with 1 space between them.
WRITE ( 6, 10) REAL1,
NUMBER, REAL2 |
10
FORMAT ( 1X, F6.3,1X, I2, 1X,F7.5) 10
FORMAT (1X, F6.3, I3,
F8.5) 10
FORMAT (1X, F6.3, ‘ ‘, I2, ‘ ‘, F7.5) |
Write the formula for computing the address of an element in a one-dimensional Pascal array
baseAddress + ( index – lowerBound) * size |
Use the formula you wrote above to compute the address of B[15] where
1010 + (15 – (-5)) * 2 = 1010 + (15+5)
* 2 = 1010 + 20*2 = 1010 + 40 = 1050 |
What will be output when the following Snobol code is run?
Colors = “orange” | “black” | “green”
“turn at the orange house” Colors . Result
Output = result
Instructions = “turn at the green house”
Instructions Colors = “lovely”
Output = Instructions
orange |
turn at the lovely house |