Fortran Interview Questions and Answers

Last updated on Feb 06, 2023
  • Share
Fortran Interview Questions

Most Frequently Asked Fortran Interview Questions

Here in this article, we will be listing frequently asked Fortran Interview Questions and Answers with the belief that they will be helpful for you to gain higher marks. Also, to let you know that this article has been written under the guidance of industry professionals and covered all the current competencies.

Q11. What do you mean by a subroutine in Fortran?
Answer

When a programmer writes the subroutine statement in a program, then subroutine can modify its arguments, but it does not return a value.

Example

subroutine name(arg1, arg2, ....)
    [declarations, including those for the arguments]
    [executable statements]
end subroutine [name]

A subroutine is invokes using the call statement.

 

Q12. What do you mean by the module in Fortran?
Answer

While writing a big program or if the functions and subroutines need to be used in more than one program then the programmer use module. A module is like a complete package where a programmer can keep the functions, subroutines. A module basically splits the program into multiple files.

A module contains two parts-
  • a specification part for the statements declaration
  • a includes a section for the subroutine and the function definitions

This is the favorite interviewer question in Fortran interview questions.

Example

module name
   [statement declarations]
   [contains [subroutine and function definitions] ]
end module [name]

Q13. What do you mean by implicit none in Fortran?
Answer

In Fortran, there is a feature of Implicit typing which means there is no need of declaring the variables before the use of the variables so the first letter of the variable name will determine the type of the variable. i, j, k, l, m, n are taken as integer numbers and other as real numbers.

The excellent programming practice is that the variables should be declared at the starting of the program so implicit none statement disables the implicit typing so that variables can be announced at the starting of the program

Q14. What is cmplx() in Fortran?
Answer

A number are those number s which has two parts real number and an imaginary number. Cmplx() function in Fortran creates a complex number. Cmplx() function produces a result where the real and the imaginary parts are the single precision regardless of the type of the input arguments.

Q15. Explain the reserved keywords available in Fortran?
Answer

Reserved words are those words which cannot be identifiers. Fortran has no reserved words, but Fortran has identifiers like END, PROGRAM, DO.

Q16. How to declare variables in Fortran?
Answer

The variables in Fortran is declared by using the type statement at the beginning of the program. The syntax for declaring a variable is:-

type-specifier :: list

Here type-specifier can be: -INTEGER, REAL, COMPLEX, LOGICAL AND CHARACTER and the list is the name of the variables that can be separated with commas

For example:-
  • INTEGER:: Total, Mean
  • REAL:: Average
  • CHARACTER(10) :: Surname, Name
    ((10 is the length value that must be there with the CHARACTER specifier. CHARACTER specifier can hold the string not more than 10 characters))
Reviewed and verified by Best Interview Question
Best Interview Question

With our 10+ experience in PHP, MySQL, React, Python & more our technical consulting firm has received the privilege of working with top projects, 100 and still counting. Our team of 25+ is skilled in...