Explore topic-wise InterviewSolutions in Current Affairs.

This section includes 7 InterviewSolutions, each offering curated multiple-choice questions to sharpen your Current Affairs knowledge and support exam preparation. Choose a topic below to get started.

1.

How Do I Get Vf Error Messages To Include Traceback Information?

Answer»

VF V5 did not include a traceback FEATURE - V6 does. Select Settings.. Fortran.. Run-Time.. GENERATE Traceback Information (or /traceback on the command line). You must ALSO make SURE that Incremental Linking is disabled (Link..GENERAL) or else you won't get PC-line correlation.

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

2.

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

Answer»

We strongly recommend that you NOT do this as it can cause subtle and difficult to analyze application errors. If you BUILD a DLL, ALWAYS LINK against the shared libraries. Furthermore, any application linked against your DLL MUST be linked against DLL, not STATIC libraries.

We strongly recommend that you NOT do this as it can cause subtle and difficult to analyze application errors. If you build a DLL, always link against the shared libraries. Furthermore, any application linked against your DLL must be linked against DLL, not static libraries.

3.

How Do I Change A Project Type For An Existing Project?

Answer»

Each project TYPE presets a LARGE number of default SWITCH and LIBRARY settings. The easiest way to change a project type is to create a new project with the correct type and add the SOURCE files to it.

Each project type presets a large number of default switch and library settings. The easiest way to change a project type is to create a new project with the correct type and add the source files to it.

4.

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

Answer»

Microsoft Developer Studio uses components of Microsoft Internet Explorer (MSIE) to PROVIDE the InfoViewer FEATURE. Other BROWSERS cannot be substituted. Of course, you are free to not use MSIE directly as a BROWSER.

Microsoft Developer Studio uses components of Microsoft Internet Explorer (MSIE) to provide the InfoViewer feature. Other browsers cannot be substituted. Of course, you are free to not use MSIE directly as a browser.

5.

When I Run Setup, It Just Exits Immediately Without Installing Anything?

Answer»

UNINSTALL MICROSOFT INTERNET EXPLORER and run SETUP again.

Uninstall Microsoft Internet Explorer and run SETUP again.

6.

I Get Errors When Installing Via Autoplay Or Running Setup.exe In The Kit's Root Directory?

Answer»

If this happens, TRY RUNNING X86SETUP.EXE.

If this happens, try running X86SETUP.EXE.

7.

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

Answer»

To PERFORM a server installation of VF, copy the contents of the CD-ROM to your server. From each client PC, RUN the server's copy of the SETUP.EXE program and specify a "run from CD" installation type. Some files will STILL be copied to the client PC, but most will remain on the server. Please note that you need a separate license for each client PC which has access to the VF PRODUCT.

To perform a server installation of VF, copy the contents of the CD-ROM to your server. From each client PC, run the server's copy of the SETUP.EXE program and specify a "run from CD" installation type. Some files will still be copied to the client PC, but most will remain on the server. Please note that you need a separate license for each client PC which has access to the VF product.

8.

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 by the f90SQL library from Canaima Software. A freeware VERSION of f90SQL is provided on the Companion Products CD as of CVF 6.5.

This capability is provided by the f90SQL library from Canaima Software. A freeware version of f90SQL is provided on the Companion Products CD as of CVF 6.5.

9.

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

Answer»

No - these are OpenVMS operating system features not PROVIDED by Windows 95 nor Windows NT. There are companies offering "OpenVMS EMULATION libraries" which PROVIDE some of these CAPABILITIES - one such is SECTOR 7, another is Accelr8.

No - these are OpenVMS operating system features not provided by Windows 95 nor Windows NT. There are companies offering "OpenVMS emulation libraries" which provide some of these capabilities - one such is Sector 7, another is Accelr8.

10.

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

Answer»

YES. However, the converse is not TRUE - "downwards compatibility" is not supported.

Yes. However, the converse is not true - "downwards compatibility" is not supported.

11.

Can I Mix Vf V6 Code With Msvc V5 Code?

Answer»

Yes. You can't USE the MSVC 5.x Developer Studio ENVIRONMENT to compile VF V6 code (or vice versa), but if the object files or libraries are BUILT separately, they can be linked together, as long as the newer command-line tools (such as linker and librarian) INCLUDED with VF are used.

Yes. You can't use the MSVC 5.x Developer Studio environment to compile VF V6 code (or vice versa), but if the object files or libraries are built separately, they can be linked together, as long as the newer command-line tools (such as linker and librarian) included with VF are used.

12.

Can I Mix Vf Code With Code From Fps?

Answer»

If the FPS code is computational only - that is, it does not MAKE calls to the FPS I/O library - then in GENERAL the answer is YES. FPS code which makes calls to the FPS library cannot be COMBINED in a static executable or a DLL with VF code, as the Fortran libraries are incompatible. You can build a separate DLL with the FPS code and LINK that in with VF code, but the two Fortran libraries will not "talk to each other".

If the FPS code is computational only - that is, it does not make calls to the FPS I/O library - then in general the answer is yes. FPS code which makes calls to the FPS library cannot be combined in a static executable or a DLL with VF code, as the Fortran libraries are incompatible. You can build a separate DLL with the FPS code and link that in with VF code, but the two Fortran libraries will not "talk to each other".

13.

Can I Run Vf Executables On Windows Nt 3.5x?

Answer»

Yes, as long as they don't USE APIs not available on that version. The DEVELOPMENT tools require WINDOWS NT 4.0/2000 (or Windows 9x).

Yes, as long as they don't use APIs not available on that version. The development tools require Windows NT 4.0/2000 (or Windows 9x).

14.

What About Dos Extenders Or Win32s?

Answer»

No attempt was made to RESTRICT LIBRARY calls to the WIN32S subset, or Win32 subsets supported by DOS EXTENDERS, and no testing with Win32s or DOS extenders has been DONE.

No attempt was made to restrict library calls to the Win32s subset, or Win32 subsets supported by DOS extenders, and no testing with Win32s or DOS extenders has been done.

15.

Does Vf Support Generation Of Applications Which Can Run Under Dos Or Windows 3.x?

Answer»

No. LIKE FPS, VF GENERATES Win32 executables only.

No. Like FPS, VF generates Win32 executables only.

16.

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

Answer»

VISUAL Fortran FULLY supports MULTITHREADED applications that use the Win32 multithread and synchronization APIs. A multithreaded application will NATURALLY take advantage of a multiprocessor SYSTEM. However, the compiler and its libraries do not, by themselves, utilize more than one processor.

Visual Fortran fully supports multithreaded applications that use the Win32 multithread and synchronization APIs. A multithreaded application will naturally take advantage of a multiprocessor system. However, the compiler and its libraries do not, by themselves, utilize more than one processor.

17.

Does Vf Support Windows Xp?

Answer»

CVF 6.6 SUPPORTS WINDOWS XP.

CVF 6.6 supports Windows XP.

18.

Does Vf Support Windows Nt/2000 Terminal Server?

Answer»

We have done limited testing with Terminal Server and have not identified any problems USING Visual FORTRAN in this environment. Please note that a Visual Fortran LICENSE is required for each USER.

We have done limited testing with Terminal Server and have not identified any problems using Visual Fortran in this environment. Please note that a Visual Fortran license is required for each user.

19.

Does Vf Support Windows Millennium Edition (windows Me)?

Answer»

CVF 6.5 or LATER SUPPORTS WINDOWS ME.

CVF 6.5 or later supports Windows ME.

20.

Does Vf Support Windows 2000?

Answer»

Yes, as of version 6.1A, which CORRECTS a minor ISSUE RELATING to QuickWin FONT selection. Previous versions should install ok, but are not officially supported.

Yes, as of version 6.1A, which corrects a minor issue relating to QuickWin font selection. Previous versions should install ok, but are not officially supported.

21.

Does The Compiler Support The Intel Pentium 4 Processor?

Answer»

VF is fully SUPPORTED on the Pentium 4 processor. For best PERFORMANCE on this processor with VF 6.5, we recommend selecting the optimization SETTINGS for "Pentium II/Pro". Version 6.6 adds specific Pentium 4 optimizations.

VF is fully supported on the Pentium 4 processor. For best performance on this processor with VF 6.5, we recommend selecting the optimization settings for "Pentium II/Pro". Version 6.6 adds specific Pentium 4 optimizations.

22.

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

Answer»

VF V6.5 INCLUDES OPTIMIZATIONS for the AMD Athlon/Duron and Intel Pentium III PROCESSORS. V6.0 and V6.1 could OPTIMIZE for the Pentium Pro/Pentium II/Celeron as well.

VF V6.5 includes optimizations for the AMD Athlon/Duron and Intel Pentium III processors. V6.0 and V6.1 could optimize for the Pentium Pro/Pentium II/Celeron as well.

23.

Will Vf V5 Work With Microsoft Visual C++ 6.0/visual Studio 98? Will Vf V6.x Work With Visual C++ 5.0/visual Studio 97?

Answer»

VF V6.x does SHARE the DEVELOPMENT environment of MS Visual C/C++ 6.0; VF V5 does not. Conversely, VF V5 shares the development environment of MS Visual C/C++ 5.0/Visual Studio 97, and VF V6.x does not. The two generations can coexist on a SINGLE system and objects/libraries created by the OLDER COMPILERS can be used with the newer development environment.

VF V6.x does share the development environment of MS Visual C/C++ 6.0; VF V5 does not. Conversely, VF V5 shares the development environment of MS Visual C/C++ 5.0/Visual Studio 97, and VF V6.x does not. The two generations can coexist on a single system and objects/libraries created by the older compilers can be used with the newer development environment.

24.

Which File Extension Should I Use For My Fortran Code?

Answer»

Although there are no official file extensions for Fortran CODE, there are two widely established conventions. Some use .f for fixed-form source and .f90 for Free form LAYOUT. The latter is a reference to the Fortran 90standard, when Free form layout was introduced. The code contained in the file can be Fortran 95, Fortran 2003, etc. Others prefer to use file extensions that indicate the standard under which the code was written. For EXAMPLE, .f03 for Fortran 2003 code and .f08 for Fortran 2008 code. Unfortunately, this RESULTS in a proliferation of file extensions and some compilers may not support the newer extensions yet.

Although there are no official file extensions for Fortran code, there are two widely established conventions. Some use .f for fixed-form source and .f90 for Free form layout. The latter is a reference to the Fortran 90standard, when Free form layout was introduced. The code contained in the file can be Fortran 95, Fortran 2003, etc. Others prefer to use file extensions that indicate the standard under which the code was written. For example, .f03 for Fortran 2003 code and .f08 for Fortran 2008 code. Unfortunately, this results in a proliferation of file extensions and some compilers may not support the newer extensions yet.

25.

Can I Allocate A Variable Length Character String?

Answer»

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

character(LEN=:), ALLOCATABLE :: str integer :: N n = 27 allocate(character(LEN=n) :: str)

A Fortran 95 solution is the iso_varying_string module, or the variable length string module in FLIBS.

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

A Fortran 95 solution is the iso_varying_string module, or the variable length string module in FLIBS.

26.

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

Answer»

A common Fortran 95 idiom for reading lines until the end of FILE is

INTEGER :: stat character(len=100) :: buf open(15, file='foo.txt') do read(fh, iostat=stat) buf if (stat /= 0) exit ! process buf end do close(15)

This example catches all conditions, not just the end of file. To specifically catch the EOF in Fortran 2003 one can USE the iso_fortran_env module and REPLACE the if condition above with

if (stat == iostat_end) exit

A common Fortran 95 idiom for reading lines until the end of file is

This example catches all conditions, not just the end of file. To specifically catch the EOF in Fortran 2003 one can use the iso_fortran_env module and replace the if condition above with

27.

How Do I Produce A Library?

Answer»

To build a static library libfoo.a containing all modules and PROCEDURES in the .f90 files in the current directory on Linux:

% gfortran -c *.f90
% ar cr libfoo.a *.o

The first command builds the object files and the second archives the object files into a static archive.
To build a shared library libfoo.so:

% gfortran -shared *.f90 -o libfoo.so -FPIC

In both CASES, other compiler flags such as -O2 can be used.

 

To build a static library libfoo.a containing all modules and procedures in the .f90 files in the current directory on Linux:

The first command builds the object files and the second archives the object files into a static archive.
To build a shared library libfoo.so:

In both cases, other compiler flags such as -O2 can be used.

 

28.

How Should One Capitalize "fortran" ?

Answer»

Standard capitalization is now the preferred way to write Fortran for several REASONS, most NOTABLY because that is how RECENT VERSIONS of the standard write it. Another reason is due to an effort to STANDARDIZE the capitalization of the names of programming languages.

Standard capitalization is now the preferred way to write Fortran for several reasons, most notably because that is how recent versions of the standard write it. Another reason is due to an effort to standardize the capitalization of the names of programming languages.

29.

Which Fortran Compiler Should I Use?

Answer»

GFortran, G95, OPEN Watcom, and Silverfrost are FREE Fortran compilers, while Absoft, IBM, Intel, Lahey,NAG, Pathscale, PGI, and Oracle PRODUCE COMMERCIAL Fortran compilers.

GFortran, G95, Open Watcom, and Silverfrost are free Fortran compilers, while Absoft, IBM, Intel, Lahey,NAG, Pathscale, PGI, and Oracle produce commercial Fortran compilers.

30.

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

Answer»

Yes. For example you can SET initial values for A, B, and C with either of the FOLLOWING statements.

DATA A/1.0/,B/2.0/,C/3.0/ DATA A,B,C/1.0,2.0,3.0/

Yes. For example you can set initial values for A, B, and C with either of the following statements.

31.

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

Answer»

Yes if you have a subdirectory CALLED "test" under the location that your program, you can open the file "my.data" in "test" for reading on unit 11 with the COMMAND: OPEN(11,file='test/my.data')

Yes if you have a subdirectory called "test" under the location that your program, you can open the file "my.data" in "test" for reading on unit 11 with the command: OPEN(11,file='test/my.data')

32.

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

Answer»

The major use is in cutting the size of the executable file PRODUCED by "f77" (usually a.out). It won't seem like a big deal to you now, but in applications containing many arrays with thousands to millions of elements each, this can MAKE a huge difference in the amount of disk space you soak up. A secondary use is that, when the program starts, the space FINALLY allocated to blank common in memory is at the very end of the program. If you are tricky enough, you can take advantage of this to dynamically extend the size of a SINGLE array in blank common as your space requirements grow during execution.

The major use is in cutting the size of the executable file produced by "f77" (usually a.out). It won't seem like a big deal to you now, but in applications containing many arrays with thousands to millions of elements each, this can make a huge difference in the amount of disk space you soak up. A secondary use is that, when the program starts, the space finally allocated to blank common in memory is at the very end of the program. If you are tricky enough, you can take advantage of this to dynamically extend the size of a single array in blank common as your space requirements grow during execution.

33.

When Is The Common Command Not Used Correctly In A Fortran Statement?

Answer»

You're asking for quite a bit here. There are lots of ways to introduce errors. The most obvious is to try inserting a common in 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 use of multiple COMMON statements for blank common or the same named common. Fortran will accept the following program:

program testcom common a,b common c,d a=1.0 b=2.0 c=3.0 d=4.0 call sub1 stop end subroutine sub1 common c,d PRINT *, c, d return end

However, the values printed out are 1.0 and 2.0. The second common statement in the main program just tacks the variables "c" and "d" onto blank common after "b". The two commons together are equivalent to "common a,b,c,d". In the subroutine you are saying that "c" is the FIRST element in blank common, so Fortran associates "c" in "sub1" with the same address in memory as assigned to "a" in the main program. Also recall that mixing reals and integers (common/blk1/a,b,i,c) when the reals are DOUBLE precision may CAUSE errors on some machines, and is not a good IDEA on any 32 bit machine.

You're asking for quite a bit here. There are lots of ways to introduce errors. The most obvious is to try inserting a common in 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 use of multiple COMMON statements for blank common or the same named common. Fortran will accept the following program:

However, the values printed out are 1.0 and 2.0. The second common statement in the main program just tacks the variables "c" and "d" onto blank common after "b". The two commons together are equivalent to "common a,b,c,d". In the subroutine you are saying that "c" is the first element in blank common, so Fortran associates "c" in "sub1" with the same address in memory as assigned to "a" in the main program. Also recall that mixing reals and integers (common/blk1/a,b,i,c) when the reals are double precision may cause errors on some machines, and is not a good idea on any 32 bit machine.

34.

What Does The Function Real(x) Do?

Answer»

Not much if x is already a real VARIABLE. If x is and integer, the OUTPUT of REAL is a real (FLOATING point number with the same value. REAL(3) is 3.00000E+00. If x is a complex number REAL returns the real part (as OPPOSED to the imaginary part) of x.

Not much if x is already a real variable. If x is and integer, the output of REAL is a real (floating point number with the same value. REAL(3) is 3.00000E+00. If x is a complex number REAL returns the real part (as opposed to the imaginary part) of x.

35.

What Does // Do?

Answer»

It sticks 2 CHARACTER STRINGS TOGETHER into a single 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'.

It sticks 2 character strings together into a single 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'.

36.

Is It Possible To Lay Out A Two Dimensional Array With The Double Do Loops?

Answer»

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, if you have a FORTRAN 90 compiler.

37.

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

Answer»

Yes, but you have to use one format statement to build a SECOND using a write to a character string. For example if you WANT to include the value of "n" as the number of real numbers per line you would do the following:

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

Yes, but you have to use one format statement to build a second using a write to a character string. For example if you want to include the value of "n" as the number of real numbers per line you would do the following:

38.

What Directory Is Used By The Compiler For Compiling A Fortran Program? Where Does F77 Live?

Answer»

For the work in this class, 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 UNUSUAL. 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". 

For the work in this class, 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 unusual. 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". 

39.

What Does "common/control/ A, B, C" Do To The Values Of A, B, C?

Answer»

It doesn't do anything to the values. It just establishes a place in memory for the values to be stored and retrieved. Every subroutine and function in your program that contains the line "COMMON/CONTROL/ A, B, C" will agree that operations using variables A, B, or C will get numbers from or put numbers in the same appropriate LOCATION in memory. That is, they agree that a reference to "A" means the same in all routines with common CONTROL, etc.. To give A, B, or C a value, you have two options. 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.0, 2.0, 3.0/ END

You can also assign and use values with executable statements. Say subroutines SUB1 and SUB2 contain this common block. If SUB1 contains 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 EXECUTED is 3.0.

It doesn't do anything to the values. It just establishes a place in memory for the values to be stored and retrieved. Every subroutine and function in your program that contains the line "COMMON/CONTROL/ A, B, C" will agree that operations using variables A, B, or C will get numbers from or put numbers in the same appropriate location in memory. That is, they agree that a reference to "A" means the same in all routines with common CONTROL, etc.. To give A, B, or C a value, you have two options. You can assign values at compilation time with a BLOCK DATA routine:

You can also assign and use values with executable statements. Say subroutines SUB1 and SUB2 contain this common block. If SUB1 contains 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 executed is 3.0.

40.

What Is The Difference Between Do, Do While, And If ( ) Goto Loops?

Answer»

In terms of what the COMPUTER actually does, there is generally no difference. You can structure all three so that they do the same THING. When properly intended, the DO structures tend to be easier to follow. The DO WHILE structure can produce slightly more compact coding, COMBINING a straight DO with the option for some extra comparison logic. In a vector and/or parallel computer, DO's send strong HINTS to the compiler that it should be looking for ways to feed a pipeline or spread calculations over multiple PROCESSORS.

In terms of what the computer actually does, there is generally no difference. You can structure all three so that they do the same thing. When properly intended, the DO structures tend to be easier to follow. The DO WHILE structure can produce slightly more compact coding, combining a straight DO with the option for some extra comparison logic. In a vector and/or parallel computer, DO's send strong hints to the compiler that it should be looking for ways to feed a pipeline or spread calculations over multiple processors.

41.

What Is The Difference Between A Function Subprogram And A Subroutine?

Answer»

The biggest difference is that a subroutine never RETURNS a value that is associated with its name. This means that you never need to DECLARE a subroutine name in a type statement (REAL, INTEGER ...). All information coming back from a subroutine passes through the argument list, or SOMETHING called a COMMON block (later). However, there is nothing in these COMMUNICATIONS channels that can't be used by a Function Subprogram. A secondary difference is that a Subroutine need not have an argument list.

The biggest difference is that a subroutine never returns a value that is associated with its name. This means that you never need to declare a subroutine name in a type statement (REAL, INTEGER ...). All information coming back from a subroutine passes through the argument list, or something called a COMMON block (later). However, there is nothing in these communications channels that can't be used by a Function Subprogram. A secondary difference is that a Subroutine need not have an argument list.

42.

What Is The Difference Between If Then And Do While Statements?

Answer»

IF THEN combined with GO TO statements will let you do ANYTHING you want. The DO WHILE and other DO constructs allow you to loop through certain portions of CODE many times without ever WRITING GO TO statements. This makes coding slightly simpler, definitely clearer.

IF THEN combined with GO TO statements will let you do anything you want. The DO WHILE and other DO constructs allow you to loop through certain portions of code many times without ever writing GO TO statements. This makes coding slightly simpler, definitely clearer.

43.

How Do You Use A Logical Variable? What Is Stored There?

Answer»

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.

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.

44.

Why Doesn't Fortran Have Intrinsic Functions For Something As Simple As Factorial?

Answer»

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.

nfact = sqrt(2*3.1415963*n)*(n/2.71828)**n

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.

45.

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

Answer»

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.

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.

46.

Where Can I Get A Fortran Compiler For Ibm Pc?

Answer»

We can pick up one on the INTERNET from the GNU PROJECT, but get a BETTER package from MOC for about $80.00.

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

47.

How Do We Know Where Various Steps Go In A Fortran Program?

Answer»

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.

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.

48.

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

Answer»

Both can store similar types of information and a neatly labeled and organized way. The ADVANTAGE lies in where they are used. You have more control 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, once the Fortran is written, it will do the job much faster than a spreadsheet. On the other hand, when operations are not complex and COMPUTER execution time is not a problem USING the spreadsheet is probably your best bet.

Both can store similar types of information and a neatly labeled and organized way. The advantage lies in where they are used. You have more control 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, once the Fortran is written, it will do the job much faster than a spreadsheet. On the other hand, when operations are not complex and computer execution time is not a problem using the spreadsheet is probably your best bet.

49.

Do Spaces Mater In Fortran Equations?

Answer»

No. Spaces are generally ADDED for clarity Some compilers get upset if you write things like” INTEGERI,J” RATHER than INTEGER I,J”. Simple neatness will KEEP you out of these PROBLEMS.

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

No. Spaces are generally added for clarity Some compilers get upset if you write things like” INTEGERI,J” rather than INTEGER I,J”. Simple neatness will keep you out of these problems.

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

50.

How Does Fortran 90 Relate To Fortran 77?

Answer»

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).

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).

Previous Next