Fortran MCQs

Fortran MCQs

Answer these 10 Fortran MCQs and see how sharp is your knowledge of Fortran.
Scroll down and let's start!

1: A number stored in Double Precision Floating Point (REAL*8) format can have at most approximately how many decimal digits of precision?

A.   15

B.   7

C.   31

D.   3

2: In a FORTRAN program I have set x=1.5,i=3, and j=2. What is the value of y if:

A.   3.5

B.   3.0

C.   4.0

D.   4.5

3: The statement "read(10,end=100) mm " will:

A.   Set the variable mm = 100 when the end of the file is reached

B.   Branch to the statement with label 100 when the end of the file is reached on unit 10

C.   Branch to the end of the program when a value of 100 is read from unit 10

D.   Branch to the statement label with 100 when the struing

4: Which of the following is not a valid property of a PARAMETER statement?

A.   Parameters can be set anywhere in a program

B.   Can combine other parameters with FORTRAN arithmetic operators to compute the value of a new parameter

C.   Parameters can be used as bounds on do loops.

D.   Integer parameters can be used to set array dimensions

5: In a FORTRAN program x=1.0, y=2.0 and w=3.0. What is the value of z if: z=2.0(x(y+3.0)+w)

A.   Not determined due to a FORTRAN syntax error

B.   16.0

C.   12.0

D.   18.0

6: Which of the following is an executable statement ( takes action when "a.out" is executeed)?

A.   Close

B.   Dimension

C.   Intrinsic

D.   External

7: A real number established with "selected_real_kind(6,30)" uses how many bits?

A.   6

B.   30

C.   4

D.   32

8: A FORTRAN WHERE statement:

A.   Provides the current cursor position on the terminal screen

B.   Provides the current line number in the input file being processed

C.   Conditionally executes one or more Fortran 90 vector (array) statements

D.   Returns the name of the current Subroutine or Function

9: Which of the following statements is a valid way to open the file test.data and associate it with unit 10?

A.   Open(10,file='test.data')

B.   Open(10,'test.data')

C.   Open(10,test.data)

D.   Open(10, file= test.data )

10: In a FORTRAN program x=4.5, y=3.0, and w=1.5, What is the value of z if: z = x+w/y+1

A.   3.0

B.   4.5

C.   6.0

D.   1.5