17 views

Uploaded by Serdar Bilge

fortran midterm

- C+++++++++++++++
- Common Lisp Recipes
- SAP HR Questions About Personnel Administration Configuration
- Experiment 1
- Foundation Practice Exam Questions 6
- АНГЛО РУССКИЙ СЛОВАРЬ
- Installation • Chapter 2 • Build Your Own Lisp
- Ale Idocs Basic Concepts
- 23
- CCS.ppt
- 16
- 9691_y11_sm_2as
- Class 12 Computer Science Solved Sample Paper 1 - 2012
- jBase3.XProgrammersReferenceManual
- MCS-011
- technical question
- Lesson 1 - First Program
- 02 Variables
- Wipro Papers
- ANSI C Programming Course

You are on page 1of 4

28.04.2015 17:40

There are 40 questions (each 2.5 points) for a total of 100 points.

Exam Type:

All questions are multiple choice, no points will be lost for wrong answers.

Do not forget to mark your student ID and exam type correctly to the answer sheet. Otherwise, your answers will not be graded.

Assume that all necessary libraries were added properly (by using "include" statements).

Default return type of the main function is int. Assume that the statement return 0; is added to programs if necessary.

Name:

Student ID:

Section:

a) ab.c

b) abc

c) cb.a

d) bc.a

a) (a**c)**b

b) (a**b)**c

c) (c**b)**a

d) a**(c**b)

e) a**(b**c)

3) Given the contents of the variables:

a) 3.000 3.0

d) 3.000 ***

.NOT.k.eqv.m.and.a>b

1

c) .f. d) .TRUE.

e) .YES.

write(*,10)57.388,55555

format(f5.2,/,i3)

end

b)57.39/

***

***

c)57.38

***

d) 57.388

555

e) 57.39

555

real x; integer y

y=9.9; y=x

print*,y; end

b) 9

b) 14.0

c)10.0

e) 2.8

d)5.0

c) 9.0 d) 10

e) Unknown/Undefined

i=1; j=5

if(j>6.and.i+1>0) then

i=i+1; print*,"A"; else

print*,"B"; end if

if(j>0.or.i+1>0) then

i=i+1; print*,"C"; else

print*,"D"; end if

print*,i

end

b) BC2

a=7/5

if(a-1/=0)then; print*,10*a

else if(a==(a+1)/4)then; print*,2*a

else; print*,5*a; end if; end

a) 2.0

a) B

C

2

b) .3E+01 .30E+01 3

d) ****** ******* 3

a) 10.0

c) ***** 3

isum=17; icount=5

x=isum/icount;

write(*,1)x,x,isum/icount

format(e6.3,1x,e7.2,1x,1i2)

end

a) .3E+1 .30+E1 3

c) ****** .30E+01 3

e) .3e+1 ******* 3

a) 57.39

b) 3.000 3

e) 3.000 3.4

10

isum=17; icount=5

x=isum/icount;

write(*,1)x,isum/icount

format(f5.3,1x,i2)

e) ba.c

a) *T* b) .FALSE.

Signature:

c) A

K=5/2

if(K)1,2,3

1

K=K+1; goto(1,2,3),K

2

K=K+2; goto(2,3),K

3

print*,K; end

a) 2.5

b) 2

c) 3

d) 4

e) 4.5

d) B

C

3

e) A

C

3

K=5/2

goto(1,2,3),K

1

K=K+1; if(K)1,2,3

2

K=K+2; if(K)1,2,3

3

print*,K; end

a) 4.5

b) 2

c) 2.5

d) 3

e) 4

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

18) Which of the following if statements is doing the action

that is verbally specified as:

if a is smaller than b then c is assigned the value of a,

otherwise c is assigned the value of b

K=5/2

goto(1,2,3),K

K=K+1; goto 4

K=K+1; goto 4

print*,K; end

4

1

2

3

a) 3.5

b) 3

c) 2

d) 2.5

a) if

b) if

c) if

d) if

e) if

e) 4

m=1; s=5

if(m<100)then

s=s+m; m=m+50; go to 5

else

print*,s,m; stop

end if; end

a) 57.0

101

d) 56.0

b) 57.0

101

100

e) 56

integer :: m=6,n=3,t=2,k

real :: x=12.72,y=16.0,a,b,c,d

a=y/n+m;

b=m*n; k=x/m; c=m/n; d=n/t

write(*,5)a,b,c,d,k

5 format(4f6.2,i3)

c) 57

102

101

operation described in English as:

if a or b is less than c then print OK, otherwise print NO.

Which of the following Fortran Statements perform this

operation?

I. if((a.OR.b)<c)then

II.

Print*,"OK"

Else

Print*,"NO"

endif

III. If(a<c.or.b.LT.c)then

print*,"OK"

else

print*,"NO"

endif

a) 11.33 18.00

b) 12.00 18.00

c) 11

18

d) 11

18

e) 12.00 18.00

a) OK

OK

c)8

a) FALSE

d) 5

e)9

10

d) 45.26

integer :: a=5,b=4,c=7,d

d=1.5

print*,mod(c/(a+2),b*d)

end

a) 1

b) 2

c) 4

OK

FAIL

d) FAIL

e) Compile-time Error

FAIL

d) 6

b) .TRUE. c) 4HTRUE

d) 5HFALSE

e) TRUE

following code?

integer result

a=4.5255; b=10.0

result=a*b

print*,result

end

c) 45.0

b) FAIL c) OK

i=10; j=0

if(i.EQ.20.OR.j-1/=0)then

print*,4HTRUE

else

print*,5HFALSE

end if

end

b) 45

2

1.5

2

1

2

integer a

a=z/2

print*,a; end

a) 45.255

1.00

2.00

2

2

2.00

real :: a=1.0

if(3<2.OR.3<4.AND.5>6)then

print*,'OK'; else; print*,'FAIL'; endif

if(.NOT.5>6.AND.(a/=2.0))then

print*,'OK'; else; print*,'FAIL'; endif

end

if(c.GT.(a,b))then

print*,"OK"

else

print*,"NO"

endif

b)5.0

2.00

2.00

2.12

2.12

2.00

a) Only I

b) Only II

c) Only III

d) I and III

e) II and III

a) 8.0

(a < b)then; c==b; else; c==a

(a <b )c=a, else c=b

(a < b)then c=a; otherwise c=b

(a < b)c=a; c=b

e) 46

i=-5000

i=i+1

if(i.NE.0)then

if(.NOT.mod(i,3).EQ.1)goto 10

print*,'TAKA TUKA'

i=i+1

if(i>10)STOP

goto 10

end if

end

a) 0 times

b) 7 times

c) 10 times

d) 5000 times

e) infinitely many times

e) 8

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

a) 4

b) 4.0

c) 0.0 d) 0 e) Run-time Error

29) What is the output of the following Fortran Program?

a) 1

2

3

d) 1

2

3

k=10; i=1

10 if(i>k)stop

if(mod(i,2).eq.0)then

k=k/3;else

if(mod(i,3).eq.0)then

k=k/2; else

k=k*2

endif

endif

print*,i,k; i=i+1; goto 10

end

20

b) 1

20

c) 1

6

2

6

2

3

3

3

3

4

1

6.6

3.3

3

integer x; x=2

if(x.eq.3)then; y=1

if(x.le.3)y=2; else; y=3

print*,y; endif

print*,y

end

a) 1.0

b) 3.0

1.0

20

6.66

3

c) 2.0

2.0

d) 3.0

2.0

e) 2.0

3.0

3.0

index=0

10 index=index+1

if(index<5)then; goto 15

else;

stop; end if

print*,'CEng200'

15 if(index.LE.10)goto 10

End

e) No output

11

51

21

41

61

a) aaa

a) 0 times

b) 10 times

c) 5 times

d) 4 times

e) Infinitely many times

x=3.0

if(x-4.0) 11,21,11

if(x-3) 41,51,41

print*,"a"; goto 61

print*,"aa"; goto 61

print*,"aaa"

stop

end

b) aa

c) a

d) a aaa

if the input is 60?

e) aa aaa

the following fragment?

integer a; real x

a=3.0

x=a/(a/4)

a) 4

b) 0.0

c) 4.0

k=0;

k=k+1

if(k<3)then

read*,i

if(mod(i,3).ne.0.and.mod(i,5).eq.0)then

print*,"A"; else

if(mod(i,3).ne.0.and.mod(i,2).eq.0)then

print*,"B"; else

print*,"C"; end if; end if; end if; end

a) A

d) Error

e) 0

c) 4.0

d) 4

e) Runtime Error

the following fragment?

integer a; real x

a=3.0

x=a/(a/4.0)

a) Run-time Error

b) 0.0

c) 4

e) C

a) A

b) B

c) C

d) C

e) C

execution of the expression below?

M = 7.0/2 + (5/2.0)!= 100 + 20/10**3

d) 0

e) 4.0

the following fragment?

integer a; real x

a=3.0

a=a/(a/4.0)

print*,a

end

d) C

k=0;

k=k+1

if(k<3)then

read*,i

if(mod(i,3).ne.0.and.mod(i,5).eq.0)then

print*,"A"; else

if(mod(i,3).ne.0.or.mod(i,2).eq.0)then

print*,"B"; else

print*,"C"; end if; end if; end if; end

integer a; real x

a=3.0

x=a/a/4

b) 0.0

c) C

if the input is 60?

the following fragment?

a) 0

b) B

a) 6

b) 5

c) 6.0

d) 5.0

e) .FALSE.

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

34)What is the output of he following code?

kk=25; ii=15

10 if(ii.GT.kk)stop

if(mod(ii,2).EQ.0)then

kk=kk/3

else; if (mod(ii,3).eq.0)then

kk=kk/2

else; kk=kk*2

endif; endif

print*,ii,kk

ii=ii+2; goto 10

end

a) 15

12.5

d)17

b) 15

12

24.0

e)15.0

c)17

compile time errors?

I.

II.

III.

IV.

a) Only IV

d) I and III

a) A

c) C

c) I,II,IV

e) None of them

a=3.0

if(a-4)100,200,100

if(a-3)400,500,400

print*,'A'; goto 600

print*,'B'; goto 600

print*,'C'

stop; end

b) B

b) I and IV

24

12.0

implicit none

real

:: m=5

integer :: x=7.5

T=m*x

K=m+x

print*,m,x,T,K

end

100

500

200

400

600

integer :: a=1.0

real :: i=2

real :: c=3

character :: d='CEng200'

d) AB

e) AC

a) 5

7.5 37.5

12.5

b) 5.0 7

35.0

12

c) 5

7.5 35.0

12

d) 5

7.5 35

12.0

e) Compile-Time error

40) Which code computes the kth partial sum of the continued

fraction Sk=1+1/Sk-1

integer A , B

A=1; B=2

a=2.5; b=3.2

x=A+b

y=a+B

z=B*(a+b)

print*,x,y,z

end

a) 5.0

c) 4.0

e) 4

5.0

4.0

4

15.0

11.0

11

I)

read*,k

s=1; i=1

5 s=1+1/s

if(i.le.k-1)goto 5

...

III) read*,k,s,i

5 s=1+1/s

print*,s

d) 5

5

15

if the inputs are 75 and -34?

a) Only I

d) Only III

read*,ix,iy

if(ix>0)then

if(iy>0)then

print*,1

else

print*,4; endif

else if(ix<0)then

if(iy>0) then

print*,2

else

print*,3

endif

else

print*,0

endif

end

a) 0

b) 1

c) 2

d) 3

e) 4

b) I and II

e) Only II

II) read*,k

s=1; i=1

5 s=1+1/s

if(i.gt.k)goto 5

...

IV)

s=1.0; read*,i

5 sk=1.0+1.0/sk-1

i=i+1

if(i<k) goto 5

...

c) Only IV

- C+++++++++++++++Uploaded byAshdada
- Common Lisp RecipesUploaded byRicardo Lopez
- SAP HR Questions About Personnel Administration ConfigurationUploaded byKirti Thete
- Experiment 1Uploaded byPeru Haya
- Foundation Practice Exam Questions 6Uploaded byDr Coolz
- АНГЛО РУССКИЙ СЛОВАРЬUploaded byasher2
- Installation • Chapter 2 • Build Your Own LispUploaded byAnonymous sDiOXHwPPj
- Ale Idocs Basic ConceptsUploaded bySwati Jain
- 23Uploaded byscribdir
- CCS.pptUploaded byAndres Contreras
- 16Uploaded byscribdir
- 9691_y11_sm_2asUploaded byUdara Buddhika
- Class 12 Computer Science Solved Sample Paper 1 - 2012Uploaded bycbsestudymaterials
- jBase3.XProgrammersReferenceManualUploaded byPrashanth Srinivasan
- MCS-011Uploaded bySourav Scroll Lock Nag
- technical questionUploaded bySandeep Burman
- Lesson 1 - First ProgramUploaded bymehmood26855
- 02 VariablesUploaded byanidcohen9058
- Wipro PapersUploaded byAsuthosh Reddy
- ANSI C Programming CourseUploaded byThiago Monteiro
- Dyna5 Section 7.1Uploaded byAH
- Jawahar M (1)Uploaded bySanthakumar Santhakumar
- VBA Error HandlingUploaded byshaonaa
- ITAM-3rdunit Data BankUploaded byvenkatraok
- A “Crash Course” To (Matlab And) C Programming For TTT4225Uploaded bymubafaw
- sandaniresume[1]Uploaded byapi-3868181
- C Programs for CollegesUploaded byJohn
- UntitledUploaded byRohini Edke
- C FunctionsUploaded bySayantan Pal
- Problem 1 018Uploaded byJared Williams

- 014_Chapter 4_L9_(02-10-2013)Uploaded bySerdar Bilge
- Trig Cheat SheetUploaded byHMaSN
- CFD_LEARNUploaded byAbed Naem
- Mechanical Intro 14.5 L02 BasicsUploaded byChandresh
- Fluent Tutorial 1 - Fluid Flow and Heat Transfer in a Mixing ElbowUploaded byklausosho
- SOLUCIONARIO DINAMICA DE HIBBELER capitulo 12 Cinematica de la particulaUploaded byChristian Olvera
- Fortran.pdfUploaded byTolga Yücel
- lecture12.pdfUploaded bySerdar Bilge
- lecture12.pdfUploaded bySerdar Bilge
- ode11Uploaded byMuhammad Saad Arshad
- Laplace_derivatives.pdfUploaded bySerdar Bilge
- StaticUploaded bySerdar Bilge
- Fluent 13.0 Workshop02-AirfoilUploaded byNoolOotsil
- Fluent 13.0 Workshop02-AirfoilUploaded byNoolOotsil
- mt1solUploaded bySerdar Bilge
- The Impact of Social Media on Children, Adolescents, And FamiliesUploaded byMaddy Bot
- Hw4_2016 flight mechanicsUploaded bySerdar Bilge
- CAETraining(Fluid)Uploaded byandysarmiento
- HW02 aerospace structureUploaded bySerdar Bilge
- Hw3_2016 flight mechanicsUploaded bySerdar Bilge
- HW05 aerospace structureUploaded bySerdar Bilge
- Torsion and TransverseShearUploaded byHeather Smith
- HW04 aerospace structureUploaded bySerdar Bilge
- Torsion of Thin SectionsUploaded bySyed Rizwan Saleem
- HW06 aerospace structureUploaded bySerdar Bilge
- HW03 aerospace structureUploaded bySerdar Bilge
- HW1_2016 flight mechanicsUploaded bySerdar Bilge
- ae362_2006_hw1 aerospace structureUploaded bySerdar Bilge
- Hw2_2016 flight mechanicsUploaded bySerdar Bilge
- hw2.pdfUploaded bySerdar Bilge

- 5.5_ADMUploaded byJosé Dalmi
- 2018FEUploaded byDenz Tajo
- Data Modeling HadoopUploaded byadminolej
- EEB417 68kUploaded byfoster
- regelwerk_manualUploaded bydan2981
- Umair - Software EngineerUploaded byUmair Asghar
- Intro to ArduinoUploaded byAmri Salman Rizal
- electrical circuit lab reportUploaded byapi-239929566
- Preversion 5 Winds x UserUploaded byfoxberry1970
- Virtual MachineUploaded byeddysmithg_music
- Compact Flash File SystemUploaded bygregjohnsondsm
- well watchUploaded byPaulo Henrique Alves De Oliveira
- 06 PE Architecture MalagaUploaded byMarco Garcia
- Beyond Bits 2Uploaded byJoão Pedro Almeida
- VM DynamicUploaded bypriyanka
- Custos AWSUploaded byJonathan Ruver
- C11-01EUploaded byWalid Aissa
- Project3Uploaded bytom_donato_1
- MacBook Air Users GuideUploaded byryuuki09
- FootPrints Admin Guide 11Uploaded byPaulrc
- PexusPerfLogUploaded bygramesg
- 5b-AVR-Timer(16-bit).pdfUploaded byzohaibshabir
- Discoverer904 Sizing Calculator 129536Uploaded bylemo
- Chapter 4_ Software Basics_ The Ghost in the Machine.pdfUploaded bySasurika Uchiha
- Digital Integrated Circuits - A Design Perspective (2nd Ed) tocUploaded byemilko
- tcstrainAUploaded bypostscript
- Flashing.firmware.odinUploaded byEvangeline Byrne
- dbsizeUploaded byTubagus Purworusmiardi
- 06472706Uploaded bykbkkr
- FM Receiver in GNU RadioUploaded byRakesh S K