Questions and CORRECT Answers
mkdir D - CORRECT ANSWER - You want to create a directory/folder named D in Linux,
what do you do?
vi script.f90 - CORRECT ANSWER - You want to access script.f90 in the vi editor, what
do you do? (Note: this command would also create script.f90 if it did not exist prior)
:wq - CORRECT ANSWER - To exit from vi while at the same time saving changes, what
do you do?
program sniffy - CORRECT ANSWER - What is the first line in a FORTRAN "main"
script called "sniffy"?
end program sniffy - CORRECT ANSWER - What is the last line in a "FORTRAN
program" named "sniffy"?
integer :: var = 10 - CORRECT ANSWER - Define an integer variable with the value 10!
real - CORRECT ANSWER - What is the counterpart of "float" in fortran?
implicit none - CORRECT ANSWER - What necessary statement prevents potential
confusion in variable types, and makes detection of typographic errors easier?
contains - CORRECT ANSWER - What to add to the main FORTRAN script before
adding functions?
real function add(i,j) - CORRECT ANSWER - You want to create a function that adds
variables i and j, how do you write the first line?
, implicit none - CORRECT ANSWER - First line of a function?
yes - CORRECT ANSWER - Do you have to define function variables within the
function?
print*, 'Hello world!' - CORRECT ANSWER - Print "hello world" in FORTRAN!
gfortran hello.f90 -o hello.x - CORRECT ANSWER - You want to link hello.f90
FORTRAN script you just created to an executable hello.x to run the code, what do you do?
real - CORRECT ANSWER - x = 1.32312 is a...
logical - CORRECT ANSWER - f = .false. is a...
integer - CORRECT ANSWER - i = 1 is a...
do i =1,10 - CORRECT ANSWER - Make a loop in FORTRAN over the range 1-10 using
the predefined integer variable i
print*, 'my name is' ,name - CORRECT ANSWER - Print variable "name" with preceding
string: "my name is"
enddo - CORRECT ANSWER - At the end of a do loop you must always write...
character(len=100) :: b - CORRECT ANSWER - Define a character variable with length
100: so basically a string