YouTube Icon

Interview Questions.

Top 100+ Fortran Interview Questions And Answers - May 30, 2020

fluid

Top 100+ Fortran Interview Questions And Answers

Question 1. How Should One Spell Fortran/fortran?

Answer :

FORTRAN is commonly the desired spelling for discussions of versions of the language prior to the cutting-edge one (‘ninety”). Fortran is the spelling chosen by means of X3J3 and WG5. In this record a feeble effort has been made to capitalize for that reason (e.G. Good sized existing software program ... FORTRAN vs. Typical Fortran to mean all variations of the usual, and specially the contemporary dialect, ISO 1539:1991).

Question 2. How Does Fortran 90 Relate To Fortran seventy seven?

Answer :

With a few minor exceptions, Fortran 90 is a superset of X3.9-1978 FORTRAN. But this does not imply that all ‘77” codes will port sans modifications. Many (if now not most) programmers employed constructs past the ‘seventy seven fashionable, or depend on unspecified behavior (say, assuming that an OPEN of an current file will role the document pointer to simply beyond the remaining report already written) which has changed (that is to say, has become exact).

Pascal programming Interview Questions
Question 3. Do Spaces Mater In Fortran Equations?

Answer :

No. Spaces are generally delivered for readability Some compilers get disillusioned if you write things like” INTEGERI,J” rather than INTEGER I,J”. Simple neatness will keep you out of those problems.

The following are all equivalent:
x=x*y**2*sin(x)
x=x * y2 * sin(x)
x= x * y**2 * sin ( x)

Question 4. What Is The Advantage Of An Array Over A Spreadsheet Format?

Answer :

Both can keep comparable types of records and a neatly classified and prepared manner. The advantage lies in wherein they may be used. You have extra manage over how Fortran arrays are used than how the contents of a spreadsheet are used. In addition for any given operation on an array of numbers, as soon as the Fortran is written, it's going to do the task tons faster than a spreadsheet. On the opposite hand, whilst operations aren't complicated and pc execution time is not a trouble the usage of the spreadsheet is probably your satisfactory wager.

Pascal programming Tutorial
Question five. How Do We Know Where Various Steps Go In A Fortran Program?

Answer :

Some commands have unique places, but most are positioned by way of the needs of the precise application. The PROGRAM card is usually first Statements giving variable kinds (INTEGER, REAL, LOGICAL, CHARACTER) have to precede “executable” statements. The END card have to constantly be at the cease of the program unit.

Adv Java Interview Questions
Question 6. Where Can I Get A Fortran Compiler For Ibm Pc?

Answer :

We can pick out up one at the internet from the GNU challenge, but get a better bundle from MOC for approximately $eighty.00.

Question 7. Why Do You Put So Many Lines Of Empty Space In Your Programs?

Answer :

I hope the traces aren’t absolutely empty. They have to incorporate a “c” in column one. These “clean” traces are just to make the comments stand proud of Fortran code traces or to highlight key blocks of a application.

Adv Java Tutorial Software Engineering Interview Questions
Question eight. Why Doesn't Fortran Have Intrinsic Functions For Something As Simple As Factorial?

Answer :

Two reasons. Factorial isn't all that not unusual in heavy duty clinical and engineering applications. When it does arise, it almost continually in a context in which it is greater computationally efficient to generate it as you cross. You need 2! First then three!, then 4!, etc. You are essentially stuck doing a factorial within the context of a do loop until you get genuinely correct and discover ways to write "recursive capabilities", however then you are simply fooling yourself and writing every other form of do loop. When you take the factorial of a large quantity and don't need an actual solution you could hotel to Stirling's Approximation. A Fortran statement so as to load the price of this approximation into the variable nfact is.

Nfact = sqrt(2*3.1415963*n)*(n/2.71828)**n
Question 9. How Do You Use A Logical Variable? What Is Stored There?

Answer :

Most often, logical variables are used in affiliation with IF statements. When you need to set a logical variable LVAR to real you operate "LVAR=.TRUE.". For false use "LVAR=.FALSE." In exercise the laptop generally shops an integer zero in reminiscence for false and integer 1 for true. The ordinary logical variable occupies 1 byte of area.

MATLAB Interview Questions
Question 10. What Is The Difference Between If Then And Do While Statements?

Answer :

IF THEN mixed with GO TO statements will permit you to do something you need. The DO WHILE and different DO constructs assist you to loop via certain portions of code usually without ever writing GO TO statements. This makes coding slightly less difficult, in reality clearer.

Software Engineering Tutorial
Question eleven. What Is The Difference Between A Function Subprogram And A Subroutine?

Answer :

The largest difference is that a subroutine in no way returns a fee this is related to its name. This manner that you never need to declare a subroutine name in a kind statement (REAL, INTEGER ...). All records getting back from a subroutine passes thru the argument listing, or some thing known as a COMMON block (later). However, there may be nothing in these communications channels that can't be utilized by a Function Subprogram. A secondary difference is that a Subroutine want not have an argument listing.

Advanced C++ Interview Questions
Question 12. What Is The Difference Between Do, Do While, And If ( ) Goto Loops?

Answer :

In terms of what the computer certainly does, there is typically no distinction. You can structure all three so they do the identical component. When well supposed, the DO structures have a tendency to be easier to observe. The DO WHILE structure can produce barely extra compact coding, combining a immediately DO with the choice for a few greater comparison common sense. In a vector and/or parallel laptop, DO's ship robust suggestions to the compiler that it need to be looking for approaches to feed a pipeline or unfold calculations over multiple processors.

Pascal programming Interview Questions
Question 13. What Does "commonplace/manage/ A, B, C" Do To The Values Of A, B, C?

Answer :

It would not do something to the values. It just establishes a place in memory for the values to be stored and retrieved. Every subroutine and feature on your application that carries the road "COMMON/CONTROL/ A, B, C" will agree that operations using variables A, B, or C gets numbers from or put numbers inside the identical suitable vicinity in memory. That is, they agree that a connection with "A" manner the equal in all workouts with commonplace CONTROL, and so on.. To supply A, B, or C a value, you have two alternatives. You can assign values at compilation time with a BLOCK DATA routine:

BLOCK DATA ABCVAL
COMMON/CONTROL/ A, B, C
DATA A,B,C / 1.Zero, 2.0, 3.Zero/
END
You also can assign and use values with executable statements. Say subroutines SUB1 and SUB2 comprise this not unusual block. If SUB1 includes the lines "A=1.0", and "B=2.0", and SUB2 has the line "C=A+B", then the value of C after this line in SUB2 is completed is 3.0.

MATLAB Tutorial
Question 14. What Directory Is Used By The Compiler For Compiling A Fortran Program? Where Does F77 Live?

Answer :

For the work in this elegance, you need to assume that the whole lot takes place in something directory you are in while you type the "f77". Type "pwd" in case you do not know the answer to this question. The executable record known as "f77" is living both in /bin and /usr/bin on those machines. This could be very unusual. To find an executable report use the "whereis" command (e.G. "whereis f77"). Unfortunately the guide pages on f77 aren't connected well and are listed underneath IBM's other name for their compiler, "xlf". 

Question 15. Is There Any Way To Use Variables In A Format Statement?

Answer :

Yes, however you need to use one format declaration to construct a 2nd using a write to a character string. For example if you need to consist of the fee of "n" because the number of actual numbers in line with line you will do the subsequent:

PARAMETER (N=4)
CHARACTER FORM1*16
REAL A(N,N)
DO 10 I=1,N
DO 10 J=1,N
A(I,J)=J*100+I
10 CONTINUE
WRITE(FORM1,2000)N
2000 FORMAT('(1X,',I3,'F6.1)')
WRITE(6,FORM1) A
STOP
END
Basic C Interview Questions
Question sixteen. Is It Possible To Lay Out A Two Dimensional Array With The Double Do Loops?

Answer :

DO 10 J=1,4
DO 20 K=1,4
A(J,K)=SUM(T(1:N)**(J+K-2))
20 CONTINUE
10 CONTINUE
yes, when you have a Fortran ninety compiler.
Question 17. What Does // Do?

Answer :

It sticks 2 man or woman strings collectively into a unmarried string. If char1='file1.In' and char2='file2.Out' then when char3=char1(1:5)//char2(6:9) the contents of char3 are 'file1.Out'.

Question 18. What Does The Function Real(x) Do?

Answer :

Not plenty if x is already a actual variable. If x is and integer, the output of REAL is a real (floating point wide variety with the identical cost. REAL(three) is three.00000E+00. If x is a complex wide variety REAL returns the real component (in place of the imaginary element) of x.

Adv Java Interview Questions
Question 19. When Is The Common Command Not Used Correctly In A Fortran Statement?

Answer :

You're inquiring for quite a piece here. There are masses of methods to introduce mistakes. The maximum apparent is to strive placing a common inside the midst of executable statements. It belongs up with DIMENSIONs, PARAMETER's, SAVE's, and the rest of the non-executables. A more subtle problem is the usage of more than one COMMON statements for clean commonplace or the identical named common. Fortran will accept the subsequent application:

software testcom
not unusual a,b
commonplace c,d
a=1.Zero
b=2.Zero
c=3.0
d=four.Zero
call sub1
forestall
give up
subroutine sub1
not unusual c,d
print *, c, d
return
quit 
However, the values published out are 1.Zero and a couple of.0. The 2d common assertion within the essential application simply tacks the variables "c" and "d" onto clean common after "b". The two commons together are equivalent to "not unusual a,b,c,d". In the subroutine you're announcing that "c" is the primary detail in blank common, so Fortran buddies "c" in "sub1" with the identical cope with in reminiscence as assigned to "a" inside the essential program. Also bear in mind that blending reals and integers (commonplace/blk1/a,b,i,c) whilst the reals are double precision may additionally cause errors on some machines, and is not a good idea on any 32 bit machine.

Question 20. What's The Use Of A Blank Common As Opposed To A Common With A Name?

Answer :

The essential use is in slicing the size of the executable file produced by "f77" (typically a.Out). It may not seem like a big deal to you presently, but in applications containing many arrays with heaps to millions of elements every, this may make a massive distinction in the quantity of disk area you absorb. A secondary use is that, when this system starts, the gap eventually allocated to blank not unusual in reminiscence is at the very cease of this system. If you are tricky sufficient, you may take benefit of this to dynamically increase the dimensions of a single array in blank not unusual as your space necessities grow in the course of execution.

Question 21. When Accessing A Data File In A Program Can I Change Directories?

Answer :

Yes if you have a subdirectory referred to as "check" beneath the vicinity that your application, you can open the record "my.Facts" in "take a look at" for studying on unit 11 with the command: OPEN(11,report='check/my.Facts')

Question 22. Can More Than One Variable Be Stored In A Data Statement?

Answer :

Yes. For instance you could set preliminary values for A, B, and C with both of the following statements.

DATA A/1.0/,B/2.Zero/,C/3.Zero/
DATA A,B,C/1.Zero,2.Zero,3.Zero/
Question 23. Which Fortran Compiler Should I Use?

Answer :

GFortran, G95, Open Watcom, and Silverfrost are loose Fortran compilers, at the same time as Absoft, IBM, Intel, Lahey,NAG, Pathscale, PGI, and Oracle produce business Fortran compilers.

Question 24. How Should One Capitalize "fortran" ?

Answer :

Standard capitalization is now the favored manner to write Fortran for several reasons, most considerably due to the fact this is how latest variations of the same old write it. Another purpose is because of an effort to standardize the capitalization of the names of programming languages.

Software Engineering Interview Questions
Question 25. How Do I Produce A Library?

Answer :

To build a static library libfoo.A containing all modules and strategies inside the .F90 documents within the modern listing on Linux:

% gfortran -c *.F90
% ar cr libfoo.A *.O

The first command builds the object files and the second documents the item documents right into a static archive.
To construct a shared library libfoo.So:

% gfortran -shared *.F90 -o libfoo.So -fPIC
In each cases, other compiler flags which includes -O2 can be used.

 

Question 26. How Do I Read Until The End Of A File (eof)?

Answer :

A common Fortran ninety five idiom for analyzing lines till the quit of document is

integer :: stat
individual(len=a hundred) :: buf
open(15, document='foo.Txt')
do
study(fh, iostat=stat) buf
if (stat /= 0) go out
! System buf
cease do
close(15)
This example catches all situations, not just the give up of record. To mainly trap the EOF in Fortran 2003 you may use the iso_fortran_env module and replace the if situation above with

if (stat == iostat_end) go out
Question 27. Can I Allocate A Variable Length Character String?

Answer :

Yes, in Fortran 2003. Declare the variable and allocate with a given length as follows:

person(LEN=:), allocatable :: str
integer :: n
n = 27
allocate(man or woman(LEN=n) :: str)
A Fortran ninety five solution is the iso_varying_string module, or the variable length string module in FLIBS.

MATLAB Interview Questions
Question 28. Which File Extension Should I Use For My Fortran Code?

Answer :

Although there aren't any respectable report extensions for Fortran code, there are  widely hooked up conventions. Some use .F for fixed-shape source and .F90 for Free shape layout. The latter is a reference to the Fortran 90standard, when Free shape layout become introduced. The code contained within the file can be Fortran ninety five, Fortran 2003, and so forth. Others prefer to use file extensions that indicate the standard under which the code became written. For instance, .F03 for Fortran 2003 code and .F08 for Fortran 2008 code. Unfortunately, this outcomes in a proliferation of record extensions and a few compilers may not assist the more recent extensions yet.

Question 29. Will Vf V5 Work With Microsoft Visual C++ 6.Zero/visual Studio ninety eight? Will Vf V6.X Work With Visual C++ five.0/visual Studio 97?

Answer :

VF V6.X does proportion the development surroundings of MS Visual C/C++ 6.0; VF V5 does no longer. Conversely, VF V5 shares the improvement surroundings of MS Visual C/C++ 5.Zero/Visual Studio ninety seven, and VF V6.X does no longer. The two generations can coexist on a unmarried gadget and objects/libraries created by the older compilers may be used with the more moderen improvement environment.

Question 30. Does The Compiler Have The Capability Of Optimizing For The Athlon/duron, Pentium Pro, Pentium Ii Or Pentium Iii Processors?

Answer :

VF V6.Five includes optimizations for the AMD Athlon/Duron and Intel Pentium III processors. V6.Zero and V6.1 may want to optimize for the Pentium Pro/Pentium II/Celeron as well.

Question 31. Does The Compiler Support The Intel Pentium four Processor?

Answer :

VF is completely supported at the Pentium 4 processor. For exceptional overall performance on this processor with VF 6.Five, we advocate choosing the optimization settings for "Pentium II/Pro". Version 6.6 adds precise Pentium 4 optimizations.

Question 32. Does Vf Support Windows 2000?

Answer :

Yes, as of version 6.1A, which corrects a minor trouble relating to QuickWin font selection. Previous versions should set up good enough, but are not formally supported.

Question 33. Does Vf Support Windows Millennium Edition (windows Me)?

Answer :

CVF 6.Five or later helps Windows ME.

Advanced C++ Interview Questions
Question 34. Does Vf Support Windows Nt/2000 Terminal Server?

Answer :

We have carried out constrained trying out with Terminal Server and have now not diagnosed any problems the use of Visual Fortran in this surroundings. Please be aware that a Visual Fortran license is needed for every consumer.

Question 35. Does Vf Support Windows Xp?

Answer :

CVF 6.6 helps Windows XP.

Question 36. Does Vf Have The Capability Of Generating Applications Which Can Make Use Of Multiprocessor Systems Running Under Windows Nt/2000?

Answer :

Visual Fortran completely helps multithreaded packages that use the Win32 multithread and synchronization APIs. A multithreaded utility will naturally take gain of a multiprocessor device. However, the compiler and its libraries do not, via themselves, make use of multiple processor.

Basic C Interview Questions
Question 37. Does Vf Support Generation Of Applications Which Can Run Under Dos Or Windows 3.X?

Answer :

No. Like FPS, VF generates Win32 executables simplest.

Question 38. What About Dos Extenders Or Win32s?

Answer :

No attempt was made to limit library calls to the Win32s subset, or Win32 subsets supported by way of DOS extenders, and no trying out with Win32s or DOS extenders has been carried out.

Question 39. Can I Run Vf Executables On Windows Nt three.5x?

Answer :

Yes, as long as they don't use APIs no longer to be had on that version. The improvement tools require Windows NT 4.0/2000 (or Windows 9x).

Question 40. Can I Mix Vf Code With Code From Fps?

Answer :

If the FPS code is computational simplest - this is, it does not make calls to the FPS I/O library - then in wellknown the answer is yes. FPS code which makes calls to the FPS library can't be blended in a static executable or a DLL with VF code, because the Fortran libraries are incompatible. You can build a separate DLL with the FPS code and link that during with VF code, but the  Fortran libraries will not "talk to each other".

Question 41. Can I Mix Vf V6 Code With Msvc V5 Code?

Answer :

Yes. You can't use the MSVC five.X Developer Studio environment to collect VF V6 code (or vice versa), however if the object documents or libraries are built separately, they may be related collectively, so long as the more moderen command-line tools (including linker and librarian) included with VF are used.

Question 42. Can I Use Modules, Libraries Or Dlls Compiled By One Version Of Vf With A Later Version Of Vf?

Answer :

Yes. However, the speak is not proper - "downwards compatibility" isn't always supported.

Question 43. I Am Migrating An Application From Openvms. Does Vf Support Indexed Files And Openvms System Services And Run-time Library Routines?

Answer :

No - those are OpenVMS operating system capabilities no longer provided via Windows ninety five nor Windows NT. There are groups offering "OpenVMS emulation libraries" which provide some of those skills - one such is Sector 7, another is Accelr8.

Question forty four. Does Vf Support Access To Data In Databases Such As Ms Access, Excel, Oracle, Foxpro, Sql Or Other Odbc Databases?

Answer :

This capability is provided via the f90SQL library from Canaima Software. A freeware model of f90SQL is provided at the Companion Products CD as of CVF 6.5.

Question 45. Can I Install Vf So That It Runs From A Server?

Answer :

To perform a server set up of VF, reproduction the contents of the CD-ROM on your server. From every client PC, run the server's replica of the SETUP.EXE software and specify a "run from CD" set up type. Some files will nonetheless be copied to the purchaser PC, however maximum will remain at the server. Please note which you need a separate license for each patron PC which has get entry to to the VF product.

Question forty six. I Get Errors When Installing Via Autoplay Or Running Setup.Exe In The Kit's Root Directory?

Answer :

If this occurs, try walking X86SETUP.EXE.

Question forty seven. When I Run Setup, It Just Exits Immediately Without Installing Anything?

Answer :

Uninstall Microsoft Internet Explorer and run SETUP again.

Question 48. Can I Install Vf Using Netscape Navigator Instead Of Microsoft Internet Explorer?

Answer :

Microsoft Developer Studio makes use of additives of Microsoft Internet Explorer (MSIE) to offer the InfoViewer characteristic. Other browsers cannot be substituted. Of route, you're unfastened to no longer use MSIE at once as a browser.

Question 49. How Do I Change A Project Type For An Existing Project?

Answer :

Each assignment type presets a massive number of default switch and library settings. The simplest manner to exchange a project type is to create a new challenge with the perfect kind and upload the supply documents to it.

Question 50. Can I Build A Vf Dll That Is Linked Against The Vf Static Libraries?

Answer :

We strongly advise that you NOT do this as it may purpose diffused and tough to analyze application errors. If you build a DLL, constantly hyperlink against the shared libraries. Furthermore, any application related against your DLL must be related against DLL, now not static libraries.

Question fifty one. How Do I Get Vf Error Messages To Include Traceback Information?

Answer :

VF V5 did not consist of a traceback characteristic - V6 does. Select Settings.. Fortran.. Run-Time.. Generate Traceback Information (or /traceback at the command line). You have to also make sure that Incremental Linking is disabled (Link..General) or else you won't get PC-line correlation.




CFG