




Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
Main points of this past exam are: Fortran90 Program, Sequence of Integers, Sample Run of Program, Positive and Negative Integers, Partial Credit, Important Design Feature, Inner Control Limits, Experimental Reading, Tabular Form
Typology: Exams
1 / 8
This page cannot be seen from the preview
Don't miss anything!
Cork Institute of Technology
Bachelor of Engineering (Honours) in Structural Engineering - Stage 1
Summer 2008
Q1a[ 8 marks] What is the output from the following Fortran90 program? NOTE: Trace your working so that partial credit may be given for incomplete or incorrect work.
PROGRAM a2004_q1a implicit none
integer::john = 9, george = 4 real::paul = 9.0, ringo = 4. character::damien = 'Z'
print, john + 1 / george print, george + 1 / john
print, john / george + 1 print, george / john + 1
print, (paul - 3)/ ringo print, ringo / (paul + 11)
print, (john + 1)/ ringo print, george / (paul - 1)
print*,'take a deep breath'
print, 3 * george - 2 * ringo print, (george * 2 == ringo * 3)
print*, damien
STOP'a2004_q1a.f90 ends .' END PROGRAM a2004_q1a
Q1b[ 8 marks] What is the output from the following Fortran90 program? NOTE: Trace your working so that partial credit may be given for incomplete or incorrect work.
PROGRAM a2004_q1b implicit none
integer::cork = 15, clare = 10, cavan = 5
if( (clare /= 5) .and. (clare /= 15) )then if(cork == 10)then print, 'ring' else print, '*setanta' end if end if
cork = cork - 5
if( (cork == clare) .and. (clare > cavan) )then print, 'ronan' end if clare = cavan cavan = cavan + 5 if( (cork > clare) .and. (clare < cavan) )then print, '****DJ' clare = cork + cavan end if if( (cavan > clare) .and. (clare > cork) )then print, 'shevlin' else print, 'gilligan' end if
STOP'a2004_q1b.f90 ends ..' END PROGRAM a2004_q1b
Q1d[ 8 marks] What is the output of the following Fortran90 program? NOTE: Trace your working so that partial credit may be given for incomplete or incorrect work.
PROGRAM a2004_q1d implicit none
integer::limit = 6 integer::a, b
do a = limit,0, - do b = limit, 0, - if( (0 == a) .or. (limit == a) )then write(,'(i1)',advance='no')a else if( (b - a == 0))then write(,'(i1)',advance='no')a else if( (b + a == limit))then write(,'(i1)',advance='no')b else write(,'(a)',advance='no')'#' end if end do print* end do
STOP'a2004_q1d.f90 ends ....' END PROGRAM a2004_q1d
Q1e[ 8 marks] What is the output of the following Fortran90 program? What is the variable thatOne doing in the code?. NOTE: Trace your working so that partial credit may be given for incomplete or incorrect work.
PROGRAM a2004_q1e implicit none
integer::thisOne, thatOne
thisOne = 17 thatOne = 1 do write(, '(i5)', advance= 'no')thisOne if(mod(thatOne, 5) == 0)then print end if if(thisOne == 1)exit
if(mod(thisOne, 2) == 0)then thisOne = thisOne / 2 else thisOne = thisOne * 3 + 1 end if thatOne = thatOne + 1 end do print* print*
stop'a2004_q1e.f90 ends ...' END PROGRAM a2004_q1e
The experimental data for an important design feature of a structure are stored in the file f:\myExperiment\theData.dat. The data is raw(without any explanatory text or headings) and each line contains one experimental reading x for the feature as shown in fig 2.1 below(10 data items are shown but there are probably several hundreds of values in the file). We use x to preserve confidentiality.
Each value of x is taken regularly, at intervals of 3 hours. The value is monitored against a Control Chart to ensure that it stays stable: If a value falls outside the Outer Control Limits (OCL) the structure is closed for immediate analysis and repair, if a value falls outside the Inner Control Limits(ICL) (but NOT outside the OCL) a warning state is declared but the structure is NOT closed.
Please write Fortran90 code / program to connect to this file, to read the data calculating the mean and standard deviation for the data on file, to calculate the max and min values for the data on file, to calculate the inner control limits, the outer control limits to transfer them (for printing for monitoring technicians at the start of each day) to the new file f:\myExperiment\theControlLimits.dat in tabular form as shown if fig. 2.2 below.
The relevant formulas are detailed on the next page.
etc etc
Write a Fortran90 program to calculate and display the perimeter and the area of triangles whose vertices (i.e. the x, y coordinates of the vertices) are specified by the user.
The code should feature
Q4a[ 6 marks] Write a Fortran90 function module for the Fortran90 functions FUNCTION f(x) and FUNCTION fPrime(x) to define the functions
Q4b[ 12 marks] Write a Fortran90 subroutine module to implement the NewtonRaphson Root Finding Algorithm, SUBROUTINE NewtonRaphson(f, fPrime, approx, epsilon, maxIter, root) given
Q4c[ 12 marks] Write a Fortran90 driver program to use the above modules to search for and find the roots of f(x). This program will feature
Q5a(15 marks) Write , in a single module form, the two subroutines Convert_to_Polar(X, Y, R, Theta) to return the polar coordinates (R, Theta) equivalent to the rectangular coordinates (x, y), and Convert_to_Rectangular(R, Theta, X, Y) to return the the rectangular coordinates (x, y), equivalent to polar coordinates (R, Theta).
Q5b(15 marks) Write , in a single module form, the two LOGICAL functions LinesAreParallel(a, b, c, d, e, f)
LinesArePerpendicular(a, b, c, d, e, f)