Fortran Programming Interview Preparation Guide
Download PDF
Add New Question

Fortran Interview Questions and Answers will guide us now that Fortran previously FORTRAN is a general-purpose, procedural, imperative programming language that is especially suited to numeric computation and scientific computing. Originally developed by IBM in the 1950s for scientific and engineering applications, Fortran came to dominate this area of programming early on and has been in continual use for over half a century in computationally intensive areas. So start learning Fortran now

13 Fortran Questions and Answers:

1 :: Can you give us a complete list of the Fortran commands and what they do?

No, but there are too many pages involved, and copyright problems with the standard Fortran manuals sold by computer software vendors. You're stuck with the text and Web pages, buying something else from a bookstore, or buying a Fortran package for your PC.
Post Your Answer

2 :: Do we need to prompt the user for input on our programs?

Yes Always! In this section, any programmed "read" from the terminal must be preceded by writing some intelligible message asking for input.
Post Your Answer

3 :: How should one spell FORTRAN/Fortran?

FORTRAN is generally the preferred spelling for discussions of versions of the language prior to the current one ("90"). Fortran is the spelling chosen by X3J3 and WG5. In this document a feeble effort has been made to capitalize accordingly (e.g. vast existing software ... FORTRAN vs. generic Fortran to mean all versions of the standard, and specifically the modern dialect, ISO 1539:1991).
Post Your Answer

4 :: How does Fortran 90 relate to FORTRAN 77?

With a few minor exceptions, Fortran 90 is a superset of X3.9-1978 FORTRAN.

But this does not mean that all "77" codes will port sans changes. Many (if not most) programmers employed constructs beyond the '77 standard, or rely on unspecified behavior (say, assuming that an OPEN of an existing file will position the file pointer to just past the last record already written) which has changed (that is to say, has become specified).
Post Your Answer

5 :: Why do you put so many lines of empty space in your programs?

I hope the lines aren't totally empty. They should contain a "c" in column one. These "blank" lines are just to make the comments stand out from Fortran code lines or to highlight key blocks of a program.
Post Your Answer

6 :: What directory is used by the compiler for compiling a Fortran Program? Where does f77 live?

For the work in this section, you should assume that everything happens in whatever directory you are in when you type the "f77". Type "pwd" if you don't know the answer to this question. The executable file called "f77" resides both in /bin and /usr/bin on these machines. This is very unsual. To locate an executable file use the "whereis" command (e.g. "whereis f77"). Unfortunately the manual pages on f77 aren't connected properly and are listed under IBM's other name for their compiler, "xlf". Try "man xlf" for more information on the compiler, but don't expect too much. IBM likes to force people to buy manuals and special CD-ROM packages.
Post Your Answer

7 :: How do you use a logical variable? What is stored there?

Most frequently, logical variables are used in association with IF statements. When you want to set a logical variable LVAR to true you use "LVAR=.TRUE.". For false use "LVAR=.FALSE." In practice the computer usually stores an integer 0 in memory for false and integer 1 for true. The normal logical variable occupies 1 byte of space.
Post Your Answer

8 :: Where can I get a Fortran Compiler for IBM PC?

We can pick up one on the internet from the GNU project, but get a better package from MOC for about $80.00.
Post Your Answer

9 :: How do we know where various steps go in a Fortran program?

Some commands have special locations, but most are located by the needs of the specific program. The PROGRAM card is always first. Statements giving variable types (INTEGER, REAL, LOGICAL, CHARACTER, ...) should precede "executable" statements. The END card must always be at the end of the program unit.
Post Your Answer

10 :: Why does not Fortran have intrinsic functions for something as simple as factorial?

Two reasons. Factorial isn't all that common in heavy duty scientific and engineering applications. When it does occur, it almost always in a context where it is more computationally efficient to generate it as you go. You need 2! first then 3!, then 4!, etc. You are basically stuck doing a factorial within the context of a do loop unless you get really good and learn to write "recursive functions", but then you are just fooling yourself and writing another form of do loop. When you are taking the factorial of a large number and don't need an exact answer you can resort to Stirling's Approximation. A Fortran statement that will load the value of this approximation into the variable nfact is.
Post Your Answer
Add New Question