Fortran Interview Questions and Answers
What is the method of Dead store elimination?
- Dead store elimination is a method that allows the compiler to detect the variables that are not being used and it ignores the operations that are involved in computing their values.
- The operations have to be performed and can’t be ignored if there are non-intrinsic function calls.
- These functions have some side effects as they need to be called to calculate the operations.
- Programs used in this perform the performance test and it performs the computations that can be used to optimize the code.
- The programs that don’t have real computations need to be avoided as the result can be written to a file that is enough to trick the compiler in checking.
Explain what is FORTRAN? What is the structure of the main program?
Fortran is referred as a third-generation programming language, built for numeric computation and scientific computing.
The main structure of the program
- Program name
- Stop end
What is the use of Array storage order in FORTRAN?
- FORTRAN uses the column wise storage that allows the transposing of the matrix before putting it in the FORTRAN routines.
- The output of the FORTRAN routine is again transposed to show the correct result, if the condition is ignored then it might result in generation of the wrong result.
- Transposition of the matrix or the array can be avoided as it takes more space and other sources can be adapted or using the information like: A(j+1,i+1).
- Transposition wrapper needs to be written in the cases where there no modification is allowed of the existing FORTRAN code.
- This brings more clarity in the sense that array code is stored in an ordered manner and provides more space for other data to be inserted.
Explain what is the use of appending underscore suffix?
- The compiler of the Fortran keeps on appending a trailer underscore with the routine names
- Underscore suffix prevents the two names that are associated with the user-written routines from clashing
- It also prevents the routines associated with the system libraries to interact with each other
What are the optimization techniques used for code optimization?
The optimization techniques used are as follows:
- The techniques that are used to allow the performance of the operations to be done at compile time.
- Performing at compile time allows the computations and type conversions to be performed at a faster pace and if any error occurs then it can be corrected.
- Tracing of the TRUE value of the constants and other variables at the compile time by, using the method of value propagation.
- Use of inline functions are used to make the code better and faster. It allows the saving of the overhead and enables the optimizations.
- Using the loops less will also save the computing time and it allows faster execution of the program.